harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r982887 - in /harmony/enhanced/java/trunk/classlib/modules/nio/src: main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.java
Date Fri, 06 Aug 2010 06:51:16 GMT
Author: hindessm
Date: Fri Aug  6 06:51:15 2010
New Revision: 982887

URL: http://svn.apache.org/viewvc?rev=982887&view=rev
Log:
Applying patch from "[#HARMONY-6493] [classlib][nio]DatagramChannel should
be "bounded" after calling the sendto".

Modified:
    harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java
    harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java?rev=982887&r1=982886&r2=982887&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java
Fri Aug  6 06:51:15 2010
@@ -416,6 +416,7 @@ class DatagramChannelImpl extends Datagr
                 }
             }
             source.position(oldposition + sendCount);
+            isBound = true;
             return sendCount;
         } finally {
             end(sendCount >= 0);

Modified: harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.java?rev=982887&r1=982886&r2=982887&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/DatagramChannelTest.java
Fri Aug  6 06:51:15 2010
@@ -2576,6 +2576,23 @@ public class DatagramChannelTest extends
         }
     }
     
+    public void test_bounded_harmony6493() throws IOException {
+        DatagramChannel server = DatagramChannel.open();
+        InetSocketAddress addr = new InetSocketAddress("localhost", 0);
+        server.socket().bind(addr);
+        SocketAddress boundedAddress = server.socket().getLocalSocketAddress();
+
+        DatagramChannel client = DatagramChannel.open();
+        ByteBuffer sent = ByteBuffer.allocate(1024);
+        sent.put("test".getBytes());
+        sent.flip();
+        client.send(sent, boundedAddress);
+        assertTrue(client.socket().isBound());
+        
+        server.close();
+        client.close();
+    }
+    
     // -------------------------------------------------------------------
     // Mock class for security test.
     // -------------------------------------------------------------------



Mime
View raw message