OSDN Git Service

2007-03-27 Casey Marshall <csm@gnu.org>
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Mar 2007 01:02:10 +0000 (01:02 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Mar 2007 01:02:10 +0000 (01:02 +0000)
PR classpath/31302:
* gnu/javax/net/ssl/provider/SSLSocketImpl.java (SSLSocketImpl):
Always make a new socket.
(bind, connect, getInetAddress, getLocalAddress, getPort,
getLocalPort, getRemoteSocketAddress, getLocalSocketAddress,
setTcpNoDelay, getTcpNoDelay, setSoLinger, getSoLinger,
setOOBInline, getOOBInline, setSoTimeout, getSoTimeout,
setSendBufferSize, getSendBufferSize, setReceiveBufferSize,
getReceiveBufferSize, setKeepAlive, getKeepAlive, setTrafficClass,
getTrafficClass, setReuseAddress, getReuseAddress, close,
shutdownInput, shutdownOutput, isConnected, isBound, isClosed,
isInputShutdown, isOutputShutdown): Always use
'underlyingSocket'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123285 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/classpath/ChangeLog
libjava/classpath/gnu/javax/net/ssl/provider/SSLSocketImpl.java
libjava/classpath/lib/gnu/javax/net/ssl/provider/SSLSocketImpl.class

index 7c1e391..376c072 100644 (file)
@@ -1,3 +1,19 @@
+2007-03-27  Casey Marshall  <csm@gnu.org>
+
+       PR classpath/31302:
+       * gnu/javax/net/ssl/provider/SSLSocketImpl.java (SSLSocketImpl):
+       Always make a new socket.
+       (bind, connect, getInetAddress, getLocalAddress, getPort,
+       getLocalPort, getRemoteSocketAddress, getLocalSocketAddress,
+       setTcpNoDelay, getTcpNoDelay, setSoLinger, getSoLinger,
+       setOOBInline, getOOBInline, setSoTimeout, getSoTimeout,
+       setSendBufferSize, getSendBufferSize, setReceiveBufferSize,
+       getReceiveBufferSize, setKeepAlive, getKeepAlive, setTrafficClass,
+       getTrafficClass, setReuseAddress, getReuseAddress, close,
+       shutdownInput, shutdownOutput, isConnected, isBound, isClosed,
+       isInputShutdown, isOutputShutdown): Always use
+       'underlyingSocket'.
+
 2007-03-27  Tom Tromey  <tromey@redhat.com>
 
        PR classpath/31303:
 2007-03-27  Tom Tromey  <tromey@redhat.com>
 
        PR classpath/31303:
index 0181b66..eead725 100644 (file)
@@ -200,7 +200,7 @@ public class SSLSocketImpl extends SSLSocket
   
   public SSLSocketImpl(SSLContextImpl contextImpl, String host, int port)
   {
   
   public SSLSocketImpl(SSLContextImpl contextImpl, String host, int port)
   {
-    this(contextImpl, host, port, null, false);
+    this(contextImpl, host, port, new Socket(), true);
   }
   
   public SSLSocketImpl(SSLContextImpl contextImpl, String host, int port,
   }
   
   public SSLSocketImpl(SSLContextImpl contextImpl, String host, int port,
@@ -412,17 +412,8 @@ public class SSLSocketImpl extends SSLSocket
     ByteBuffer emptyBuffer = ByteBuffer.allocate(0);
     SSLEngineResult result = null;
     
     ByteBuffer emptyBuffer = ByteBuffer.allocate(0);
     SSLEngineResult result = null;
     
-    DataInputStream sockIn = null;
-    if (underlyingSocket != null)
-      sockIn = new DataInputStream(underlyingSocket.getInputStream());
-    else
-      sockIn = new DataInputStream(super.getInputStream());
-
-    OutputStream sockOut = null;
-    if (underlyingSocket != null)
-      sockOut = underlyingSocket.getOutputStream();
-    else
-      sockOut = super.getOutputStream();
+    DataInputStream sockIn = new DataInputStream(underlyingSocket.getInputStream());
+    OutputStream sockOut = underlyingSocket.getOutputStream();
     
     try
       {
     
     try
       {
@@ -550,69 +541,48 @@ public class SSLSocketImpl extends SSLSocket
 
   @Override public void bind(SocketAddress bindpoint) throws IOException
   {
 
   @Override public void bind(SocketAddress bindpoint) throws IOException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.bind(bindpoint);
-    else
-      super.bind(bindpoint);
+    underlyingSocket.bind(bindpoint);
   }
   
   @Override public void connect(SocketAddress endpoint) throws IOException
   {
   }
   
   @Override public void connect(SocketAddress endpoint) throws IOException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.connect(endpoint);
-    else
-      super.connect(endpoint);
+    underlyingSocket.connect(endpoint);
   }
 
   @Override public void connect(SocketAddress endpoint, int timeout)
     throws IOException
   {
   }
 
   @Override public void connect(SocketAddress endpoint, int timeout)
     throws IOException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.connect(endpoint, timeout);
-    else
-      super.connect(endpoint, timeout);
+    underlyingSocket.connect(endpoint, timeout);
   }
 
   @Override public InetAddress getInetAddress()
   {
   }
 
   @Override public InetAddress getInetAddress()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getInetAddress();
-    return super.getInetAddress();
+    return underlyingSocket.getInetAddress();
   }
   
   @Override public InetAddress getLocalAddress()
   {
   }
   
   @Override public InetAddress getLocalAddress()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getLocalAddress();
-    return super.getLocalAddress();
+    return underlyingSocket.getLocalAddress();
   }
   
   @Override public int getPort()
   {
   }
   
   @Override public int getPort()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getPort();
-    return super.getPort();
+    return underlyingSocket.getPort();
   }
 
   @Override public int getLocalPort()
   {
   }
 
   @Override public int getLocalPort()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getLocalPort();
