That worked too.  Got a different problem now.  When I run this rule:

rule "Create block rules for unauthorized resources in same network"
   when
       $r : Resource()
       not AuthorizedResource(resource == $r)
       $p : Principal()
   then
       BlockRule block = new BlockRule();
       block.resource = $r;
       assert(block);
end

I get: org.drools.spi.ConsequenceException: java.lang.ArrayIndexOutOfBoundsException: 2
        at org.drools.common.Agenda.fireActivation(Agenda.java:323)
        at org.drools.common.Agenda.fireNextItem(Agenda.java:299)
        at 
org.drools.reteoo.WorkingMemoryImpl.fireAllRules(WorkingMemoryImpl.java:248)
        at 
org.drools.reteoo.WorkingMemoryImpl.fireAllRules(WorkingMemoryImpl.java:261)
        at test.Tester.run(Tester.java:136)
        at test.Tester.firstTry(Tester.java:110)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at 
org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
        at 
org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
        at 
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
        at 
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
        at 
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
        at 
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
        at 
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
        at 
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
        at 
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
        at 
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
        at 
com.intellij.rt.junit4.Junit4TestMethodAdapter.run(Junit4TestMethodAdapter.java:36)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
        at org.drools.reteoo.FactHandleList.get(FactHandleList.java:107)
        at org.drools.reteoo.TupleKey.get(TupleKey.java:90)
        at org.drools.reteoo.ReteTuple.get(ReteTuple.java:153)
        at org.drools.reteoo.ReteTuple.get(ReteTuple.java:160)
        at 
test.Create_block_rules_for_unauthorized_resources_in_same_network_0ConsequenceInvoker.evaluate(Create_block_rules_for_unauthorized_resources_in_same_network_0ConsequenceInvoker.java:13)
        at org.drools.common.Agenda.fireActivation(Agenda.java:321)
        ... 33 more

If I comment out the Principal line, it works fine.  Like this:

rule "Create block rules for unauthorized resources in same network"
   when
       $r : Resource()
       not AuthorizedResource(resource == $r)
       #$p : Principal()
   then
       BlockRule block = new BlockRule();
       block.resource = $r;
       assert(block);
end



Reply via email to