You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by li...@apache.org on 2007/03/13 05:02:19 UTC

svn commit: r517517 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.linux.x86.ibm src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java src/test/java/tests/api/java/net/SocketTest.java

Author: liangyx
Date: Mon Mar 12 21:02:18 2007
New Revision: 517517

URL: http://svn.apache.org/viewvc?view=rev&rev=517517
Log:
Apply patch for HARMONY-3356([testing]Move test.api.java.net.SocketTest out of the exclude list on IBMVME/linux x86)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86.ibm
    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/make/exclude.linux.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86.ibm?view=diff&rev=517517&r1=517516&r2=517517
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86.ibm Mon Mar 12 21:02:18 2007
@@ -1,4 +1,3 @@
 org/apache/harmony/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
-tests/api/java/net/SocketTest.java
 org/apache/harmony/luni/tests/java/lang/SecurityManager2Test.java
 org/apache/harmony/luni/tests/java/lang/PackageTest.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=517517&r1=517516&r2=517517
==============================================================================
--- 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 Mon Mar 12 21:02:18 2007
@@ -223,6 +223,8 @@
                                 timeout, trafficClass, address);
                     }
                 }
+            } else {
+            	netImpl.connectDatagram(fd, aPort, trafficClass, address);
             }
         } catch (ConnectException e) {
             throw new ConnectException(anAddr + ":" + aPort + " - "

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=517517&r1=517516&r2=517517
==============================================================================
--- 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 Mon Mar 12 21:02:18 2007
@@ -520,15 +520,17 @@
 		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);
-
-        // Regression test for harmony-2942
-        s = new Socket("0.0.0.0", 0, false);
-        o = s.getOutputStream();
-        o.write(1);
+		// Regression test for harmony-2934
+        s = new Socket("127.0.0.1", Support_PortManager.getNextPortForUDP(),
+				false);
+		OutputStream o = s.getOutputStream();
+		o.write(1);
+
+		// Regression test for harmony-2942
+		s = new Socket("0.0.0.0", Support_PortManager.getNextPortForUDP(),
+				false);
+		o = s.getOutputStream();
+		o.write(1);
 	}
 
 	/**
@@ -794,18 +796,9 @@
 		// give things some time to settle
 		Thread.sleep(1000);
 
-		int totalBytesRead = 0;
-		byte[] myBytes = new byte[100];
-		while (theInput.available() > 0) {
-			int bytesRead = theInput.read(myBytes, totalBytesRead,
-					myBytes.length - totalBytesRead);
-			totalBytesRead = totalBytesRead + bytesRead;
-		}
-
-		String receivedString = new String(myBytes, 0, totalBytesRead);
-		assertTrue("We should have received no data on shutdown input:"
-				+ receivedString, 0 == totalBytesRead);
-
+		// RI fails here. It is a RI bug not to return 0 to indicate EOF
+		assertEquals(0, theInput.available());
+		
 		theSocket.close();
 		serverSocket.close();
 	}