harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r828837 - in /harmony/enhanced/classlib/trunk/modules/luni/src/test/api: common/org/apache/harmony/luni/tests/java/net/SocketTest.java unix/org/apache/harmony/luni/tests/java/net/UnixSocketTest.java
Date Thu, 22 Oct 2009 20:07:25 GMT
Author: odeakin
Date: Thu Oct 22 20:07:24 2009
New Revision: 828837

URL: http://svn.apache.org/viewvc?rev=828837&view=rev
Log:
Apply patch for HARMONY-6360 ([classlib][luni]SocketTest and UnixSocketTest failed on AIX,
because AIX do NOT support connect to port 0)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/net/UnixSocketTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java?rev=828837&r1=828836&r2=828837&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
Thu Oct 22 20:07:24 2009
@@ -1939,8 +1939,8 @@
     @SuppressWarnings("deprecation")
     public void test_shutdownInput() throws IOException {
         ServerSocket server = new ServerSocket(0);
-        Socket client = new Socket(InetAddress.getLocalHost(), server
-                .getLocalPort());
+        int port = server.getLocalPort();
+        Socket client = new Socket(InetAddress.getLocalHost(), port);
 
         Socket worker = server.accept();
         worker.setTcpNoDelay(true);
@@ -1963,7 +1963,9 @@
         server.close();
 
         // Regression test for HARMONY-2944
-        Socket s = new Socket("0.0.0.0", 0, false);
+        // Port 0 is not allowed to be used in connect() on some platforms, 
+        // Since server has been closed here, so the port is free now
+        Socket s = new Socket("0.0.0.0", port, false);
         s.shutdownInput();
         try {
             s.shutdownInput();
@@ -1980,8 +1982,8 @@
     @SuppressWarnings("deprecation")
     public void test_shutdownOutput() throws IOException {
         ServerSocket server = new ServerSocket(0);
-        Socket client = new Socket(InetAddress.getLocalHost(), server
-                .getLocalPort());
+        int port = server.getLocalPort();
+        Socket client = new Socket(InetAddress.getLocalHost(), port);
 
         Socket worker = server.accept();
         OutputStream theOutput = worker.getOutputStream();
@@ -2003,7 +2005,9 @@
         server.close();
 
         // Regression test for HARMONY-2944
-        Socket s = new Socket("0.0.0.0", 0, false);
+        // Port 0 is not allowed to be used in connect() on some platforms, 
+        // Since server has been closed here, so the port is free now
+        Socket s = new Socket("0.0.0.0", port, false);
         s.shutdownOutput();
         try {
             s.shutdownOutput();

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/net/UnixSocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/net/UnixSocketTest.java?rev=828837&r1=828836&r2=828837&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/net/UnixSocketTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/net/UnixSocketTest.java
Thu Oct 22 20:07:24 2009
@@ -119,7 +119,13 @@
 
     public void test_getOutputStream() throws Exception {
         // Regression test for HARMONY-2934
-        Socket socket = new Socket("127.0.0.1", 0, false);
+        // Port 0 is not allowed to be used in connect() on some platforms, 
+        // get a free port here
+        ServerSocket ss = new ServerSocket(0);
+        int port = ss.getLocalPort();
+        ss.close();
+        
+        Socket socket = new Socket("127.0.0.1", port, false);
         OutputStream o = socket.getOutputStream();
         try {
             o.write(1);



Mime
View raw message