Skip to content

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

Closed
@nebupalpeter

Description

@nebupalpeter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions