[rules-users] Problems with rule builder errors

Dirk Bergstrom dirk at juniper.net
Wed Mar 14 01:31:45 EDT 2007


I'm using trunk (revision 10170), and I'm getting an exception when trying to
read errors after calling PackageBuilder.addPackageFromDrl(String, Reader).  The
getErrors() method spits out this exception:

java.lang.ArrayStoreException
	at java.lang.System.arraycopy(Native Method)
	at java.util.ArrayList.toArray(ArrayList.java:304)
	at org.drools.compiler.PackageBuilder.getErrors(PackageBuilder.java:380)

(The docs for toArray say that exception is thrown if one of the members of the
List is the wrong class for the supplied array.)

If I instead call printErrors, I get something more useful:

java.lang.ClassCastException: org.drools.lang.ExpanderException
	at org.drools.compiler.PackageBuilder.printErrors(PackageBuilder.java:390)

It looks like someone is putting the wrong kind of exception in the error list.

This may be related to some bugs in DSL handling.  I had to comment out all the
blank lines in my DSL file to get it to suppress some other errors, and if I
switch to PackageBuilder.addPackageFromDrl(String), the problem goes away.

-- 
Dirk Bergstrom               dirk at juniper.net
_____________________________________________
Juniper Networks Inc.,          Computer Geek
Tel: 408.745.3182           Fax: 408.745.8905



More information about the rules-users mailing list