Bug 1078969 - Enhance the error messages when you send bad parameters via a remote API
Summary: Enhance the error messages when you send bad parameters via a remote API
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ER2
: 6.1.0
Assignee: Shelly McGowan
QA Contact: Ivo Bek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-20 15:58 UTC by Ivo Bek
Modified: 2020-03-27 19:34 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-27 19:34:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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'.


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