Bug 854965 - Cannot retrieve Boolean variable from Human Task when using generated task form
Summary: Cannot retrieve Boolean variable from Human Task when using generated task form
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: jBPM 5
Version: BRMS 5.3.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER2
: BRMS 5.3.1 GA
Assignee: Kris Verlaenen
QA Contact: Marek Baluch
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-06 12:09 UTC by Jiri Svitak
Modified: 2023-05-01 08:27 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
An error occurred in the Business Central Console whenever parameters were transported as strings via HTTP protocol. They would not properly set as standard process variables such as Boolean, integer, float, and object. This would result in errors such as not being able to retrieve variables from the Human Task. This has been resolved by ensuring data type awareness for standard process variables, and it has been integrated with Business Central Console.
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
test case output (8.69 KB, text/plain)
2012-09-06 12:09 UTC, Jiri Svitak
no flags Details
test case (5.81 KB, application/x-zip-compressed)
2012-09-06 12:14 UTC, Jiri Svitak
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JBPM-3779 0 Major Resolved Cannot retrieve Boolean variable from Human Task when using generated task form 2018-07-16 11:26:03 UTC

Description Jiri Svitak 2012-09-06 12:09:29 UTC
Created attachment 610286 [details]
test case output

Cannot retrieve Boolean variable from Human Task. I have a simple business process with one human task and one Boolean output. Task form generated in Designer creates a check box, but either checking it or leaving it unchecked I receive two different exceptions.

How to reproduce:
1. Download and run BRMS 5.3.0 GA patch 01 (I used standalone version with EAP5).
2. Configure your own user (in my case jsvitak) in your jboss-as. You cannot use admin, because this user doesn't work with human tasks (foreign key violation...admin is not the same as Administrator).
3. Download attached test case.
4. Open Designer and create a package named 'com.sample'. Upload to it business process definition file com.sample.boolean.bpmn2 from the test case. Change actor of the human task to your own user, that you created before. Generate task form and .png image for the process and save it.
5. Run attached maven based test case using the command:
mvn test -Dtest=HTHandlerBooleanTest
6. Log in to business-central (jbpm-console) by using the credentials of your newly created testing user.
7. You should see one task created by the test case and view it. You can check the check box and you'll receive
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
or you can leave check box unchecked and you'll get NPE. To see the whole stack traces see attached log of the test case.

My environment:
BRMS 5.3.0 GA patch01 standalone
EAP 5
local HSQL database

Comment 1 Jiri Svitak 2012-09-06 12:14:43 UTC
Created attachment 610288 [details]
test case

Comment 2 Jiri Svitak 2012-09-07 09:26:31 UTC
The same problem occurs when retrieving an Integer process variable. It's from the server log, because the tested business process was launched from Jenkins web application deployed on EAP 5.

...
2012-09-07 11:19:29,429 ERROR [STDERR] (Thread-73) Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
2012-09-07 11:19:29,429 ERROR [STDERR] (Thread-73) 	at org.jenkinsci.plugins.jbpm.Process_org_jenkinsci_plugins_jbpm_example.returnValueEvaluator2(Unknown Source)
2012-09-07 11:19:29,429 ERROR [STDERR] (Thread-73) 	at org.jenkinsci.plugins.jbpm.Process_org_jenkinsci_plugins_jbpm_exampleReturnValueEvaluator2Invoker.evaluate(Unknown Source)
2012-09-07 11:19:29,429 ERROR [STDERR] (Thread-73) 	at org.jbpm.process.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:128)
2012-09-07 11:19:29,429 ERROR [STDERR] (Thread-73) 	... 23 more

Comment 3 JBoss JIRA Server 2012-09-07 10:53:13 UTC
Maciej Swiderski <swiderski.maciej> updated the status of jira JBPM-3779 to Resolved

Comment 4 JBoss JIRA Server 2012-09-07 10:53:13 UTC
Maciej Swiderski <swiderski.maciej> made a comment on jira JBPM-3779

Problem is caused by mechanism that console uses to get information about parameters that are transmitted via HTTP. They are always of type String and that's why CCE is thrown. 
Fix that was applied makes use of DataType definitions to be able to build an object from it's string representation, following is the list of types that are currently supported:
- Boolean (java.lang.Boolean)
- Integer (java.lang.Integer)
- Float (java.lang.Float)
- Object (java.lang.Object)
- Object (custom class that can be recreated using XStream.fromXML())

When defining type of variable in bpmn2 use either short name, for example Boolean or fqcn java.lang.Boolean

Important to note is the way how boolean values must be taken care of when transmitting them from html form over HTTP, as they are usually represented as check box and browser will not send it at all when checkbox is not checked a special hidden input should be placed directly after it
<input type="checkbox" name="mycheckbox" value="true"/>
<input type="hidden" name="mycheckbox" value="false" />
Some sources recommends to put it before the actual checkbox input field but based on my tests it did not work properly in such configuration as it always replaced the selected value

Comment 5 Maciej Swiderski 2012-09-07 10:54:23 UTC
fix committed into master: https://github.com/droolsjbpm/jbpm/commit/cdd6782505b154cedacd8f589e9f8943d953726f

Comment 6 Maciej Swiderski 2012-09-11 10:14:06 UTC
merged into 5.2.x branch

Comment 7 Jiri Svitak 2012-09-14 08:16:48 UTC
The reproducer has been tested and it's not fixed in BRMS 5.3.1 ER1. I think it's because Maciej set the bug to MODIFIED when Julian was almost finished with the ER1 build, so probably this bug fix was not included.

Setting the state to MODIFIED, and I'll test it with ER2.

Comment 8 JBoss JIRA Server 2012-09-21 22:42:18 UTC
Sebastian Calbaza <calbazasebastian> made a comment on jira JBPM-3779

There is an issue with the fix for this (cdd678250) when setting structureRef to "String" in the bpmn definition(ex.  <itemDefinition id="_vacaIdItem" structureRef="String" />)  and providing a String value in the result mapping.

Probably the fix for this issue is adding an if branch in org.jbpm.bpmn2.xml.PropertyHandler for String type.

Comment 9 Lukáš Petrovický 2012-09-24 08:17:04 UTC
Maciej, please see comment #8. Returning this back to ASSIGNED.

Comment 10 Maciej Swiderski 2012-09-24 16:00:30 UTC
Meged provided pull request (as part of JBPM-3800) and added additional tests to cover all supported data types.

Comment 11 Jiri Svitak 2012-10-04 15:38:29 UTC
Verified in BRMS 5.3.1 ER2.

Comment 12 Douglas Hoffman 2012-10-23 02:25:28 UTC
I have updated the information for the Release Notes. Thanks for all the comments regarding the fix.

- Doug


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