Bug 985942 - NPE when compiling declared event that has @timestamp with non-existing field
NPE when compiling declared event that has @timestamp with non-existing field
Status: CLOSED CURRENTRELEASE
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: BRE (Show other bugs)
6.0.0
Unspecified Unspecified
unspecified Severity unspecified
: ER2
: 6.0.0
Assigned To: Mario Fusco
Petr Široký
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-18 10:40 EDT by Petr Široký
Modified: 2014-08-06 16:16 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-06 16:16:43 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Petr Široký 2013-07-18 10:40:26 EDT
Description of problem:
When declaring event in DRL file and using @timestamp() with field that does not exists, the compiler throws NPE.
Exampple:

declare NewCustomerEvent
    @role(event)
    @duration(duration)
    @timestamp(nonExistingField)
end


Version-Release number of selected component (if applicable):
6.0.0-DR6

How reproducible:


Steps to Reproduce:
1. Compile DRL file with above event declaration inside.


Actual results:
NPE from compiler.


Expected results:
Meaningful message that says the field does not exists (or cannot be accessed)
Comment 1 Petr Široký 2013-07-20 19:10:53 EDT
Argh, I forgot to paste the stacktrace, here it is:

java.lang.NullPointerException
	at org.drools.compiler.compiler.PackageBuilder.processTypeFields(PackageBuilder.java:2406)
	at org.drools.compiler.compiler.PackageBuilder.processTypeDeclarations(PackageBuilder.java:2357)
	at org.drools.compiler.compiler.PackageBuilder.mergePackage(PackageBuilder.java:1460)
	at org.drools.compiler.compiler.PackageBuilder.processTypeDeclarations(PackageBuilder.java:2237)
	at org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.buildTypeDeclarations(CompositeKnowledgeBuilderImpl.java:268)
	at org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.buildTypeDeclarations(CompositeKnowledgeBuilderImpl.java:247)
	at org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.buildPackages(CompositeKnowledgeBuilderImpl.java:85)
	at org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:75)
	at org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages(AbstractKieModule.java:173)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:39)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieModule(KieBuilderImpl.java:269)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:169)
	at org.kie.internal.utils.KieHelper.build(KieHelper.java:28)
Comment 2 Mario Fusco 2013-07-26 06:04:47 EDT
Fixed with this commit https://github.com/droolsjbpm/drools/commit/898255095c015f56e783c963552682a55d80f2c5
Comment 3 Petr Široký 2013-08-31 13:54:51 EDT
Verified fixed in ER2.

Note You need to log in before you can comment on or make changes to this bug.