[rules-users] NullPointerException on modifyInsert

keithnielsen keithnielsen at discover.com
Fri Nov 21 13:38:21 EST 2008


I have the following test:

public void testFireAllRules() {
		rulesManager = RulesManager.getInstance();
		assertNotNull(rulesManager);
		StatefulSession session =
rulesManager.getStatefulSession("com.dfs.dc.servicing.cms.cid.verification.test");
		assertNotNull(session);
		
		Account account = new Account();
		account.setAccountNumber("6011006500000");
		account.setBalance(200);
		account.setDaysDelinquent(32);
				
		//insert a fact
		FactHandle accountHandle = session.insert(account);
		System.out.println(accountHandle.toExternalForm());
			
		session.fireAllRules();
			
		//insert a fact
		//FactHandle accountHandle2 = session.insert(account);
		//System.out.println(accountHandle2.toExternalForm());
		account.setBalance(300);
		session.modifyInsert(accountHandle, account);
		System.out.println(accountHandle.toExternalForm());
		
	}

When I call modifyInsert I receive a NullPointerException with the following
stacktrace:

java.lang.NullPointerException
	at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:169)
	at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:143)
	at
org.drools.common.AbstractWorkingMemory.modifyInsert(AbstractWorkingMemory.java:1226)
	at
org.drools.common.AbstractWorkingMemory.modifyInsert(AbstractWorkingMemory.java:1183)
	at
com.dfs.ecc.framework.client.rules.test.RulesManagerTest.testFireAllRules(RulesManagerTest.java:110)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at
org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
	at
org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
	at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
	at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
	at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
	at
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
	at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at
org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:574)
	at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:195)
	at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
	at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1212)

I have tried it with both shadow facts enabled and disabled (just fishing
here)

I checked the session and can see that the fact is there with the same ID
after the fireAllRules has returned.

An insert works fine but the modifyInsert does not.

Thanks
-- 
View this message in context: http://www.nabble.com/NullPointerException-on-modifyInsert-tp20627245p20627245.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list