Calling operation "Tag.Suggestion" results in ClassCastException

Hi,

I'm trying to call the operation “Tag.Suggestion” using the java-client. I expected to get a list of tags or something but just get a ClassCastException because the client expect a Map as result but received a ArrayList.

My code is

NuxeoClient client = new NuxeoClient(url, username, password);
Object o = client.automation("Tag.Suggestion").param("searchTerm", userText).execute();

and the resulting stack trace is

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
    at org.nuxeo.client.api.marshaller.NuxeoResponseConverterFactory.convert(NuxeoResponseConverterFactory.java:127)
    at org.nuxeo.client.api.marshaller.NuxeoResponseConverterFactory.convert(NuxeoResponseConverterFactory.java:55)
    at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:116)
    at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:211)
    at retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
    at org.nuxeo.client.api.objects.NuxeoEntity.getResponse(NuxeoEntity.java:135)
    at org.nuxeo.client.api.objects.Operation.execute(Operation.java:118)
    at org.nuxeo.client.api.objects.Operation.execute(Operation.java:131)

Can anybody tell me how to call this operation correctly?

0 votes

0 answers

2222 views

ANSWER