Bug 1227375

Summary: Error : no viable alternative at character '\'
Product: [Retired] JBoss BPMS Platform 6 Reporter: Amana <ajuricic>
Component: jBPM DesignerAssignee: Tihomir Surdilovic <tsurdilo>
Status: CLOSED EOL QA Contact: Tibor Zimanyi <tzimanyi>
Severity: low Docs Contact:
Priority: medium    
Version: 6.1.0CC: ajuricic, kverlaen, pzapataf, rzhang, smala, tsurdilo, tzimanyi
Target Milestone: DR1   
Target Release: 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 983347 Environment:
Last Closed: 2020-03-27 20:05:39 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:
Bug Depends On: 983347    
Bug Blocks:    

Description Amana 2015-06-02 14:04:06 UTC
+++ This bug was initially created as a clone of Bug #983347 +++

Description of problem:

"Error : no viable alternative at character '\'" is seen in logs when using "/n" in a Script Task as follows:

I figured this out and it is from the script tasks:

Example:

<drools:script><![CDATA[com.llnw.bpm.UpdateObject _update = new com.llnw.bpm.UpdateObject();\n\n_update.setMessage("This is the message");\n_update.setOppId(324);\n_update.setType("INFO");\n\nkcontext.setVariable("updateObject",_update);]]></drools:script>

they are from the /n.  If I remove the /n then the errors don't show up in logs.

It seems to be a regression as a similar issue was reported in the cloned bz and it seems as that had been fixed.

Comment 2 Jeremy Lindop 2015-12-10 11:19:32 UTC
This is fixed in bpmsuite-6.2.0.GA

Comment 3 Tibor Zimanyi 2016-03-11 09:06:36 UTC
This is still present in 6.3.0.DR2. 

Steps to reproduce: 
1. Create simple process with script task in Business Central. 
2. Add text 

com.llnw.bpm.UpdateObject _update = new com.llnw.bpm.UpdateObject();\n\n_update.setMessage("This is the message");\n_update.setOppId(324);\n_update.setType("INFO");\n\nkcontext.setVariable("updateObject",_update); 

as the body of the script task.

3. Save process. 
4. See logs. 

10:01:54,048 ERROR [stderr] (EJB default - 8) line 1:69 no viable alternative at character '\'
10:01:54,048 ERROR [stderr] (EJB default - 8) line 1:71 no viable alternative at character '\'
10:01:54,048 ERROR [stderr] (EJB default - 8) line 1:115 no viable alternative at character '\'
10:01:54,049 ERROR [stderr] (EJB default - 8) line 1:139 no viable alternative at character '\'
10:01:54,049 ERROR [stderr] (EJB default - 8) line 1:165 no viable alternative at character '\'
10:01:54,049 ERROR [stderr] (EJB default - 8) line 1:167 no viable alternative at character '\'

Reproduced using EAP 6.4.4 and JBoss BPM Suite 6.3.0.DR2.

Comment 4 Jeremy Lindop 2016-03-11 11:46:13 UTC
Looking at the original Description for this BZ, I think the issue is about the way new-lines typed by the user in scripts were serialized into BPMN2 XML.
e.g. if the user typed the next 3 lines (including a blank line) in a script:
com.llnw.bpm.UpdateObject _update = new com.llnw.bpm.UpdateObject();

_update.setMessage("This is the message");

this was serialized to BPMN2 as:

<drools:script><![CDATA[com.llnw.bpm.UpdateObject _update = new com.llnw.bpm.UpdateObject();\n\n_update.setMessage("This is the message");]]></drools:script>

i.e. the string "\n" isn't something the user enters, but was part of the BPMN2 serialization of the Javascript typed by the user.

In Javascript, the characters '\' and '/' are only valid in string constants, so a script which includes either of these characters outside of a string constant should generate an error, and this is what's seen in Comment3 above.

I therefore think it's valid to say this has been fixed.

Comment 5 Tibor Zimanyi 2016-03-11 12:37:14 UTC
After discussion with Jeremy I opened another bug related to this logged error. The bug is here [1]. So I consider tihs verified. 

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1316902