NullPointerException when somebody uses external marshaller which will throw
some exception
-------------------------------------------------------------------------------------------
Key: SM-1809
URL: https://issues.apache.org/activemq/browse/SM-1809
Project: ServiceMix
Issue Type: Bug
Components: servicemix-file
Affects Versions: 3.3
Reporter: Arkadiusz Burdach
Attachments: nullPointerInSdrEndpoint.diff
Stack:
java.lang.NullPointerException
at
org.apache.servicemix.file.FileSenderEndpoint.processInOnly(FileSenderEndpoint.java:98)
at
org.apache.servicemix.common.endpoints.ProviderEndpoint.process(ProviderEndpoint.java:102)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510)
at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
This is piece of code from SenderEndpoint:
try {
String name = marshaler.getOutputName(exchange, in);
if (name == null) {
newFile = File.createTempFile(tempFilePrefix, tempFileSuffix,
directory);
} else {
newFile = new File(directory, name);
}
(...)
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
logger.error("Caught exception while closing stream on
error: " + e, e);
}
}
//cleaning up incomplete files after things went wrong
if (!success) {
logger.debug("An error occurred while writing file " +
newFile.getCanonicalPath() + ", deleting the invalid file");
if (!newFile.delete()) {
logger.warn("Unable to delete the file " +
newFile.getCanonicalPath() + " after an error had occurred");
}
}
How you can see, if there is exception in getOutputName() or in
File.createTempFile(), which is very possible, user will see only NullPointer
in logs caused by this line (Exception will not be rethrowed):
logger.debug("An error occurred while writing file " +
newFile.getCanonicalPath() + ", deleting the invalid file");
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.