[jboss-jira] [JBoss JIRA] (DROOLS-2280) Resolving rule unit classnames depends on File.separator character

Tibor Zimányi (JIRA) issues at jboss.org
Tue Jan 30 08:34:01 EST 2018


     [ https://issues.jboss.org/browse/DROOLS-2280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tibor Zimányi updated DROOLS-2280:
----------------------------------
    Description: 
When running testNamingConventionOnDrlFile test on Windows, it fails on NPE, because the engine cannot find the rule unit "org/kie/test/MyRuleUnit" defined in the test, because it contains "/" separator character. The method that resolves the classname searches for File.separator character in the mentioned string, which is "\" on Windows [1]. 

This is a bug, because e.g. MemoryFileSystem uses "/" also when running on Windows. The classname resolution should be OS independent.  

[1] https://github.com/kiegroup/drools/blob/5fad04919f255933bdd34afdb8da10b94f2c8c43/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuildContext.java#L184

  was:
When running testNamingConventionOnDrlFile test on Windows, it fails on NPE, because the engine cannot find the rule unit "org/kie/test/MyRuleUnit" defined in the test, because it contains "/" separator character. 

I will provide a fix to the test. 

For resolving the rule unit class, the engine uses OS independent character correctly here [1].

[1] https://github.com/kiegroup/drools/blob/5fad04919f255933bdd34afdb8da10b94f2c8c43/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuildContext.java#L184



> Resolving rule unit classnames depends on File.separator character
> ------------------------------------------------------------------
>
>                 Key: DROOLS-2280
>                 URL: https://issues.jboss.org/browse/DROOLS-2280
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 7.5.0.Final
>            Reporter: Tibor Zimányi
>            Assignee: Tibor Zimányi
>            Priority: Minor
>
> When running testNamingConventionOnDrlFile test on Windows, it fails on NPE, because the engine cannot find the rule unit "org/kie/test/MyRuleUnit" defined in the test, because it contains "/" separator character. The method that resolves the classname searches for File.separator character in the mentioned string, which is "\" on Windows [1]. 
> This is a bug, because e.g. MemoryFileSystem uses "/" also when running on Windows. The classname resolution should be OS independent.  
> [1] https://github.com/kiegroup/drools/blob/5fad04919f255933bdd34afdb8da10b94f2c8c43/drools-compiler/src/main/java/org/drools/compiler/rule/builder/RuleBuildContext.java#L184



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)



More information about the jboss-jira mailing list