[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2886) Illegal escape sequence exception in 5.2.0M1. See also JIRA JBRULES-2885

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Thu Apr 21 11:51:18 EDT 2011


    [ https://issues.jboss.org/browse/JBRULES-2886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597140#comment-12597140 ] 

Edson Tirelli commented on JBRULES-2886:
----------------------------------------

Joe, this seems related to a deprecated feature. In Drools 4, we supported strings with single escapes \ only. In Drools 5.0, we adopted the java practice of double escaping \ on regular expressions and we added a knowledge builder configuration (ProcessStringOption) to support backward compatibility, while deprecated the Drools 4 way. In Drools 5.2, we are removing the deprecated scenario as part of the new parser.
Can you confirm that your application was still using ProcessStringOption.YES? 
I added test cases to the code base using the double escaped \\ and did not had any problems:

https://github.com/droolsjbpm/drools/commit/303d9416e28ae44faad611ae7eaac2c34192486c

Let me know the above and we can figure out how to proceed. 

> Illegal escape sequence exception in 5.2.0M1. See also JIRA JBRULES-2885 
> -------------------------------------------------------------------------
>
>                 Key: JBRULES-2886
>                 URL: https://issues.jboss.org/browse/JBRULES-2886
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler
>    Affects Versions: 5.2.0.M1
>         Environment: Windows
> Java 1.5
> Drools 5.2.0M1
>            Reporter: Joe White
>            Assignee: Edson Tirelli
>             Fix For: 5.2.0.M1
>
>
> Exception thrown for rules that work in 5.0.1 and 5.1.1. Rules and exception below. Unit test emailed to team
> ****************************DRL***************************
> package benefitResolution.oop;
> import java.util.Map;
> import com.recondotech.droolsTest.TestObject;
> dialect "mvel"
> rule "Rule with parens"
>       salience 300
>       when
>             $testObj : TestObject($mapData: mapData)
>             Map(this['STRING_WITH_PARENS'] matches '\..*') from $mapData
>       then
>             System.out.println("PASS");
>       end
> **********************************************************
> ************************Exception************************
> Unable to determine the used declarations.
> [Error: illegal escape sequence: .]
> [Near : {... STRING_WITH_PARENS'] ~= "\..* ....}]
>                                           ^
> [Line: 1, Column: 36] : [Rule name='Rule with slash dot']
> java.lang.IllegalArgumentException: Could not parse knowledge.
> 	at com.recondotech.droolsTest.SlashDotTest.readKnowledgeBase(SlashDotTest.java:40)
> 	at com.recondotech.droolsTest.SlashDotTest.testUpdate(SlashDotTest.java:21)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
> 	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list