issue with deserialization of Response Status enum

39 views
Skip to first unread message

cobo lus

unread,
Sep 3, 2020, 11:56:42 AM9/3/20
to ipf-user
Hi !

I'm trying to deserialize the JSON Represenation of a Respone object but it fails as the Status cannot be mapped to the Status Enum Object:

 com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `org.openehealth.ipf.commons.ihe.xds.core.responses.Status` from String "Success": not one of the values accepted for Enum class: [FAILURE, SUCCESS, PARTIAL_SUCCESS]

The json I get is the following:
"response":{"status":"Success","error":[]}"

I'm using ipf 3.7.0

Anyone knows how to fix that ?

Dmytro Rud

unread,
Sep 3, 2020, 12:22:07 PM9/3/20
to ipf-...@googlegroups.com
Which software does generate the string "Success"?  Cannot it generate "SUCCESS" instead?


--
You received this message because you are subscribed to the Google Groups "ipf-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ipf-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ipf-user/6114a7aa-1a61-4990-bee0-cae85827891dn%40googlegroups.com.

cobo lus

unread,
Sep 3, 2020, 12:29:21 PM9/3/20
to ipf-user
its ipf that generates this. 
it just a serialization/deserialization of Response.
I use that to send the Response object via json between web services.

Dmytro Rud

unread,
Sep 3, 2020, 12:53:42 PM9/3/20
to ipf-...@googlegroups.com
Cannot reproduce, neither with IPF 3.7 nor with 4.0 (latest snapshots in both cases).  The code

@Test
public void testResponse() throws Exception {
Response response = new Response();
response.setStatus(Status.SUCCESS);
System.out.println(response);

ObjectMapper objectMapper = createObjectMapper();
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
String json = objectMapper.writeValueAsString(response);
System.out.println(json);

Object unmarshalled = objectMapper.readValue(json, Response.class);
System.out.println(unmarshalled);
}

prints:

Response(status=SUCCESS, errors=[])
{
  "status" : "Success",
  "error" : [ ]
}
Response(status=SUCCESS, errors=[])

Can you provide a unit test which reproduces the error?

Best regards
Dmytro



cobo lus

unread,
Sep 8, 2020, 1:43:59 AM9/8/20
to ipf-user
will try to provide this asap - the issue happened to me when sending the json back to another service using http rest and then the unmarshalling doesn't work - is there any special json dependency I need to include as I only added the ipf xds data classes so that I have access to the data objects ?

Dmytro Rud

unread,
Sep 11, 2020, 5:47:53 AM9/11/20
to ipf-...@googlegroups.com
You have to include ipf-commons-ihe-xds and all its transitive dependencies.

Best regards
Dmytro

Reply all
Reply to author
Forward
0 new messages