Bug 1182875

Summary: Package Name attribute should be validated by BPMN 2 diagram editor before running the process
Product: [Retired] JBoss BPMS Platform 6 Reporter: ksuzumur
Component: Eclipse ToolingAssignee: Kris Verlaenen <kverlaen>
Status: CLOSED EOL QA Contact: Jozef Marko <jomarko>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0.3CC: bpms-support, jomarko
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 20:07:14 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 ksuzumur 2015-01-16 05:34:36 UTC
Description of problem:
Package Name attribute should be validated by BPMN 2 diagram editor before running the process.

BPMN 2 Diagram Editor can allow to input the following strings in the Package Name attributes text field in the Properties pane -> Process Definition -> Process -> Attributes -> Package Name.

1. The first character is number.(ex. 0123)
2. l18n(ex. Japanse)
3. Java reserved word (ex. this)
4. With Space (ex. package name;)

I can save the bpmn file without error in Problems panel. But if we run this bpmn file , we will get the following error:

org.drools.core.RuntimeDroolsException: invalid package name
	at org.jbpm.compiler.ProcessBuilderImpl.buildProcess(ProcessBuilderImpl.java:198)
	at org.jbpm.compiler.ProcessBuilderImpl.addProcessFromXml(ProcessBuilderImpl.java:281)
	at org.drools.compiler.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:700)
	at org.drools.compiler.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:741)
	at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
	at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
	at org.jbpm.runtime.manager.impl.SimpleRuntimeEnvironment.addAsset(SimpleRuntimeEnvironment.java:104)
	at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.addAsset(RuntimeEnvironmentBuilder.java:281)
	at com.sample.ProcessJPATest.getRuntimeManager(ProcessJPATest.java:125)
	at com.sample.ProcessJPATest.testProcess(ProcessJPATest.java:49)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at junit.framework.TestCase.runTest(TestCase.java:176)
	at junit.framework.TestCase.runBare(TestCase.java:141)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:129)
	at junit.framework.TestSuite.runTest(TestSuite.java:255)
	at junit.framework.TestSuite.run(TestSuite.java:250)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
java.lang.IllegalArgumentException: Cannot add asset: [ERR 102] Line 1:8 mismatched input '123' in package,Parser returned a null Package,unable to parse xml : Exception class org.drools.core.RuntimeDroolsException : invalid package name,
	at org.jbpm.runtime.manager.impl.SimpleRuntimeEnvironment.addAsset(SimpleRuntimeEnvironment.java:111)
	at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.addAsset(RuntimeEnvironmentBuilder.java:281)
	at com.sample.ProcessJPATest.getRuntimeManager(ProcessJPATest.java:125)



Version-Release number of selected component (if applicable):
BPMS 6.0.3
JBDS 8.0.0 GA 
BPMN2 Modeler - jBPM Runtime Extension Feature	1.1.1.201411261859	org.eclipse.bpmn2.modeler.runtime.jboss.feature.group	Eclipse.org

How reproducible:
run sample application

Steps to Reproduce:
1. unzip an attached file
2. mvn test


Expected results:
The warning raises in Problems panel before running the bpmn.

Additional info:

Comment 3 Kris Verlaenen 2015-01-16 15:04:41 UTC
Bob, would it be possible to add validation to the package property of process, to make sure it's an acceptable Java package name?

Comment 4 Robert (Bob) Brodt 2015-01-16 18:47:14 UTC
Sure. Do you mean just syntactic validation, or should we check if the package actually exists?

Comment 5 Robert (Bob) Brodt 2015-01-26 20:40:02 UTC
The package name is validated to ensure it follows Java naming conventions.

Fixed with Luna build 1.1.1.201501262023

Comment 7 Jozef Marko 2015-02-16 08:59:38 UTC
Not included in jbds-8.0.2.GA_jbdsis-8.0.0.CR2.

Verified on BPMN2 Modeler 1.1.2.201502121708

Comment 8 Jozef Marko 2015-04-02 10:06:14 UTC
Verified on jbds-8.1.0.CR1_jbdsis-8.0.1.CR1 - BPMN2 Modeler 1.1.2.Final

Comment 9 Jozef Marko 2015-06-11 06:50:58 UTC
Hi Bob.

For some reason this bug appears again on jbds-8.1.0.GA_jbdsis-8.0.2.CR1 - BPMN2 Modeler 1.1.3.Final. User is able to put 'package name;' as package name of process.

I think, that validation of 'Package Name' field is executed on field 'Id', because if I want to put mentioned string in to the field 'Id', I obtain error like: Characters "package name;" are not valid - expecting a Java Package name.

Comment 10 Robert (Bob) Brodt 2015-06-11 21:30:55 UTC
OK, this should be fixed now in the next 1.1.4 build.

Comment 11 Jozef Marko 2015-06-12 05:19:07 UTC
Bob please let me know exact version of build. BPMN2 Modeler 1.1.4.201506101743	doesn't contain fix yet.

Comment 12 Robert (Bob) Brodt 2015-06-12 15:11:11 UTC
1K apologies, I forgot to publish the build to the update site :(
The version number should be: 1.1.4.201506112142

Comment 13 Jozef Marko 2015-06-15 06:33:23 UTC
No problem. Fix looks good on BPMN2 Modeler 1.1.4.201506121901.

Comment 14 Jozef Marko 2016-01-18 15:04:04 UTC
Bob,
I am unable to set "packageName" and also "id" for process on BPMN2 Modeler 1.1.4.Final, jbdsis-8.0.5

Comment 15 Jozef Marko 2016-01-20 08:06:08 UTC
Bob, sorry, I was using wrong wizard. Package name validated on jbdsis-8.0.5, BPMN2 Modeler 1.1.4.Final