java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • The following exception was reported to me: {code} ERROR 2016-08-31 01:31:15,218 [cd82f685-af3a-4dd1-ba95-eafd20dc0137_Worker-1] com.mirth.connect.connectors.file.FileReceiver: Unable to dispatch message to channel cd82f685-af3a-4dd1-ba95-eafd20dc0137: java.lang.NullPointerException {code} It is not enough to really tell where this is coming from. I found that removing a file after the original poll is done but before the bytes are read will lead to a similar exception. {code} ERROR 2016-09-13 16:27:26,745 [File Reader Polling Thread on Windows FTP (7260bdc5-b402-4bc5-9413-3fc7aa51822d) < 7260bdc5-b402-4bc5-9413-3fc7aa51822d_Worker-1] com.mirth.connect.connectors.file.FileReceiver: Unable to dispatch message to channel 7260bdc5-b402-4bc5-9413-3fc7aa51822d: java.lang.NullPointerException at com.mirth.connect.connectors.file.FileReceiver.getBytesFromFile(FileReceiver.java:523) at com.mirth.connect.connectors.file.FileReceiver.processFile(FileReceiver.java:347) at com.mirth.connect.connectors.file.FileReceiver.processFiles(FileReceiver.java:247) at com.mirth.connect.connectors.file.FileReceiver.poll(FileReceiver.java:203) at com.mirth.connect.donkey.server.channel.PollConnectorJob.execute(PollConnectorJob.java:49) at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) {code} This is happening because the inputstream returned from con.readFile is null, I'm not sure if this is only for ftp mode. FTPClient._openDataConnection_ sends a preliminary command and checks the status. In this case the FTP server returns a 550 code: {code} (000120)9/13/2016 16:27:56 PM - eduardo (10.10.12.113)> RETR eduardo - Copy (4) - Copy.txt (000120)9/13/2016 16:27:56 PM - eduardo (10.10.12.113)> 550 File not found {code} Because of this FTPClient returns a null socket and then eventually a null inputstream is returned. {code} if (!FTPReply.isPositivePreliminary(sendCommand(command, arg))) { return null; } {code} I suspect that there are other ways that this could happen, maybe intermittent network issues. We should probably just check if the inputstream returned is null and let the user know that the file could not be read for an unknown reason(since the underlying libraries don't break execution under certain circumstances).
    via by Eduardo Armendariz,
    • java.lang.NullPointerException at com.mirth.connect.connectors.file.FileReceiver.getBytesFromFile(FileReceiver.java:523) at com.mirth.connect.connectors.file.FileReceiver.processFile(FileReceiver.java:347) at com.mirth.connect.connectors.file.FileReceiver.processFiles(FileReceiver.java:247) at com.mirth.connect.connectors.file.FileReceiver.poll(FileReceiver.java:203) at com.mirth.connect.donkey.server.channel.PollConnectorJob.execute(PollConnectorJob.java:49) at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
    No Bugmate found.