[rules-users] passing empty string to a method with varargs failed on the second execution

brachi brachi.w at sapiens.com
Thu Dec 13 11:53:55 EST 2012


ContainsCODE.drl
<http://drools.46999.n3.nabble.com/file/n4021195/ContainsCODE.drl>  
See attached DRL. input is: condContainsCODE=Lists.newArrayList("1", "2",
"4")
I Executed this DRL with the above input twice times. I got indexOutOfBound
Exception.
If I execute it *only one time* I didn't get this exception.
In addition, I found that if I change the rule to be *without the empty
string element*, then I didn't get this exception even if I run it twice
times.

This rule failed on the second time:

when condContainsCODE(Operators.contains(value,"1","2",*" "*))

this succeeded even in the second time:

when condContainsCODE(Operators.contains(value,"1","2"))

also this:
when condContainsCODE(*eval*(Operators.contains(value,"1","2",*" "*)))

That is the *Operators.contains* method:

public static boolean contains(Collection<?> c1, Object.. obj) {
		return c1.containsAll(Lists.newArrayList(obj));
}

I read that are problems with varargs, but I don't understand why only
*space *causes problems, and why only in the *second time*?
looks like optimizer bug...




--
View this message in context: http://drools.46999.n3.nabble.com/passing-empty-string-to-a-method-with-varargs-failed-on-the-second-execution-tp4021195.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list