Nice try - but, please, don't. Kindly post the code that actually causes your problem.
-W On 06/03/2013, Bojan Janisch <[email protected]> wrote: > Hello Guys, > > sorry to bother you with this problem, but I'm out of ideas. > I'm using Drools in textmining-context and in basic I have > a function that checks 2 named entites for equality to > ensure that the entities are all different and that the rules > do work only on different named entity objects: > > public static boolean isEqual(Annotation a, Annotation b){ > if(a.equals(b)){ > return true; > } > > return false; > } > > Sometimes there are conditions that need tests of more than > 2 named entites. For this I've written a super method that > calls the isEqual method in a loop: > > public static boolean isEqual(Annotation... a){ > ArrayList<Annotation> outLoop = new > ArrayList<Annotation>(Arrays.asList(a)); > ArrayList<Annotation> inLoop = new ArrayList<Annotation>(Arrays.asList(a)); > > for (Annotation anno1 : outLoop) { > inLoop.remove(anno1); > for (Annotation anno2 : inLoop) { > if(isEqual(anno1,anno2)){ > return true; > } > } > } > > return false; > } > > > My rules could (theoretically) now call the function > eval(isEqual($ne1,$ne2)) or > eval(isEqual($ne1,$ne2,$ne3) or even > eval(isEqual($ne1,$ne2,$ne3,$ne4,$ne5)) and so on. > > So there starts my problem: > > Each time I'm getting an ArrayIndexOutOfBounds Exception from the second > method that looks like this: > > java.lang.RuntimeException: cannot invoke method: isEqual > ... > at java.lang.Thread.dispatchUncaughtException(Thread.java:1888) > Caused by: java.lang.ArrayIndexOutOfBoundsException: 3 > at > org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.executeAll(MethodAccessor.java:149) > at > org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:48) > at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108) > at > org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:38) > ... > > Could someone explain me what's wrong with my code? Thanks for any help. > > Greetings > JB > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
