harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r946842 - /harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
Date Fri, 21 May 2010 01:10:57 GMT
Author: regisxu
Date: Fri May 21 01:10:57 2010
New Revision: 946842

URL: http://svn.apache.org/viewvc?rev=946842&view=rev
Log:
Fix regression of r944119

Test case SocketChannelTest.testSocket_Block_BasicStatusAfterConnect &
testSocket_NonBlock_BasicStatusAfterConnect need to be fixed after M14 release.

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

Modified: harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java?rev=946842&r1=946841&r2=946842&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
Fri May 21 01:10:57 2010
@@ -1008,6 +1008,10 @@ class SocketChannelImpl extends SocketCh
 
         @Override
         public InetAddress getInetAddress() {
+            if (!isConnected()) {
+                return null;
+            }
+
             if (channel.connectAddress == null && super.getInetAddress() != null)
{
                 channel.connectAddress = new InetSocketAddress(super.getInetAddress(), super.getPort());
             }
@@ -1019,6 +1023,9 @@ class SocketChannelImpl extends SocketCh
 
         @Override
         public SocketAddress getRemoteSocketAddress() {
+            if (!isConnected()) {
+                return null;
+            }
             if (channel.connectAddress == null && super.getInetAddress() != null)
{
                 channel.connectAddress = new InetSocketAddress(super.getInetAddress(), super.getPort());
             }
@@ -1027,6 +1034,9 @@ class SocketChannelImpl extends SocketCh
 
         @Override
         public int getPort() {
+            if (!isConnected()) {
+                return 0;
+            }
             if (channel.connectAddress == null && super.getInetAddress() != null)
{
                 channel.connectAddress = new InetSocketAddress(super.getInetAddress(), super.getPort());
             }



Mime
View raw message