-    return super.getLocalPort();
+    return underlyingSocket.getLocalPort();
   }
 
   @Override public SocketAddress getRemoteSocketAddress()
   {
   }
 
   @Override public SocketAddress getRemoteSocketAddress()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getRemoteSocketAddress();
-    return super.getRemoteSocketAddress();
+    return underlyingSocket.getRemoteSocketAddress();
   }
 
   public SocketAddress getLocalSocketAddress()
   {
   }
 
   public SocketAddress getLocalSocketAddress()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getLocalSocketAddress();
-    return super.getLocalSocketAddress();
+    return underlyingSocket.getLocalSocketAddress();
   }
 
   @Override public SocketChannel getChannel()
   }
 
   @Override public SocketChannel getChannel()
@@ -632,32 +602,22 @@ public class SSLSocketImpl extends SSLSocket
 
   @Override public void setTcpNoDelay(boolean on) throws SocketException
   {
 
   @Override public void setTcpNoDelay(boolean on) throws SocketException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.setTcpNoDelay(on);
-    else
-      super.setTcpNoDelay(on);
+    underlyingSocket.setTcpNoDelay(on);
   }
 
   @Override public boolean getTcpNoDelay() throws SocketException
   {
   }
 
   @Override public boolean getTcpNoDelay() throws SocketException
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getTcpNoDelay();
-    return super.getTcpNoDelay();
+    return underlyingSocket.getTcpNoDelay();
   }
 
   @Override public void setSoLinger(boolean on, int linger) throws SocketException
   {
   }
 
   @Override public void setSoLinger(boolean on, int linger) throws SocketException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.setSoLinger(on, linger);
-    else
-      super.setSoLinger(on, linger);
+    underlyingSocket.setSoLinger(on, linger);
   }
 
   public int getSoLinger() throws SocketException
   {
   }
 
   public int getSoLinger() throws SocketException
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getSoLinger();
-    return super.getSoLinger();
+    return underlyingSocket.getSoLinger();
   }
 
   @Override public void sendUrgentData(int x) throws IOException
   }
 
   @Override public void sendUrgentData(int x) throws IOException
@@ -667,167 +627,114 @@ public class SSLSocketImpl extends SSLSocket
 
   @Override public void setOOBInline(boolean on) throws SocketException
   {
 
   @Override public void setOOBInline(boolean on) throws SocketException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.setOOBInline(on);
-    else
-      super.setOOBInline(on);
+    underlyingSocket.setOOBInline(on);
   }
 
   @Override public boolean getOOBInline() throws SocketException
   {
   }
 
   @Override public boolean getOOBInline() throws SocketException
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getOOBInline();
-    return super.getOOBInline();
+    return underlyingSocket.getOOBInline();
   }
 
   @Override public void setSoTimeout(int timeout) throws SocketException
   {
   }
 
   @Override public void setSoTimeout(int timeout) throws SocketException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.setSoTimeout(timeout);
-    else
-      super.setSoTimeout(timeout);
+    underlyingSocket.setSoTimeout(timeout);
   }
 
   @Override public int getSoTimeout() throws SocketException
   {
   }
 
   @Override public int getSoTimeout() throws SocketException
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getSoTimeout();
-    return super.getSoTimeout();
+    return underlyingSocket.getSoTimeout();
   }
 
   @Override public void setSendBufferSize(int size) throws SocketException
   {
   }
 
   @Override public void setSendBufferSize(int size) throws SocketException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.setSendBufferSize(size);
