Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1062859 - NPE in GetTaskContentCommand.java:37 when trying to get task content for second human task in own web app
Summary: NPE in GetTaskContentCommand.java:37 when trying to get task content for seco...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: jBPM Core
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
high
low
Target Milestone: ER2
: 6.0.1
Assignee: Maciej Swiderski
QA Contact: Jiri Svitak
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-08 09:37 UTC by Jiri Svitak
Modified: 2015-06-02 01:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-08-06 20:03:26 UTC
Type: Bug


Attachments (Terms of Use)
server.log (deleted)
2014-02-08 09:37 UTC, Jiri Svitak
no flags Details
rewards-1.0.jar (deleted)
2014-02-08 09:39 UTC, Jiri Svitak
no flags Details

Description Jiri Svitak 2014-02-08 09:37:01 UTC
Created attachment 860854 [details]
server.log

NPE in GetTaskContentCommand.java:37 when trying to get task content for second human task.

Caused by: java.lang.NullPointerException
	at org.jbpm.services.task.commands.GetTaskContentCommand.execute(GetTaskContentCommand.java:37) [jbpm-human-task-core-6.0.2-redhat-2.jar:6.0.2-redhat-2]

To reproduce:
1.) Download and start JBoss EAP 6.1.1 (no configuration necessary)
2.) Install the attached artifact .jar to your local maven repo.
3.) Download, build and deploy app:
git clone https://github.com/jsvitak/jbpm-6-examples.git
git checkout product
cd jbpm-6-examples/rewards-jsf
mvn clean package
mvn jboss-as:deploy
4.) Go to localhost:8080/rewards-jsf, start process, complete task for user john, click to open aprrove task dialog for user mary and exception occurs.

This should work, or at least no NPE should be thrown. I am going to investigate other databases later. It's curious that first task works (both input and output params are correctly passing data), but the second fails to load. When I omit filling the output parameter map, both tasks are loaded and completed well. The same process works in business central well, so the issue might be connected to tx management in web app.

My env:
JBoss EAP 6.1.1
BPMS library version in web app 6.0.2-redhat-2 (CR2)
H2 database (will investigate later with other databases)

Comment 1 Jiri Svitak 2014-02-08 09:39:03 UTC
Created attachment 860855 [details]
rewards-1.0.jar

Install this artifact to your local .m2 repo

Comment 2 Jiri Svitak 2014-02-08 11:14:33 UTC
Additional info:
The task can be normally completed after the NPE, and it passes output data (filled from user-defined form) correctly to process variables.

Comment 3 Maciej Swiderski 2014-02-09 15:36:05 UTC
Jiri,

the problem is that you should use task id and not documentContentId when calling getTaskContent method: https://github.com/jsvitak/jbpm-6-examples/blob/master/rewards-jsf/src/main/java/org/jbpm/examples/ejb/TaskBean.java#L97

so it might work for the first or some execution when taskId and documentContentId will somehow match but it's very dangerous as you might end up having incorrect information - taken from other task than you expect.

Comment 4 Maciej Swiderski 2014-02-12 14:56:41 UTC
added check if task was found to avoid NPE and produce meaningful exception

jbpm
master:
https://github.com/droolsjbpm/jbpm/commit/880b099f9448d3bf11a2e2b25322d500d093624e

6.0x:
https://github.com/droolsjbpm/jbpm/commit/49448fe2830b5440351e4f2a87135935ecdae6b6

Comment 5 Jiri Svitak 2014-02-13 14:44:27 UTC
Thanks Maciej for explanation. You are correct, I have changed my code and now it works well. You've still fixed the NPE, so I'll verify this BZ later. 

NPE was just a result of a bad API usage, so I am lowering the severity.

Comment 6 Jiri Svitak 2014-03-04 11:48:37 UTC
Verified in BPMS 6.0.1.ER2.

Comment 7 Jiri Svitak 2014-03-18 10:04:16 UTC
NPEs are not serious, so no regression test required.


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