Bug 1057749

Summary: REST API : /task/{taskId}/content returns null content
Product: [Retired] JBoss BPMS Platform 6 Reporter: Bernard Tison <btison>
Component: Business CentralAssignee: Marco Rietveld <mrietvel>
Status: CLOSED CURRENTRELEASE QA Contact: Tomas Livora <tlivora>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: kverlaen, lpetrovi, smcgowan
Target Milestone: ER1   
Target Release: 6.0.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:02:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
kjar containing process with human task none

Description Bernard Tison 2014-01-24 17:59:06 UTC
Created attachment 855125 [details]
kjar containing process with human task

Description of problem:

the rest API call /task/{taskId}/content returns null content


Version-Release number of selected component (if applicable):
BPMS 6.0.0.CR1


How reproducible:
Consistently


Steps to Reproduce:
1. make sure the user has role 'Reviewer'
2. Log in into BPMS
3. Deploy the attached kjar (contains a very simple process with a human task)
4. In the BPMS UI, start an instance of the UserTask process - this will create a new task. Verify the taskId in the task tab.
5. In a command window, issue the following command:

curl -HAccept:application/xml --user "<user>:<password>" "localhost:8080/business-central/rest/task/<taskId>/content"

(Replace <user> and <password> with the actual username and password, and <taskId> with the actual task id)

Actual results: nothing is returned from the call


Expected results: task content in xml format


Additional info: 

in org.kie.services.remote.rest.TaskResource, lines 272 - 280

        JaxbContent content = null;
        if( contentId > -1 ) { 
            cmd = new GetContentCommand(contentId);
            result = processRequestBean.doTaskOperationAndSerializeResult(
                    cmd, 
                    "Unable get content " + contentId + " (from task " + taskId + ")");
            content = (JaxbContent) content;
        } 
        return createCorrectVariant(content, headers);

line 278 should become

content = (JaxbContent) result;

instead of

content = (JaxbContent) content;

Comment 2 Marco Rietveld 2014-02-04 11:45:15 UTC
Bernard, thanks very much for both the catch and fix!

Comment 3 Marco Rietveld 2014-02-04 12:10:26 UTC
Fixed. Commits: 

6.0.x: 
https://github.com/droolsjbpm/droolsjbpm-integration/commit/96f4b40b

master: 
https://github.com/droolsjbpm/droolsjbpm-integration/commit/8e947118

(Integration) Tests added, as usual, to the kie-test repository: 
https://github.com/droolsjbpm/kie-tests/commit/122f5ddd
https://github.com/droolsjbpm/kie-tests/commit/bc77b213


(I also added a constructor to the RemoteJmsRuntimeEngineFactory that makes it simpler to construct a JMS based RemoteJmsRuntimeEngine).

Comment 4 Marek Baluch 2014-02-20 14:41:53 UTC
Verified on 6.0.1-ER1