[jboss-jira] [JBoss JIRA] Created: (JBRULES-746) NPE when dumping XML
Edson Tirelli (JIRA)
jira-events at lists.jboss.org
Wed Mar 21 14:55:48 EDT 2007
NPE when dumping XML
--------------------
Key: JBRULES-746
URL: http://jira.jboss.com/jira/browse/JBRULES-746
Project: JBoss Rules
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Drl Parser/Builder
Affects Versions: 3.1-m1
Reporter: Edson Tirelli
Assigned To: Edson Tirelli
Fix For: 3.1-m2
REPORTED BY SANJAY SINGH
---------------------------------------------
What is wrong with this drl file ? When i try to create a xml out of it .. it keeps on failing on me .. while testing things out the rule works just fine .. its just the XmlDumper class which throws exception (InvocationTarget) .. Anybody else tried to generate xmls from drl files .. there are not many examples for the latest syntax of XML so i thought to create the DRL's first and then generate XML's off them .. but a very basic Drl failing is just killing my enthusiasm to go on with drools ..
DRL
package com.walmart.itemfile.item.rules
import com.walmart.itemfile.item.vo.ItemVo;
import com.walmart.itemfile.item.dao.ItemDao;
import com.walmart.itemfile.item.dao.ItemValidationDao;
import java.lang.String;
global com.walmart.itemfile.item.dao.ItemValidationDao itemValidationDao;
global com.walmart.itemfile.rules.ValidationErrorMap errors;
rule "Item status sode cannot be null"
when
item : ItemVo(itemStatusCode == null)
then
errors.addValidationError("nullItemStatusCode","Item Status Code is null");
System.out.println("Item Status Code is " + item.getItemStatusCode());
end
JAVA
DrlParser parser = new DrlParser();
final PackageDescr pkgOriginal = parser.parse( new InputStreamReader( getClass().getResourceAsStream( "testRules.drl" ) ) );
final XmlDumper dumper = new XmlDumper();
final String result = dumper.dump( pkgOriginal );
EXCEPTION
...
Caused by: java.lang.NullPointerException
at org.drools.xml.XmlDumper.replaceIllegalChars(XmlDumper.java:309)
at org.drools.xml.XmlDumper.visitLiteralRestrictionDescr(XmlDumper.java:136)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at org.drools.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:41)
at org.drools.xml.XmlDumper.processFieldConstraint(XmlDumper.java:216)
at org.drools.xml.XmlDumper.visitFieldConstraintDescr(XmlDumper.java:102)
...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list