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/08 19:36:47 UTC

svn commit: r494145 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/SocketImpl.java main/java/org/apache/harmony/luni/util/ExternalMessages.properties test/java/tests/api/java/net/SocketImplTest.java

Author: tellison
Date: Mon Jan  8 10:36:46 2007
New Revision: 494145

URL: http://svn.apache.org/viewvc?view=rev&rev=494145
Log:
Apply modified patch for HARMONY-2943 ([classlib][luni]SocketImpl.shutdownInput/Output leads to VM crash)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImpl.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketImplTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImpl.java?view=diff&rev=494145&r1=494144&r2=494145
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketImpl.java Mon Jan  8 10:36:46 2007
@@ -25,6 +25,7 @@
 
 import org.apache.harmony.luni.platform.INetworkSystem;
 import org.apache.harmony.luni.platform.Platform;
+import org.apache.harmony.luni.util.Msg;
 
 /**
  * The abstract superclass of all classes that implement streaming sockets.
@@ -311,17 +312,30 @@
 
     /**
      * Shutdown the input portion of the socket.
+     * 
+     * The default implementation always throws an {@link IOException}
+     * to indicate that the subclass should have overridden this
+     * method.
+     * 
+     * @throws IOException Always.  Designed to be subclassed.
      */
     protected void shutdownInput() throws IOException {
-        shutdownInput = true;
-        this.netImpl.shutdownInput(fd);
+        // KA025=Method has not been implemented
+        throw new IOException(Msg.getString("KA025"));//$NON-NLS-1$
     }
 
     /**
      * Shutdown the output portion of the socket.
+     * 
+     * The default implementation always throws an {@link IOException}
+     * to indicate that the subclass should have overridden this
+     * method.
+     * 
+     * @throws IOException Always.  Designed to be subclassed.
      */
     protected void shutdownOutput() throws IOException {
-        this.netImpl.shutdownOutput(fd);
+        // KA025=Method has not been implemented
+        throw new IOException(Msg.getString("KA025"));//$NON-NLS-1$
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties?view=diff&rev=494145&r1=494144&r2=494145
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties Mon Jan  8 10:36:46 2007
@@ -317,3 +317,4 @@
 KA022=Illegal Proxy.Type or SocketAddress argument
 KA023=Proxy is null or invalid type
 KA024=One of urls is null
+KA025=Method has not been implemented

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketImplTest.java?view=diff&rev=494145&r1=494144&r2=494145
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketImplTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketImplTest.java Mon Jan  8 10:36:46 2007
@@ -84,8 +84,20 @@
 		MockSocketImpl theSocket = new MockSocketImpl();
 		theSocket.setPerformancePreference(1,1,1);
 	}
-	
-	
+
+    /*
+     * @tests java.net.SocketImpl#shutdownOutput()
+     */
+    public void test_shutdownOutput() {
+        MockSocketImpl s = new MockSocketImpl();
+        try {
+            s.shutdownOutput();
+            fail("This method is still not implemented yet,It should throw IOException.");
+        } catch (IOException e) {
+            // expected
+        }
+    }
+
 	// the mock class for test, leave all method empty
 	class MockSocketImpl extends SocketImpl{
 		
@@ -143,6 +155,10 @@
 
         public FileDescriptor getFileDescriptor() {
             return super.getFileDescriptor();
+        }
+        
+        public void shutdownOutput() throws IOException {
+            super.shutdownOutput();
         }
 	}