Uploaded image for project: 'JBoss Enterprise BRMS Platform 5'
  1. JBoss Enterprise BRMS Platform 5
  2. BRMS-527

ResourceChangeScanner causes NPE for a rule flow without 'version' attribute

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 5.1.0 GA
    • Fix Version/s: 5.1.0.PostGA
    • Component/s: BRE
    • Labels:
      None
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Set 'Version' in JBDS properties editor.

      Show
      Set 'Version' in JBDS properties editor.
    • Release Notes Text:
      Changed equals and hashcode methods. Done.

      Description

      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;
      }
      ====

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                tsurdilovic Tihomir Surdilovic
                Reporter:
                tkobayashi Toshiya Kobayashi
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: