Description of problem: I receive the NPE when I try to create XStream XML BatchExecutionHelper.newXStreamMarshaller().toXML(command); To create the batch execution command I proceed: Message mo = new Message(); mo.setText("ahoj"); InsertObjectCommand c = new InsertObjectCommand(mo, "message"); List<Command<?>> cmds = new ArrayList<Command<?>>(); Command insertObjectCommand = CommandFactory.newInsert(mo, "message", true, "DEFAULT"); // here I must set the DEFAULT entry point otherwise I get the NPE cmds.add( insertObjectCommand ); cmds.add(CommandFactory.newFireAllRules()); BatchExecutionCommand command = CommandFactory.newBatchExecution(cmds, "ksession1"); Below is the stacktrace of NPE. java.lang.NullPointerException at com.thoughtworks.xstream.io.xml.PrettyPrintWriter.writeText(PrettyPrintWriter.java:231) at com.thoughtworks.xstream.io.xml.PrettyPrintWriter.writeAttributeValue(PrettyPrintWriter.java:223) at com.thoughtworks.xstream.io.xml.PrettyPrintWriter.addAttribute(PrettyPrintWriter.java:218) at com.thoughtworks.xstream.io.WriterWrapper.addAttribute(WriterWrapper.java:41) at org.drools.core.runtime.help.impl.XStreamXML$InsertConverter.marshal(XStreamXML.java:116) It should be enough to set "private String entryPoint = "DEFAULT";" in InsertObjectCommand Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
http://github.com/droolsjbpm/drools/commit/a3b6a327d
Seems that the method newInsert sets null endpoint: getCommandFactoryProvider().newInsert( object,outIdentifier,true, null ); So, the change didn't helped. Then I propose to change the setEntryPoint method to prevent set null entry point. Here is the pull request I propose https://github.com/droolsjbpm/drools/pull/258 also for the other commands which use entry point.
6.0.x: http://github.com/droolsjbpm/drools/commit/23be9bda3 master: http://github.com/droolsjbpm/drools/commit/b71b48d89
Verified in BPMS 6.0.0.ER4