[jboss-jira] [JBoss JIRA] Resolved: (JBRULES-704) Drools 3.1.M1 Rules build results in java.lang.UnsupportedOperationException

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Sun Jul 1 10:22:57 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBRULES-704?page=all ]

Edson Tirelli resolved JBRULES-704.
-----------------------------------

    Fix Version/s:  4.0.0.MR4
       Resolution: Cannot Reproduce Bug

I could not reproduce the problem with current trunk (revision #12972). I added a unit test to package merge with a function compilation anyway.

Can you please confirm that this is still a problem and if so, reopen the ticket adding a self contained test case or instructions on how to reproduce the problem?

Thank you for reporting.


> Drools 3.1.M1 Rules build results in java.lang.UnsupportedOperationException
> ----------------------------------------------------------------------------
>
>                 Key: JBRULES-704
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-704
>             Project: JBoss Rules
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Drl Parser/Builder
>    Affects Versions: 3.1-m1
>         Environment: Windows 2k
>            Reporter: Thomas Gonzalez
>         Assigned To: Edson Tirelli
>             Fix For:  4.0.0.MR4
>
>
> Initial issue description sent in following email test:
> yep - looks like a bug to me on a quick look - do you want to attach a simple test to a JIRA? 
> On 2/23/07, Tom Gonzalez < tomgon at nortel.com> wrote:
> Getting exception below building rules that build in 3.0.4. 
>   
> Looking at FunctionBuilder we have at line 106. The code in red looks suspicious? Seems it should be mapping "mapping" against the name.
> But that is not what is the cause of the exception apparently put is not supported? 
>         String name = pkg.getName() + "." + ucFirst( functionDescr.getName() ); 
>         LineMappings mapping = new LineMappings( name ); 
>         mapping.setStartLine( functionDescr.getLine() ); 
>         mapping.setOffset( functionDescr.getOffset() );      
>         lineMappings.put( name, lineMappings );   
> [java] INFO: ============== Start build RulePackage: [engrules.ers8600] === 
> ====== 
>      [java] Feb 21, 2007 2:38:28 PM com.nortel.connect.rbuilder.RulePackage addR 
> ulesFromDrlFile 
>      [java] INFO:       adding Rules from: ERS8600Rules.drl (no associated DSL) 
>      [java] Feb 21, 2007 2:38:28 PM com.nortel.connect.rbuilder.RulePackage addR 
> ulesFromDrlFile 
>      [java] INFO:       parsed rules no dsl 
>      [java] java.lang.UnsupportedOperationException 
>      [java]     at java.util.AbstractMap.put(AbstractMap.java:228) 
>      [java]     at org.drools.semantics.java.FunctionBuilder.build(FunctionBuild 
> er.java:110) 
>      [java]     at org.drools.compiler.PackageBuilder.addFunction(PackageBuilder 
> .java:326) 
>      [java]     at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder. 
> java:214) 
>      [java]     at com.nortel.connect.rbuilder.RulePackage.addRulesFromDrlFile(R 
> ulePackage.java:226) 
>      [java]     at com.nortel.connect.rbuilder.RulePackager.build(RulePackager.j 
> ava:205) 
>      [java]     at com.nortel.connect.rbuilder.RulePackager.buildAll(RulePackage 
> r.java:141) 
>      [java]     at com.nortel.connect.rbuilder.RulePackager.main(RulePackager.ja 
> va:91) 
> A second problem is the cause of the UnsupportedOperationException turns out to be our use of the PackageBuilder in 3.0.4 that is no longer supported by 3.1.M1. We are using the merge rules constructor when we create a rule package from scratch as follows:
>         this.droolsPackage = new org.drools.rule.Package(packageName);
>         PackageBuilderConfiguration config = new PackageBuilderConfiguration();
>         config.setJavaLanguageLevel("1.5");
>         this.packageBuilder = new PackageBuilder(droolsPackage, config);
> This used to work before but in version 3.1.M1 in PackageBuilder the Map lineMappings is only initialized with a HashMap when the newPackage() method is invoked and not when the mergePackage() method is invoked. The assumption is the lineMappings has been initialized when mergePackage() has been invoked.
> Changing to properly use from scratch and merge constructors

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list