Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1065314 - Unable to retrieve a JSON formatted Task instance via the REST API
Unable to retrieve a JSON formatted Task instance via the REST API
Status: CLOSED CURRENTRELEASE
Product: JBoss BPMS Platform 6
Classification: Retired
Component: Business Central (Show other bugs)
6.0.1
Unspecified Unspecified
high Severity high
: ER3
: 6.0.2
Assigned To: Marco Rietveld
Ivo Bek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-14 05:46 EST by Marco Rietveld
Modified: 2016-09-20 01:05 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Latest summary: REST operations that retrieved Task instances would fail when forced to use the JSON format (ACCEPT header). There was a server side error thrown when the server instance tried to convert the (JAXB) Task instance to JSON. The workaround for this issue was to use XML instead of JSON (by setting it in the ACCEPT header). This issue has now been fixed in the latest version of the product and the workaround is no longer required. Old Summary: REST operations that retrieve Task instances will fail when forced to use the JSON format (ACCEPT header). There is a server side error thrown when the server instance tries to convert the (JAXB) Task instance to JSON. To workaround this issue, please use XML instead of JSON (by setting it i the ACCEPT header). Cause: Consequence: Fix: Result:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-06 15:50:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
JSON_stack_trace (9.44 KB, text/x-log)
2014-03-09 12:37 EDT, Marek Baluch
no flags Details
Received message with exception on IBM JDK (6.84 KB, text/plain)
2014-05-14 05:02 EDT, Ivo Bek
no flags Details

  None (edit)
Description Marco Rietveld 2014-02-14 05:46:58 EST
Description of problem:

REST operations that retrieve Task instances will fail when forced to use the JSON format (ACCEPT header). 

How reproducible:

Always.

Steps to Reproduce:
1. Call http://server:<port>/business-central/rest/task/<taskId> (GET, with ACCEPT header that specifies the application/json format)

Actual results:

An error will be thrown on the server side when the server instance tries to convert the (Jaxb)Task instance to JSON. 

Expected results:

No error will occur and the client will receive a correctly filled-in and correctly (JSON) formatted instance of the (Jaxb)Task.
Comment 1 Marco Rietveld 2014-02-14 05:48:04 EST
JSON has been chosen as the default format to be used with business-central.
Comment 2 Marco Rietveld 2014-02-14 05:48:50 EST
The fix for this issue is available, I am simply waiting for the appropriate flags in order to push it to the 6.0.x branch.
Comment 4 Marek Baluch 2014-03-09 12:37:16 EDT
Created attachment 872427 [details]
JSON_stack_trace

Marco,

there's still an exception present in the server log. There's a getter conflict between org.jbpm.services.task.impl.model.xml.JaxbTask#getArchived(0 params) and org.jbpm.services.task.impl.model.xml.JaxbTask#isArchived(0 params).

Please see JSON_stack_trace.log for the whole stack-trace.
Comment 5 Marek Baluch 2014-03-09 12:38:29 EDT
If I missed something then please put the issue back to ON_QA. Thanks!
Comment 7 Michael 2014-03-14 13:40:13 EDT
Ticket cherry-picked into 6.0.1.CR1. 
Commits: c66f85ebd2e63bea310fad67d4b3418a22b3ece8
         68e2cd4526495a4431b4b66fb48f5d6bde6a5006
         995a9d1bbaef260da385420a65a55383680c2443
Comment 13 Marco Rietveld 2014-03-25 14:00:23 EDT
Okay, with these commits I ended up just deleting the "isArchived()" method so that the above message isn't possible. I ran the GetTaskJSONTest and it passed. 

However, given that this is try #3, and I've already been wrong twice, I'm not saying anything else. :) 

Commits: 

6.0.x: 
https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/a8e5385a
https://github.com/droolsjbpm/jbpm/commit/aa5b4112
https://github.com/droolsjbpm/jbpm/commit/73729bf1

master: 
https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/b4fe4c67
https://github.com/droolsjbpm/jbpm/commit/cfe190e8
Comment 15 Ivo Bek 2014-04-29 08:11:07 EDT
Verified in BPMS 6.0.2.ER2
Comment 16 Ivo Bek 2014-05-14 05:01:01 EDT
Hi Marco,

the fix works well on Oracle JDK and OpenJDK but I see some problems on IBM JDK.

I rather open this issue once more than to file another one for the same problem but on IBM JDK. I get the following exception on IBM JDK 1.6 and 1.7 for the same reproducer [comment 10 https://bugzilla.redhat.com/show_bug.cgi?id=1065314#c10] :

org.codehaus.jackson.map.JsonMappingException: Conflicting getter definitions for property "archived": org.jbpm.services.task.impl.model.TaskImpl#getArchived(0 params) vs org.jbpm.services.task.impl.model.TaskImpl#isArchived(0 params) (through reference chain: org.jbpm.services.task.impl.model.xml.JaxbTask["task"])
 at org.codehaus.jackson.map.ser.StdSerializerProvider._createAndCacheUntypedSerializer(StdSerializerProvider.java:740)
 at org.codehaus.jackson.map.ser.StdSerializerProvider.findValueSerializer(StdSerializerProvider.java:344)
 at org.codehaus.jackson.map.ser.impl.PropertySerializerMap.findAndAddSerializer(PropertySerializerMap.java:39)

I am going to attach the full message I received with the stacktrace.

Thanks
Comment 17 Ivo Bek 2014-05-14 05:02:10 EDT
Created attachment 895412 [details]
Received message with exception on IBM JDK
Comment 18 Marco Rietveld 2014-05-14 07:30:19 EDT
Thanks for the thorough testing! 

Fixed. I haven't run integration tests on this, but I've fixed the cause of the problem: there were 2 "getter" methods: getArchived() and isArchived(). I've removed the getArchived() method everywhere. 

Commits: 

6.0.x: 
https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/ff773e69
https://github.com/droolsjbpm/jbpm/commit/f398cf50

master: 
https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/4f486448
https://github.com/droolsjbpm/jbpm/commit/d833cd2e
Comment 19 Marek Baluch 2014-06-06 10:48:59 EDT
Test passed. Setting to VERIFIED (on BPMS 6.0.2.ER3).

Note You need to log in before you can comment on or make changes to this bug.