Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with deserialization of an object with alfanumeric code attribute #2

Closed
nebupalpeter opened this issue Jan 16, 2015 · 1 comment

Comments

@nebupalpeter
Copy link

Hi!

I am using arango java driver, version: 2.2.1. I have an Object with attribute name "code" and type String. When I select it from the database by id

new ArangoDriver().graphGetVertex(graphName, collectionName, id, CodeAttributeTest.class)

I got the following exception:

java.lang.IllegalStateException: Failed to execute CommandLineRunner
    at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:680)
    at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:695)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
    at com.nebu.arangotest.ApplicationConfig.main(ApplicationConfig.java:26)
Caused by: java.lang.NumberFormatException: For input string: "alfaNumericCode"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:580)
    at java.lang.Integer.parseInt(Integer.java:615)
    at com.google.gson.JsonPrimitive.getAsInt(JsonPrimitive.java:260)
    at com.arangodb.entity.EntityDeserializers.deserializeBaseParameter(EntityDeserializers.java:156)
    at com.arangodb.entity.EntityDeserializers.access$000(EntityDeserializers.java:56)
    at com.arangodb.entity.EntityDeserializers$DocumentEntityDeserializer.deserialize(EntityDeserializers.java:576)
    at com.arangodb.entity.EntityDeserializers$DocumentEntityDeserializer.deserialize(EntityDeserializers.java:557)
    at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)
    at com.google.gson.Gson.fromJson(Gson.java:805)
    at com.google.gson.Gson.fromJson(Gson.java:870)
    at com.google.gson.Gson$1.deserialize(Gson.java:127)
    at com.arangodb.entity.EntityDeserializers$VertexEntityDeserializer.deserialize(EntityDeserializers.java:1704)
    at com.arangodb.entity.EntityDeserializers$VertexEntityDeserializer.deserialize(EntityDeserializers.java:1691)
    at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)
    at com.google.gson.Gson.fromJson(Gson.java:805)
    at com.google.gson.Gson.fromJson(Gson.java:770)
    at com.google.gson.Gson.fromJson(Gson.java:719)
    at com.arangodb.entity.EntityFactory.createEntity(EntityFactory.java:115)
    at com.arangodb.BaseArangoDriver.createEntityImpl(BaseArangoDriver.java:270)
    at com.arangodb.BaseArangoDriver.createEntity(BaseArangoDriver.java:181)
    at com.arangodb.BaseArangoDriver.createEntity(BaseArangoDriver.java:219)
    at com.arangodb.impl.InternalGraphDriverImpl.getVertex(InternalGraphDriverImpl.java:371)
    at com.arangodb.ArangoDriver.graphGetVertex(ArangoDriver.java:4090)
    at com.nebu.arangotest.main.CodeTestMain.printWithSelectById(CodeTestMain.java:112)
    at com.nebu.arangotest.main.CodeTestMain.run(CodeTestMain.java:126)
    at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:677)

However when I select it via

new ArangoDriver().executeQueryWithResultSet("For p in CollectionName FILTER p._key == @id RETURN p", parameters, CodeAttributeTest.class, true, 20)

I got back the right object without any exception.

gschwab added a commit that referenced this issue Feb 9, 2015
@gschwab
Copy link
Contributor

gschwab commented Feb 9, 2015

Hi!

Sorry, for the delay:
A new version of 2.2.1 is up, fixing the issue.
There are some keywords, that are specially treated while deserializing the json. "code" is one of them.

@gschwab gschwab closed this as completed Feb 9, 2015
gschwab added a commit that referenced this issue Feb 10, 2015
gschwab added a commit that referenced this issue Feb 10, 2015
gschwab added a commit that referenced this issue Feb 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants