[jboss-jira] [JBoss JIRA] Created: (JBRULES-1985) NPE in parser on optional metadata ()
Edson Tirelli (JIRA)
jira-events at lists.jboss.org
Thu Feb 26 19:55:44 EST 2009
NPE in parser on optional metadata ()
-------------------------------------
Key: JBRULES-1985
URL: https://jira.jboss.org/jira/browse/JBRULES-1985
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler
Affects Versions: 5.0.0.M5
Reporter: Edson Tirelli
Assignee: Edson Tirelli
Fix For: 5.0.0.CR1
The exception:
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.drools.lang.RuleParserTest.execTreeParser(RuleParserTest.java:4071)
at org.drools.lang.RuleParserTest.newParser(RuleParserTest.java:4038)
at org.drools.lang.RuleParserTest.parse(RuleParserTest.java:3996)
at org.drools.lang.RuleParserTest.parseResource(RuleParserTest.java:4025)
at org.drools.lang.RuleParserTest.testTypeDeclaration1(RuleParserTest.java:3762)
Caused by: java.lang.NullPointerException
at org.drools.lang.descr.DescrFactory.createTypeField(DescrFactory.java:401)
at org.drools.lang.DescrBuilderTree.decl_field(DescrBuilderTree.java:1758)
at org.drools.lang.DescrBuilderTree.type_declaration(DescrBuilderTree.java:1592)
at org.drools.lang.DescrBuilderTree.statement(DescrBuilderTree.java:575)
at org.drools.lang.DescrBuilderTree.compilation_unit(DescrBuilderTree.java:222)
... 34 more
Here is the drl that causes it:
[declare_type_1.drl]
package org.drools;
declare NetworkNode
locElevation: java.math.BigDecimal
name: String @key
nodeClass: String
locLongitude: java.math.BigDecimal
nodeType: String
locLatitude: java.math.BigDecimal
end
declare NetworkConnection
id: String @key
node1: NetworkNode
node2: NetworkNode
hops: Integer
end
declare NetworkEvent
@role( event )
@timestamp( creationTime )
id: String @key
locElevation: java.math.BigDecimal
description: String
sourceComponent: NetworkNode
locLongitude: java.math.BigDecimal
severity: Integer
creationTime: java.util.Date
locLatitude: java.math.BigDecimal
end
the test function in RuleParserTest.java you can use to replicate:
public void testTypeDeclaration1() throws Exception {
parseResource( "compilation_unit",
"compilation_unit",
"declare_type_1.drl" );
final PackageDescr pack = walker.getPackageDescr();
final List<TypeDeclarationDescr> declarations = pack.getTypeDeclarations();
assertEquals( 3,
declarations.size() );
}
I believe @key is the cause, I based my code on the example from the documentation:
declare Person
@author( Bob )
@dateOfCreation( 01-Feb-2009 )
name : String @key @maxLength( 30 )
dateOfBirth : Date
address : Address
end
Regards
--zoly
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list