NullPointerException in NioProcessor.transferFile
-------------------------------------------------

                 Key: DIRMINA-570
                 URL: https://issues.apache.org/jira/browse/DIRMINA-570
             Project: MINA
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0.0-M1
         Environment: Linux 2.6.21.6 #1 SMP Wed Jul 25 20:22:10 MST 2007 x86_64 
Intel(R) Xeon(R) CPU
 
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode)

MINA trunk
            Reporter: Geoff Cadien


A NullPointerException exception is thrown from NioProcessor.transferFile when 
an IOException thrown from transferTo and for some reason 
Exception.getMessage() returns null so when attempting 
e.getMessage().contains("Resource temporarily unavailable") a 
NullPointerException is thrown.  Patch is below:

Index: NioProcessor.java
===================================================================
--- NioProcessor.java   (revision 648768)
+++ NioProcessor.java   (working copy)
@@ -192,7 +192,7 @@
             return (int) 
region.getFileChannel().transferTo(region.getPosition(), length, 
session.getChannel());
         } catch (IOException e) {
             // Check to see if the IOException is being thrown due to 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5103988
-            if (e.getMessage().contains("Resource temporarily unavailable")) {
+           if ("Resource temporarily unavailable".equals(e.getMessage())) {
                 return 0;
             } else {
                 throw e;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to