Bug 1078969

Summary: Enhance the error messages when you send bad parameters via a remote API
Product: [Retired] JBoss BPMS Platform 6 Reporter: Ivo Bek <ibek>
Component: Business CentralAssignee: Shelly McGowan <smcgowan>
Status: CLOSED EOL QA Contact: Ivo Bek <ibek>
Severity: low Docs Contact:
Priority: medium    
Version: 6.0.1CC: kverlaen
Target Milestone: ER2   
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 19:34:04 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:

Description Ivo Bek 2014-03-20 15:58:54 UTC
Description of problem:

I have a process definition with a custom type variable. When you start the process with a different unknown type, there are two scenarios what will happen for REST and JMS:

For JMS API, you will get at the time the process is being started:

Caused by: org.kie.services.client.serialization.SerializationException: Unable to load JAXB class 'org.jboss.qa.bpms.jbpm.integration.MyType2
	at org.kie.services.client.serialization.JaxbSerializationProvider.commaSeperatedStringToClassSet(JaxbSerializationProvider.java:175) [kie-services-jaxb-6.0.2-redhat-4.jar:6.0.2-redhat-4]
	at org.kie.services.remote.jms.RequestMessageBean.getJaxbSerializationProvider(RequestMessageBean.java:288) [kie-services-remote-6.0.2-redhat-4.jar:6.0.2-redhat-4]
	... 68 more
Caused by: java.lang.ClassNotFoundException: org.jboss.qa.bpms.jbpm.integration.MyType2
	at java.lang.ClassLoader.findClass(ClassLoader.java:531) [rt.jar:1.7.0_51]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425) [rt.jar:1.7.0_51]
	at org.drools.core.common.ProjectClassLoader$InternalTypesClassLoader.loadType(ProjectClassLoader.java:300) [drools-core-6.0.2-redhat-4.jar:6.0.2-redhat-4]
	at org.drools.core.common.ProjectClassLoader$InternalTypesClassLoader.loadClass(ProjectClassLoader.java:287) [drools-core-6.0.2-redhat-4.jar:6.0.2-redhat-4]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358) [rt.jar:1.7.0_51]
	at org.kie.services.client.serialization.JaxbSerializationProvider.commaSeperatedStringToClassSet(JaxbSerializationProvider.java:173) [kie-services-jaxb-6.0.2-redhat-4.jar:6.0.2-redhat-4]
	... 69 more

For REST API the behaviour is quite different. The start of process is successfully done but the object is of another type than expected and so when you want to use it, you will get:

org.apache.xerces.dom.ElementNSImpl cannot be cast to org.jboss.qa.bpms.jbpm.integration.MyType

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


How reproducible:


Steps to Reproduce:
1. Create new data object with String property "text" using the Data modeler in Business Central
2. Create new business process with a variable of the type you created in the step 1 and add script task to print content of the variable.
3. Copy the type class to your client and RENAME it (e.g. from MyType to MyType2)
4. Use REST API or JMS API to start the process.
5. See the exceptions at the server side.

Actual results:

You get awful responses or the process behave wrongly just because an error response has not been returned earlier.

Expected results:

For bad parameters which are not recognized correctly, a BadRequest response is returned back with explanation that the type XYZ was not recognized.

Additional info:

Comment 1 Marco Rietveld 2014-09-23 13:37:29 UTC
Fixed. See the code here: 

https://github.com/droolsjbpm/droolsjbpm-integration/commit/b2793891#diff-22683ad45ad6f7235ec30c4ec752754cR170

Parameters of command requests submitted by the Remote (client) Java API are now checked to make sure that they are not instances of "org.w3c.dom.Element", which the ElementNSImpl class is an instance of. If an 'Element' instance is found, an exception is thrown.

Comment 2 Ivo Bek 2015-01-09 18:26:37 UTC
Verified in BPMS 6.1.0.ER3

A wrong attempt produces IllegalStateException: Could not unmarshall user-defined class instance parameter of type 'myType2'.