[
https://jira.jboss.org/browse/JBPM-2622?page=com.atlassian.jira.plugin.sy...
]
Maciej Swiderski updated JBPM-2622:
-----------------------------------
Attachment: JBPM-2622.patch
Attaching a patch that allows to invoke static method (based on given example
Integer.parseInt). Solution changes behavior of ObjectDescriptor construct method. It
still tries to look up for constructor but in case of not finding it will return null
instead of throwing exception. This due to further logic that checks if returned object is
null, if so it will try to invoke static method.
Please let me know what do you think about this solution.
fix java static factory method use case
----------------------------------------
Key: JBPM-2622
URL:
https://jira.jboss.org/browse/JBPM-2622
Project: jBPM
Issue Type: Task
Security Level: Public(Everyone can see)
Reporter: Tom Baeyens
Assignee: Maciej Swiderski
Fix For: jBPM 4.x
Attachments: JBPM-2622.patch
this doesn't work as expected.
<process name="OrderWithRules">
<start>
<transition to="isImportant">
<java var="amount" class="java.lang.Integer"
method="parseInt">
<arg><object expr="#{amount}" /></arg>
</java>
</transition>
</start>
cause is to be found somewhere in JavaBinding, i think
if (XmlUtil.attribute(element, "method", true, parse, null)!=null) {
UserCodeReference invocationReference = parser.parseUserCodeReference(element,
parse);
javaActivity.setInvocationReference(invocationReference);
ObjectDescriptor objectDescriptor = (ObjectDescriptor)
invocationReference.getDescriptor();
javaActivity.setArgDescriptors(objectDescriptor.getArgDescriptors());
objectDescriptor.setArgDescriptors(null);
javaActivity.setMethodName(objectDescriptor.getMethodName());
objectDescriptor.setMethodName(null);
}
by setting the methodName to null in the object descriptor
(objectDescriptor.setMethodName(null)), the object descriptor will not see it as a static
factory method, but instead will look for the constructor of the class.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira