harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r418992 - /incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java
Date Tue, 04 Jul 2006 12:11:52 GMT
Author: tellison
Date: Tue Jul  4 05:11:52 2006
New Revision: 418992

URL: http://svn.apache.org/viewvc?rev=418992&view=rev
Log:
Apply patch HARMONY-741 ([classlib][nio] Remove unnecessary check for AsynchronousCloseException
in o.a.h.nio.internal.DatagramChannelImpl.)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java?rev=418992&r1=418991&r2=418992&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/DatagramChannelImpl.java
Tue Jul  4 05:11:52 2006
@@ -27,7 +27,6 @@
 import java.net.SocketException;
 import java.nio.ByteBuffer;
 import java.nio.channels.AlreadyConnectedException;
-import java.nio.channels.AsynchronousCloseException;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.DatagramChannel;
 import java.nio.channels.NotYetConnectedException;
@@ -63,8 +62,6 @@
 
     private static final String ERRMSG_NONBLOKING_OUT = "The socket is marked as nonblocking
operation would block";
 
-    private static final String ERRMSG_ASYNCHRONOUSCLOSE = "The call was cancelled";
-
     // -------------------------------------------------------------------
     // Instance variables
     // -------------------------------------------------------------------
@@ -90,7 +87,7 @@
     // lock for read and receive
     private final Object readLock = new Object();
 
-    // lock for write and receive
+    // lock for write and send
     private final Object writeLock = new Object();
 
     // used to store the trafficClass value which is simply returned
@@ -290,11 +287,7 @@
         } catch (SocketException e) {
             // FIXME Depend on former function,it's a work round, wait for
             // native improve.
-            String msg = e.getMessage();
-            if (ERRMSG_ASYNCHRONOUSCLOSE.equals(msg)) {
-                throw new AsynchronousCloseException();
-            }
-            if (ERRMSG_NONBLOKING_OUT.equals(msg)) {
+            if (ERRMSG_NONBLOKING_OUT.equals(e.getMessage())) {
                 return null;
             }
             throw e;
@@ -433,9 +426,10 @@
             }
             boolean loop = isBlocking();
             do {
-                // handle asynchronous closing
                 if (!isOpen()) {
-                    throw new AsynchronousCloseException();
+                    // AsynchronizeCloseException will be thrown by end(boolean)
+                    // in finally block.
+                    break;
                 }
                 if (isConnected()) {
                     readCount = networkSystem
@@ -451,12 +445,6 @@
                 }
             } while (loop);
             return readCount;
-        } catch (SocketException e) {
-            // FIXME it's a work round, wait for native improve.
-            if (e.getMessage().equals(ERRMSG_ASYNCHRONOUSCLOSE)) {
-                throw new AsynchronousCloseException();
-            }
-            throw e;
         } catch (InterruptedIOException e) {
             // FIXME improve native code.
             if (e.getMessage().equals(ERRMSG_TIMEOUT)) {
@@ -464,7 +452,7 @@
             }
             throw e;
         } finally {
-            end(readCount >= 0);
+            end(readCount > 0);
         }
     }
 



Mime
View raw message