My Environment
- ArangoDB Version: 3.4.0
- Java Driver Version: 5.0.4
Steps to reproduce
This issue happens when trying to get a vertex using the Java Driver
- Create a document which key contains a +
arangoDbGraphDriver.collection("mycollection").insertVertex("+123")
- Fetch the document using the same key
arangoDbGraphDriver.collection("mycollection").getVertex("+123", VertexEntity.class)
Problem:
The document is not found
Expected result:
I should be able to get the vertex back using the same key.
Explanation
The issue seems to be related to the fact that the driver encodes the url to make the request to Arango server but the server does not decode it in order to make the search.
When inserting a vertex using the graph driver the:
arangoDbGraphDriver.collection("mycollection").insertVertex("+123")
The request generated is similar to the following curl:
curl --basic --user "root:" -X POST http://localhost:8529/_db/mydb/_api/gharial/mygraph/vertex/mycollection -d '{"_key":"+123"}'
However when the vertex is fetched using the driver:
arangoDbGraphDriver.collection("mycollection").getVertex("+123", VertexEntity.class)
The request generated encodes the url which looks like:
curl --basic --user "root:" -X GET http://localhost:8529/_db/mydb/_api/gharial/mygraph/vertex/mycollection/%2B123
{"error":true,"errorMessage":"document not found","code":404,"errorNum":1202}
Furthermore, and just for my own testing purposes, when I directly made a curl to arango server without the encoding key I was able to get it.
curl --basic --user "root:" -X GET
http://localhost:8529/_db/mydb/_api/gharial/mygraph/vertex/mycollection/+123
{"error":false,"code":200,"vertex":{"_key":"+123","_id":"mycollection/+123","_rev":"_Y8cR9tu--B"}}
If the driver encodes the url, the server should decode it. Otherwise there is no way I can get back keys that contain certain characters.