[jboss-jira] [JBoss JIRA] Created: (JBRULES-3042) KnowledgeAgent.applyChangeSet(notExistingResource) should throw an understandable exception instead of a NullPointerException

Geoffrey De Smet (JIRA) jira-events at lists.jboss.org
Thu May 19 09:47:00 EDT 2011


KnowledgeAgent.applyChangeSet(notExistingResource) should throw an understandable exception instead of a NullPointerException
-----------------------------------------------------------------------------------------------------------------------------

                 Key: JBRULES-3042
                 URL: https://issues.jboss.org/browse/JBRULES-3042
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
            Reporter: Geoffrey De Smet
             Fix For: 5.3.0.M1


Discovered by the guvnor-examples MortgageClientExample

The exception is essentially eaten here in KnowledgeAgentImpl:
{code}
        try {
            changeSet = reader.read( resource.getReader() );
        } catch ( Exception e ) {
            this.listener.exception( new RuntimeException(
                                                           "Unable to parse ChangeSet",
                                                           e ) );
        }
{code}
OK, it logs it, but it doesn't throw an exception (might be related to use of the Agent in spring??? where we don't want it to die on a network IO problem?).
Instead a NPE occurs later because the changeSet is still null:
{code}
Exception in thread "main" java.lang.NullPointerException
	at org.drools.agent.impl.KnowledgeAgentImpl.processChangeSet(KnowledgeAgentImpl.java:223)
	at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:189)
	at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:174)
	at org.drools.guvnor.examples.mortgage.client.MortgageClientExample.readKnowledgeBase(MortgageClientExample.java:81)
	at org.drools.guvnor.examples.mortgage.client.MortgageClientExample.main(MortgageClientExample.java:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
{code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list