Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-550

NPE while removing and adding same package

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate Issue
    • Affects Version/s: 3.0.4
    • Fix Version/s: 3.0.5
    • Component/s: drools-compiler
    • Labels:
      None
    • Environment:

      Windows

      Description

      I am trying to reload the rule which is modified externally [ without stopping my rule engine which already has the mentioned rule loaded]. When adding is commented everything works well.

      // Code snippet as follows

      ruleBase = RuleBaseFactory.newRuleBase();

      final Reader source = new InputStreamReader( RuleService.class.getResourceAsStream("/rules/" + "TestAddNew.drl" ) );

      PackageBuilder builder = new PackageBuilder();
      builder.addPackageFromDrl( source );
      ruleBase.addPackage( builder.getPackage() );

      workingMemory = ruleBase.newWorkingMemory( );

      workingMemory.assertObject(new Object());

      ruleBase.removePackage("com.test.one");

      final Reader sourceOne = new InputStreamReader( RuleService.class.getResourceAsStream("/rules/" + "TestAddNew.drl" ) );

      PackageBuilder builder_1 = new PackageBuilder();
      builder_1.addPackageFromDrl( sourceOne );
      ruleBase.addPackage( builder_1.getPackage() );

      System.out.println("Rule successfully Added");

      ///////////// Rule file //////////////////////////

      package com.test.one

      import java.lang.Object;

      rule addNewRule
      no-loop true
      when
      eval( 1 > 2 )
      then
      System.out.println("True evaluated");
      end

        Gliffy Diagrams

          Attachments

          1. StackTrace.txt
            2 kB
          2. TestAddNew.drl
            0.2 kB
          3. TestAddRule.java
            2 kB

            Activity

              People

              • Assignee:
                tirelli Edson Tirelli
                Reporter:
                rsgodbole Ravi Godbole
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: