mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mhe...@apache.org
Subject svn commit: r610673 - /mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java
Date Thu, 10 Jan 2008 05:00:23 GMT
Author: mheath
Date: Wed Jan  9 21:00:22 2008
New Revision: 610673

URL: http://svn.apache.org/viewvc?rev=610673&view=rev
Log:
Fix for DIRMINA-503.  Added catch for IOException that is being thrown because of this bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5103988

Modified:
    mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java

Modified: mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java?rev=610673&r1=610672&r2=610673&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioProcessor.java Wed
Jan  9 21:00:22 2008
@@ -173,8 +173,16 @@
 
     @Override
     protected int transferFile(NioSession session, FileRegion region, int length) throws
Exception {
-        int writtenBytes = (int) region.getFileChannel().transferTo(region.getPosition(),
length, session.getChannel());
-        return writtenBytes;
+        try {
+            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")) {
+                return 0;
+            } else {
+                throw e;
+            }
+        }
     }
 
     protected static class IoSessionIterator implements Iterator<NioSession> {



Mime
View raw message