-    else
-      super.setSendBufferSize(size);
+    underlyingSocket.setSendBufferSize(size);
   }
 
   @Override public int getSendBufferSize() throws SocketException
   {
   }
 
   @Override public int getSendBufferSize() throws SocketException
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getSendBufferSize();
-    return super.getSendBufferSize();
+    return underlyingSocket.getSendBufferSize();
   }
 
   @Override public void setReceiveBufferSize(int size) throws SocketException
   {
   }
 
   @Override public void setReceiveBufferSize(int size) throws SocketException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.setReceiveBufferSize(size);
-    else
-      underlyingSocket.setReceiveBufferSize(size);
+    underlyingSocket.setReceiveBufferSize(size);
   }
 
   @Override public int getReceiveBufferSize() throws SocketException
   {
   }
 
   @Override public int getReceiveBufferSize() throws SocketException
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getReceiveBufferSize();
-    return super.getReceiveBufferSize();
+    return underlyingSocket.getReceiveBufferSize();
   }
 
   @Override public void setKeepAlive(boolean on) throws SocketException
   {
   }
 
   @Override public void setKeepAlive(boolean on) throws SocketException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.setKeepAlive(on);
-    else
-      super.setKeepAlive(on);
+    underlyingSocket.setKeepAlive(on);
   }
 
   @Override public boolean getKeepAlive() throws SocketException
   {
   }
 
   @Override public boolean getKeepAlive() throws SocketException
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getKeepAlive();
-    return super.getKeepAlive();
+    return underlyingSocket.getKeepAlive();
   }
 
   @Override public void setTrafficClass(int tc) throws SocketException
   {
   }
 
   @Override public void setTrafficClass(int tc) throws SocketException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.setTrafficClass(tc);
-    else
-      super.setTrafficClass(tc);
+    underlyingSocket.setTrafficClass(tc);
   }
 
   @Override public int getTrafficClass() throws SocketException
   {
   }
 
   @Override public int getTrafficClass() throws SocketException
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getTrafficClass();
-    return super.getTrafficClass();
+    return underlyingSocket.getTrafficClass();
   }
 
   @Override public void setReuseAddress(boolean reuseAddress)
     throws SocketException
   {
   }
 
   @Override public void setReuseAddress(boolean reuseAddress)
     throws SocketException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.setReuseAddress(reuseAddress);
-    else
-      super.setReuseAddress(reuseAddress);
+    underlyingSocket.setReuseAddress(reuseAddress);
   }
 
   @Override public boolean getReuseAddress() throws SocketException
   {
   }
 
   @Override public boolean getReuseAddress() throws SocketException
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.getReuseAddress();
-    return super.getReuseAddress();
+    return underlyingSocket.getReuseAddress();
   }
 
   @Override public void close() throws IOException
   {
     // XXX closure alerts.
   }
 
   @Override public void close() throws IOException
   {
     // XXX closure alerts.
-    if (underlyingSocket != null && autoClose)
+    if (autoClose)
       underlyingSocket.close();
       underlyingSocket.close();
-    else
-      super.close();
   }
 
   @Override public void shutdownInput() throws IOException
   {
   }
 
   @Override public void shutdownInput() throws IOException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.shutdownInput();
-    else
-      super.shutdownInput();
+    underlyingSocket.shutdownInput();
   }
 
   @Override public void shutdownOutput() throws IOException
   {
   }
 
   @Override public void shutdownOutput() throws IOException
   {
-    if (underlyingSocket != null)
-      underlyingSocket.shutdownOutput();
-    else
-      super.shutdownOutput();
+    underlyingSocket.shutdownOutput();
   }
 
   @Override public boolean isConnected()
   {
   }
 
   @Override public boolean isConnected()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.isConnected();
-    return super.isConnected();
+    return underlyingSocket.isConnected();
   }
 
   @Override public boolean isBound()
   {
   }
 
   @Override public boolean isBound()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.isBound();
-    return super.isBound();
+    return underlyingSocket.isBound();
   }
 
   @Override public boolean isClosed()
   {
   }
 
   @Override public boolean isClosed()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.isClosed();
-    return super.isClosed();
+    return underlyingSocket.isClosed();
   }
 
   @Override public boolean isInputShutdown()
   {
   }
 
   @Override public boolean isInputShutdown()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.isInputShutdown();
-    return super.isInputShutdown();
+    return underlyingSocket.isInputShutdown();
   }
 
   @Override public boolean isOutputShutdown()
   {
   }
 
   @Override public boolean isOutputShutdown()
   {
-    if (underlyingSocket != null)
-      return underlyingSocket.isOutputShutdown();
-    return super.isOutputShutdown();
+    return underlyingSocket.isOutputShutdown();
   }
 }
   }
 }
index 8c53151..e966b4d 100644 (file)
Binary files a/libjava/classpath/lib/gnu/javax/net/ssl/provider/SSLSocketImpl.class and b/libjava/classpath/lib/gnu/javax/net/ssl/provider/SSLSocketImpl.class differ