Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1082032

Summary: NPE displayed in the output of rest query which tries to retrieve information about work item which not exists
Product: [Retired] JBoss BPMS Platform 6 Reporter: Anton Giertli <agiertli>
Component: Business CentralAssignee: Marco Rietveld <mrietvel>
Status: CLOSED CURRENTRELEASE QA Contact: Ivo Bek <ibek>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0.1CC: ibek, kverlaen, smcgowan, vigoyal
Target Milestone: ER1   
Target Release: 6.0.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
A NullPointerException was displayed to the user when a query was made via a REST command for a WorkItem that didn't exist. Instead of informing the user that the WorkItem didn't exist anymore, the exception was displayed. This has now been fixed by displaying a user friendly message on execution of such a query: 'RestOperationException thrown with message 'WorkItem 1 does not exist.'
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 19:51:09 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
xml error
none
bpmn process used for testing none

Description Anton Giertli 2014-03-28 14:07:53 UTC
Description of problem:

If you query workitem with ID which is not valid, this is the output


<response>
<status>FAILURE</status>
<url>
/business-central/rest/runtime/org.kie.example:project1:1.0.0-SNAPSHOT/workitem/1
</url>
<stackTrace>
java.lang.NullPointerException at org.kie.services.client.serialization.jaxb.impl.process.JaxbWorkItem.setResult(JaxbWorkItem.java:116) at org.kie.services.client.serialization.jaxb.impl.process.JaxbWorkItem.<init>(JaxbWorkItem.java:48) at org.kie.services.remote.rest.RuntimeResource.workitem_workItemId(RuntimeResource.java:221) at org.kie.services.remote.rest.RuntimeResource$Proxy$_$$_WeldClientProxy.workitem_workItemId(RuntimeResource$Proxy$_$$_WeldClientProxy.java) at sun.reflect.GeneratedMethodAccessor315.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.jbpm.designer.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407) at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:408) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) at java.lang.Thread.run(Thread.java:744)
</stackTrace>
</response>
Version-Release number of selected component (if applicable):

BPM 6.0.0 GA
How reproducible:

always
Steps to Reproduce:
1. create process with human task in business centrla, build, deploy, start.
2. Execute http://localhost:8080/business-central/rest/runtime/deploymentid/workitem/NOT_VALID_ID
3. The exception is displayed

Actual results:
Nasty exception is displayed.

Expected results:
 Something more user friendly is displayed, like 
"WorkItem with the given ID wasn't found"

Additional info:

Comment 1 Anton Giertli 2014-03-28 14:08:54 UTC
This probably applies for other queries as well - please do change the output to something more user friendly when the query is not valid.

Comment 3 Anton Giertli 2014-04-02 10:48:40 UTC
Created attachment 881723 [details]
xml error

Comment 4 Anton Giertli 2014-04-02 10:49:07 UTC
Created attachment 881725 [details]
bpmn process used for testing

Comment 5 Anton Giertli 2014-04-02 10:49:49 UTC
Hi,

after brief consultation with Marco I have another findings. Even though the process is still active it is not possible to query the WorkItem which is already finished. I would expect that the WorkItem should be available *at least* through the whole process lifecycle.

I have attached:
 - xml which contains the error
 - bpmn process which I have used for testing
 
The sequence I have used for testing :

- [GET] http://localhost:8080/business-central/rest/runtime/org.kie.example:project1:1.0.0-SNAPSHOT/workitem/1
- [POST] http://localhost:8080/business-central/rest/runtime/org.kie.example:project1:1.0.0-SNAPSHOT/workitem/1/complete?map_tVar=value
- [GET] http://localhost:8080/business-central/rest/runtime/org.kie.example:project1:1.0.0-SNAPSHOT/workitem/1 - NPE is displayed ------at this point I would expect a proper answer with the result elements filled with data I have supplied in the previous step.

Cheers,
Anton

Comment 7 Ivo Bek 2014-04-29 14:13:31 UTC
Verified in BPMS 6.0.2.ER2

Now the response contains 'RestOperationException thrown with message 'WorkItem 1 does not exist.'