Simon Lewis
Simon Lewis

Reputation: 17

ArangoDB Spring Data 2, java.lang.Object / invalid map type

I have recently upgraded to Spring Boot 2 (and therefore Spring data 2) and have the latest Arango java driver and arango-spring-data versions (5.0.1 and 3.1.1 respectively)

I'm now having problems fetching a property with type java.lang.Object

I get this error

.... due to HttpClientErrorException: {"status":"BAD_REQUEST","timestamp":"2018-11-10 17:20:07","message":"Bad request. The server cannot complete the request as it is invalid.","detailMessage":"Unsupported Map type: java.lang.Object","invalidParameters":[]}

I can see that in the DefaultArangoConverter if the type is Object it's been treated as if it were a map...

if (typeToUse.isMap() || ClassTypeInformation.OBJECT.equals(typeToUse)) {
    return readMap(typeToUse, source);
}

....

in readMap(..)

final Map<Object, Object> map = CollectionFactory.createMap(type.getType(), keyType, source.size());

CollectionFactory is used to make the "map" - and it's not happy.

CollectionFactory.java
} else if (!Map.class.isAssignableFrom(mapType)) {
  throw new IllegalArgumentException("Unsupported Map type: " + mapType.getName());

Does anyone else get this? I may have config'd incorreclty, but I'm using fairly out-of-the-box config.

Update: If the type is Map it works ok, but if the map contains a map (ie in one of the 'values') I get the same error.

Upvotes: 1

Views: 169

Answers (1)

mpv89
mpv89

Reputation: 1891

This is a bug in the current version of arangodb-spring-data.

I already created a PR on github which fixes it.

Upvotes: 1

Related Questions