You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/01/02 11:36:48 UTC

svn commit: r491772 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/org/apache/harmony/luni/net/PlainSocketImpl.java test/java/tests/api/java/net/SocketTest.java

Author: tellison
Date: Tue Jan  2 02:36:47 2007
New Revision: 491772

URL: http://svn.apache.org/viewvc?view=rev&rev=491772
Log:
Apply patch HARMONY-2934 ([classlib][luni]UDP socket behaves incorrectly)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java?view=diff&rev=491772&r1=491771&r2=491772
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java Tue Jan  2 02:36:47 2007
@@ -534,7 +534,7 @@
 
     int write(byte[] buffer, int offset, int count) throws IOException {
         if (!streaming) {
-            netImpl.sendDatagram2(fd, buffer, offset, count, port, address);
+            return netImpl.sendDatagram2(fd, buffer, offset, count, port, address);
         }
         return netImpl.sendStream(fd, buffer, offset, count);
     }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java?view=diff&rev=491772&r1=491771&r2=491772
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java Tue Jan  2 02:36:47 2007
@@ -241,7 +241,6 @@
 		assertTrue("Failed to create socket", s.getPort() == sport);
 
 		s = new Socket(InetAddress.getLocalHost().getHostName(), sport, false);
-
 	}
 
 	/**
@@ -520,6 +519,10 @@
 		out.close();
 		assertTrue("write to closed socket did not cause exception", exception);
 
+        // Regression test for harmony-2934
+        s = new Socket("127.0.0.1", 0, false);
+        OutputStream o = s.getOutputStream();
+        o.write(1);
 	}
 
 	/**