[rules-dev] NPE when building package

Zoltan Farkas zoly at daxtechnologies.com
Fri Jan 16 10:18:36 EST 2009


OK, found the problem!
 
In my package I was having a model "testModel" that had no facts
declared.
This was causing the NPE when building the package.
So I think we need to check for this case or not allow the user to do
this.
 
--zoly
 
 

________________________________

From: rules-dev-bounces at lists.jboss.org
[mailto:rules-dev-bounces at lists.jboss.org] On Behalf Of Zoltan Farkas
Sent: Friday, January 16, 2009 9:51 AM
To: Rules Dev List
Subject: RE: [rules-dev] NPE when building package


Yes, I did a standalone test and in passes.
 
In my test I used the text version of the package from guvnor, that I
believe is generated by ContentPackageAssembler.getDRL().
however PackageBuilder has no issues with that version.
 
Now my next place to investigate is guvnors ContentPackageAssembly... 
 
and the NPE happens as I can see from the stack trace in:
ContentPackageAssembly.loadDeclaredTypes.
 
If you have any sugestions to better approach solving this problem let
me know. As it is right now I will look into the code and try to
understand what is going on.
 
regards
 
--zoly
 
 

________________________________

From: rules-dev-bounces at lists.jboss.org
[mailto:rules-dev-bounces at lists.jboss.org] On Behalf Of Mark Proctor
Sent: Thursday, January 15, 2009 6:26 PM
To: Rules Dev List
Subject: Re: [rules-dev] NPE when building package


Zoltan Farkas wrote: 

	Hi Mark, I need to have the unit test inside guvnor or another
project that depends on it.
	 
	The code fails in guvnor when I do build package.
	 
	and I believe the problem might be related to BRMSPackageBuilder
that inherits from PackageBuilder or ContentPackageAssembler
	 
	where should I create the unit test ?

Have you tried doing this as a standalone unit test first? As the
problem will be in the PackageBuilder, not in the Guvnor. Just following
one of the examples in MiscTest.

Mark


	 
	 
	--zoly

________________________________

	From: rules-dev-bounces at lists.jboss.org
[mailto:rules-dev-bounces at lists.jboss.org] On Behalf Of Mark Proctor
	Sent: Thursday, January 15, 2009 4:48 PM
	To: Rules Dev List
	Subject: Re: [rules-dev] NPE when building package
	
	
	Zoltan Farkas wrote: 

		the actual package namespace contains dots, I removed
them for privacy purposes.

	ok, can i ask you to make a unit test for me, that I can put
into MiscTest ?
	
http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/
test/java/org/drools/integrationtests/MiscTest.java
	
	Thanks
	
	Mark
	

		 
		--zoly

________________________________

		From: rules-dev-bounces at lists.jboss.org
[mailto:rules-dev-bounces at lists.jboss.org] On Behalf Of Mark Proctor
		Sent: Thursday, January 15, 2009 4:26 PM
		To: Rules Dev List
		Subject: Re: [rules-dev] NPE when building package
		
		
		Zoltan Farkas wrote: 

			I am getting a NPE when building a package with
guvnor:

		I think it might be a bug when a package namespace
doesn't have a dot in it.
		
		Mark
		

			 
			 
			java.lang.NullPointerException
			        at
org.drools.compiler.PackageBuilder.validateUniqueRuleNames(PackageBuilde
r.java:826)
			        at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:548)
			        at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java
:287)
			        at
org.drools.guvnor.server.builder.ContentPackageAssembler.loadDeclaredTyp
es(ContentPackageAssembler.java:249)
			        at
org.drools.guvnor.server.builder.ContentPackageAssembler.preparePackage(
ContentPackageAssembler.java:216)
			        at
org.drools.guvnor.server.builder.ContentPackageAssembler.<init>(ContentP
ackageAssembler.java:103)
			        at
org.drools.guvnor.server.builder.ContentPackageAssembler.<init>(ContentP
ackageAssembler.java:117)
			        at
org.drools.guvnor.server.ServiceImplementation.buildPackage(ServiceImple
mentation.java:1366)
			        at
org.drools.guvnor.server.ServiceImplementation.buildPackage(ServiceImple
mentation.java:1350)
			
			 
			 
			here is my package source:
			 
			package MyTest
			import pack.EventVO
			import pack.ExtendedEventVO
			
			declare ExtendedEventVO
			    @role( event )
			end
			 
			rule "Test"
			 dialect "mvel"
			 when
			  ExtendedEventVO( )
			 then
			  System.out.println("Hello World, events
happen!!!")
			end

			rule 'TestEntryPoint'
			dialect 'mvel'
			 when
			  ExtendedEventVO() from entry-point eventDoor
			 then
			  System.out.println("Hello World, events
happen!!!")
			end
			 
			This seems like a possible BUG.
			 
			Let me know, thanks
			 
			--zoly
			
________________________________


			_______________________________________________
			rules-dev mailing list
			rules-dev at lists.jboss.org
	
https://lists.jboss.org/mailman/listinfo/rules-dev
			  


		
________________________________


		_______________________________________________
		rules-dev mailing list
		rules-dev at lists.jboss.org
		https://lists.jboss.org/mailman/listinfo/rules-dev
		  


	
________________________________


	_______________________________________________
	rules-dev mailing list
	rules-dev at lists.jboss.org
	https://lists.jboss.org/mailman/listinfo/rules-dev
	  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20090116/6b8742c2/attachment.html 


More information about the rules-dev mailing list