Bug 724621 (BRMS-527) - ResourceChangeScanner causes NPE for a rule flow without 'version' attribute
Summary: ResourceChangeScanner causes NPE for a rule flow without 'version' attribute
Keywords:
Status: CLOSED NEXTRELEASE
Alias: BRMS-527
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion)
Version: 5.1.0 GA
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: ---
: 5.1.0.PostGA
Assignee: Tihomir Surdilovic
QA Contact:
URL: http://jira.jboss.org/jira/browse/BRM...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-05 15:44 UTC by Toshiya Kobayashi
Modified: 2011-01-05 20:59 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-05 20:59:50 UTC
Type: Bug


Attachments (Terms of Use)
DroolsExam33_ResourceChangeScanner_NPE.zip (10.76 KB, application/zip)
2011-01-05 15:45 UTC, Toshiya Kobayashi
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker BRMS-527 0 None None None Never

Description Toshiya Kobayashi 2011-01-05 15:44:05 UTC
Help Desk Ticket Reference: https://c.na7.visual.force.com/apex/Case_View?id=500A0000005fAzW&sfdc.override=1
Workaround: Workaround Exists
Workaround Description: Set 'Version' in JBDS properties editor.
securitylevel_name: Public

If you have a rule flow(.rf) in your package and the rule flow doesn't have version attribute(='Version' is empty in JBDS properties editor), ResourceChangeScanner causes NullPointerException.

Attached a test case as DroolsExam33_ResourceChangeScanner_NPE.zip.
- Unzip  DroolsExam33_ResourceChangeScanner_NPE.zip
- Import it as an eclipse project (You may need to modify 'Java Build Path')
- Create 'testflow' package in BRMS
- Upload Rule1.drl and Rule1to10.rf in src/main/rules dir to 'testflow' package
- build package in BRMS
- Run TestFlow.java
-- While running, build package in BRMS again
-- NPE will be thrown

[2011:01:04 18:01:642:exception]
java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage  
        at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:916)
        at org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:704)
        at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:584)
        at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
        at org.drools.agent.impl.KnowledgeAgentImpl$ChangeSetNotificationDetector.run(KnowledgeAgentImpl.java:1106)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
        at org.drools.process.core.impl.ProcessImpl.equals(ProcessImpl.java:134)
        at java.util.HashMap.put(HashMap.java:376)
        at java.util.HashSet.add(HashSet.java:200)
        at org.drools.agent.impl.KnowledgeAgentImpl$RegisteredResourceMap.putDefinition(KnowledgeAgentImpl.java:1150)
        at org.drools.agent.impl.KnowledgeAgentImpl.addDefinitionMapping(KnowledgeAgentImpl.java:1037)
        at org.drools.agent.impl.KnowledgeAgentImpl.buildResourceMapping(KnowledgeAgentImpl.java:496)
        at org.drools.agent.impl.KnowledgeAgentImpl.buildResourceMapping(KnowledgeAgentImpl.java:443)
        at org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:912)
        ... 5 more

It doesn't happen with Drools trunk build. (nor BRMS 5.0.2)

In BRMS 5.1.0, org.drools.process.core.impl.ProcessImpl.equals() is based on name and version.
====
    public boolean equals(final Object o) {
        if ( o instanceof ProcessImpl ) {
            return ((ProcessImpl) o).getName().equals( this.name ) && ((ProcessImpl) o).getVersion().equals( this.version );
        }
        return false;
    }
====

In jBPM 5.0-CR1 which Drools trunk depends on, org.jbpm.process.core.impl.ProcessImpl.equals() is based on id.
====
    public boolean equals(final Object o) {
        if ( o instanceof ProcessImpl ) {
         if (this.id != null) {
         return ((ProcessImpl) o).getId() == null;
         }
         return this.id.equals(((ProcessImpl) o).getId());
        }
        return false;
    }
====

Comment 1 Toshiya Kobayashi 2011-01-05 15:45:27 UTC
Attachment: Added: DroolsExam33_ResourceChangeScanner_NPE.zip


Comment 2 Tihomir Surdilovic 2011-01-05 20:59:50 UTC
Release Notes Text: Added: Changed equals and hashcode methods. Done.



Note You need to log in before you can comment on or make changes to this bug.