[jboss-jira] [JBoss JIRA] Created: (JBRULES-3139) NPE in KnowledgeAgentImpl due to missing change set

Wolfgang Laun (JIRA) jira-events at lists.jboss.org
Wed Jul 13 01:14:23 EDT 2011


NPE in KnowledgeAgentImpl due to missing change set
---------------------------------------------------

                 Key: JBRULES-3139
                 URL: https://issues.jboss.org/browse/JBRULES-3139
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: drools-core  (expert)
            Reporter: Wolfgang Laun
            Assignee: Mark Proctor


A missing Change Set causes a NPE in KnowledgeAgentImpl.

import java.net.URL;
import org.drools.*;
import org.drools.agent.*;
import org.drools.conf.*;
import org.drools.builder.*;
import org.drools.io.*;

    public void setup() throws Exception {
	KnowledgeBaseConfiguration kBaseConfig =
	    KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        kBaseConfig.setOption(EventProcessingOption.STREAM);
	//   kBaseConfig.setOption( cehOption );

        ResourceChangeScannerConfiguration rcsConf =
            ResourceFactory.getResourceChangeScannerService()
                           .newResourceChangeScannerConfiguration();
        rcsConf.setProperty("drools.resource.scanner.interval", "20");
        ResourceFactory.getResourceChangeScannerService().configure( rcsConf );

        KnowledgeAgentConfiguration kaConf =
            KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        kaConf.setProperty("drools.agent.scanDirectories", "true");
        kaConf.setProperty("drools.agent.scanResources", "true");
        kaConf.setProperty("drools.agent.newInstance", "false");

        KnowledgeBase kBase =
            KnowledgeBaseFactory.newKnowledgeBase(kBaseConfig);
        KnowledgeAgent kAgent =
            KnowledgeAgentFactory.newKnowledgeAgent( "drools agent", kBase, kaConf);

        String urlString = "file://tmp/MissingChangeSet.xml";
        try {
             URL url = new URL(urlString);
             Resource urlResource = ResourceFactory.newUrlResource(url);

	     if( urlResource != null ){
		 System.out.println( "Resource " + urlResource );
	     }

             kAgent.applyChangeSet( urlResource );
        } catch (Exception e) {
             System.out.println("Caught exception: " + e.getMessage());
             e.printStackTrace();
        }
}


Caught exception: null
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 hashcode.Main.setup(Main.java:75)


--
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