Bug 983495 - NPE is thrown when JaxbCommandsRequest doesn't contain deploymentId
NPE is thrown when JaxbCommandsRequest doesn't contain deploymentId
Status: CLOSED CURRENTRELEASE
Product: JBoss BPMS Platform 6
Classification: JBoss
Component: Business Central (Show other bugs)
6.0.0
Unspecified Unspecified
unspecified Severity unspecified
: ER2
: 6.0.0
Assigned To: Marco Rietveld
Ivo Bek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-11 06:24 EDT by Ivo Bek
Modified: 2016-09-20 01:04 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-06 16:13:15 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)
Reproducer test (2.85 KB, text/x-java)
2013-07-22 03:57 EDT, Ivo Bek
no flags Details

  None (edit)
Description Ivo Bek 2013-07-11 06:24:30 EDT
Description of problem:

From source codes, the JaxbCommandsRequest (https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/kie-remote/kie-services-client/src/main/java/org/kie/services/client/serialization/jaxb/JaxbCommandsRequest.java) doesn't require the deploymentId to be set. For task commands the deploymentId isn't important, so it makes sense. But when I don't set it, in the server log appears following exception:

java.lang.NullPointerException
	at org.kie.services.remote.util.CommandsRequestUtil.processJaxbCommandsRequest(CommandsRequestUtil.java:24)
	at org.kie.services.remote.rest.TaskResource.execute(TaskResource.java:77)
	at org.kie.services.remote.rest.TaskResource$Proxy$_$$_WeldClientProxy.execute(TaskResource$Proxy$_$$_WeldClientProxy.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
	at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
..........

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 1 Marco Rietveld 2013-07-12 07:27:15 EDT
Hi Ivo, 

Could you include more information about how you caused the NPE? It happens in a weird place and I'm not totally sure how it happened. 

Thanks!
Comment 2 Ivo Bek 2013-07-15 03:24:32 EDT
Below is the code I use to send a task command without deploymentId.

================================================
URL address = new URL(url + "/task/execute");
ClientRequest restRequest = createRequest(address);
        
JaxbCommandsRequest commandMessage = new JaxbCommandsRequest(commands); // here I don't put the deploymentId

String body = JaxbSerializationProvider.convertJaxbObjectToString(commandMessage);
restRequest.body(MediaType.APPLICATION_XML, body);

ClientResponse<JaxbCommandsResponse> responseObj = restRequest.post(JaxbCommandsResponse.class);
================================================

The exception is only in the response message and it's an internal server error (500). There is nothing more in the server log.
Comment 3 Ivo Bek 2013-07-22 03:57:27 EDT
Created attachment 776788 [details]
Reproducer test

Added a reproducer test. The test requires some changes to make it work but the main idea should be clear.
Comment 4 Ivo Bek 2013-07-22 03:59:08 EDT
I forgot one important change to reproduce the issue, following line

JaxbCommandsRequest commandMessage = new JaxbCommandsRequest(deploymentId, commands);

should be changed to

JaxbCommandsRequest commandMessage = new JaxbCommandsRequest(commands);
Comment 5 Marco Rietveld 2013-07-22 21:08:01 EDT
The commit with the fix can be found here: 

https://github.com/droolsjbpm/droolsjbpm-integration/commit/7fc8cc01d4d556cb93b3b8a8b8f126b2b680c60b
Comment 6 Ivo Bek 2013-09-09 07:41:44 EDT
Verified in BPMS 6.0.0.ER2

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