Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 94964 invoked from network); 4 Jul 2006 12:12:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Jul 2006 12:12:21 -0000 Received: (qmail 63909 invoked by uid 500); 4 Jul 2006 12:12:15 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 63752 invoked by uid 500); 4 Jul 2006 12:12:15 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 63462 invoked by uid 99); 4 Jul 2006 12:12:14 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2006 05:12:13 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2006 05:12:13 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 114DE1A983A; Tue, 4 Jul 2006 05:11:53 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: harmony-commits@incubator.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060704121153.114DE1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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); } }