Commit 82f1c4b5 by Casey Marshall Committed by Tom Tromey

re PR classpath/31302 (Exception in SSLSocketImpl)

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'.

From-SVN: r123285
parent f70ddc12
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> 2007-03-27 Tom Tromey <tromey@redhat.com>
PR classpath/31303: PR classpath/31303:
...@@ -200,7 +200,7 @@ public class SSLSocketImpl extends SSLSocket ...@@ -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 ...@@ -412,17 +412,8 @@ public class SSLSocketImpl extends SSLSocket
ByteBuffer emptyBuffer = ByteBuffer.allocate(0); ByteBuffer emptyBuffer = ByteBuffer.allocate(0);
SSLEngineResult result = null; SSLEngineResult result = null;
DataInputStream sockIn = null; DataInputStream sockIn = new DataInputStream(underlyingSocket.getInputStream());
if (underlyingSocket != null) OutputStream sockOut = underlyingSocket.getOutputStream();
sockIn = new DataInputStream(underlyingSocket.getInputStream());
else
sockIn = new DataInputStream(super.getInputStream());
OutputStream sockOut = null;
if (underlyingSocket != null)
sockOut = underlyingSocket.getOutputStream();
else
sockOut = super.getOutputStream();
try try
{ {
...@@ -550,69 +541,48 @@ public class SSLSocketImpl extends SSLSocket ...@@ -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);
underlyingSocket.bind(bindpoint);
else
super.bind(bindpoint);
} }
@Override public void connect(SocketAddress endpoint) throws IOException @Override public void connect(SocketAddress endpoint) throws IOException
{ {
if (underlyingSocket != null) underlyingSocket.connect(endpoint);
underlyingSocket.connect(endpoint);
else
super.connect(endpoint);
} }
@Override public void connect(SocketAddress endpoint, int timeout) @Override public void connect(SocketAddress endpoint, int timeout)
throws IOException throws IOException
{ {
if (underlyingSocket != null) underlyingSocket.connect(endpoint, timeout);
underlyingSocket.connect(endpoint, timeout);
else
super.connect(endpoint, timeout);
} }
@Override public InetAddress getInetAddress() @Override public InetAddress getInetAddress()
{ {
if (underlyingSocket != null) return underlyingSocket.getInetAddress();
return underlyingSocket.getInetAddress();
return super.getInetAddress();
} }
@Override public InetAddress getLocalAddress() @Override public InetAddress getLocalAddress()
{ {
if (underlyingSocket != null) return underlyingSocket.getLocalAddress();
return underlyingSocket.getLocalAddress();
return super.getLocalAddress();
} }
@Override public int getPort() @Override public int getPort()
{ {
if (underlyingSocket != null) return underlyingSocket.getPort();
return underlyingSocket.getPort();
return super.getPort();
} }
@Override public int getLocalPort() @Override public int getLocalPort()
{ {
if (underlyingSocket != null) return underlyingSocket.getLocalPort();
return underlyingSocket.getLocalPort();
return super.getLocalPort();
} }
@Override public SocketAddress getRemoteSocketAddress() @Override public SocketAddress getRemoteSocketAddress()
{ {
if (underlyingSocket != null) return underlyingSocket.getRemoteSocketAddress();
return underlyingSocket.getRemoteSocketAddress();
return super.getRemoteSocketAddress();
} }
public SocketAddress getLocalSocketAddress() public SocketAddress getLocalSocketAddress()
{ {
if (underlyingSocket != null) return underlyingSocket.getLocalSocketAddress();
return underlyingSocket.getLocalSocketAddress();
return super.getLocalSocketAddress();
} }
@Override public SocketChannel getChannel() @Override public SocketChannel getChannel()
...@@ -632,32 +602,22 @@ public class SSLSocketImpl extends SSLSocket ...@@ -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);
underlyingSocket.setTcpNoDelay(on);
else
super.setTcpNoDelay(on);
} }
@Override public boolean getTcpNoDelay() throws SocketException @Override public boolean getTcpNoDelay() throws SocketException
{ {
if (underlyingSocket != null) return underlyingSocket.getTcpNoDelay();
return underlyingSocket.getTcpNoDelay();
return super.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);
underlyingSocket.setSoLinger(on, linger);
else
super.setSoLinger(on, linger);
} }
public int getSoLinger() throws SocketException public int getSoLinger() throws SocketException
{ {
if (underlyingSocket != null) return underlyingSocket.getSoLinger();
return underlyingSocket.getSoLinger();
return super.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 ...@@ -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);
underlyingSocket.setOOBInline(on);
else
super.setOOBInline(on);
} }
@Override public boolean getOOBInline() throws SocketException @Override public boolean getOOBInline() throws SocketException
{ {
if (underlyingSocket != null) return underlyingSocket.getOOBInline();
return underlyingSocket.getOOBInline();
return super.getOOBInline();
} }
@Override public void setSoTimeout(int timeout) throws SocketException @Override public void setSoTimeout(int timeout) throws SocketException
{ {
if (underlyingSocket != null) underlyingSocket.setSoTimeout(timeout);
underlyingSocket.setSoTimeout(timeout);
else
super.setSoTimeout(timeout);
} }
@Override public int getSoTimeout() throws SocketException @Override public int getSoTimeout() throws SocketException
{ {
if (underlyingSocket != null) return underlyingSocket.getSoTimeout();
return underlyingSocket.getSoTimeout();
return super.getSoTimeout();
} }
@Override public void setSendBufferSize(int size) throws SocketException @Override public void setSendBufferSize(int size) throws SocketException
{ {
if (underlyingSocket != null) underlyingSocket.setSendBufferSize(size);
underlyingSocket.setSendBufferSize(size);
else
super.setSendBufferSize(size);
} }
@Override public int getSendBufferSize() throws SocketException @Override public int getSendBufferSize() throws SocketException
{ {
if (underlyingSocket != null) return underlyingSocket.getSendBufferSize();
return underlyingSocket.getSendBufferSize();
return super.getSendBufferSize();
} }
@Override public void setReceiveBufferSize(int size) throws SocketException @Override public void setReceiveBufferSize(int size) throws SocketException
{ {
if (underlyingSocket != null) underlyingSocket.setReceiveBufferSize(size);
underlyingSocket.setReceiveBufferSize(size);
else
underlyingSocket.setReceiveBufferSize(size);
} }
@Override public int getReceiveBufferSize() throws SocketException @Override public int getReceiveBufferSize() throws SocketException
{ {
if (underlyingSocket != null) return underlyingSocket.getReceiveBufferSize();
return underlyingSocket.getReceiveBufferSize();
return super.getReceiveBufferSize();
} }
@Override public void setKeepAlive(boolean on) throws SocketException @Override public void setKeepAlive(boolean on) throws SocketException
{ {
if (underlyingSocket != null) underlyingSocket.setKeepAlive(on);
underlyingSocket.setKeepAlive(on);
else
super.setKeepAlive(on);
} }
@Override public boolean getKeepAlive() throws SocketException @Override public boolean getKeepAlive() throws SocketException
{ {
if (underlyingSocket != null) return underlyingSocket.getKeepAlive();
return underlyingSocket.getKeepAlive();
return super.getKeepAlive();
} }
@Override public void setTrafficClass(int tc) throws SocketException @Override public void setTrafficClass(int tc) throws SocketException
{ {
if (underlyingSocket != null) underlyingSocket.setTrafficClass(tc);
underlyingSocket.setTrafficClass(tc);
else
super.setTrafficClass(tc);
} }
@Override public int getTrafficClass() throws SocketException @Override public int getTrafficClass() throws SocketException
{ {
if (underlyingSocket != null) return underlyingSocket.getTrafficClass();
return underlyingSocket.getTrafficClass();
return super.getTrafficClass();
} }
@Override public void setReuseAddress(boolean reuseAddress) @Override public void setReuseAddress(boolean reuseAddress)
throws SocketException throws SocketException
{ {
if (underlyingSocket != null) underlyingSocket.setReuseAddress(reuseAddress);
underlyingSocket.setReuseAddress(reuseAddress);
else
super.setReuseAddress(reuseAddress);
} }
@Override public boolean getReuseAddress() throws SocketException @Override public boolean getReuseAddress() throws SocketException
{ {
if (underlyingSocket != null) return underlyingSocket.getReuseAddress();
return underlyingSocket.getReuseAddress();
return super.getReuseAddress();
} }
@Override public void close() throws IOException @Override public void close() throws IOException
{ {
// XXX closure alerts. // 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();
underlyingSocket.shutdownInput();
else
super.shutdownInput();
} }
@Override public void shutdownOutput() throws IOException @Override public void shutdownOutput() throws IOException
{ {
if (underlyingSocket != null) underlyingSocket.shutdownOutput();
underlyingSocket.shutdownOutput();
else
super.shutdownOutput();
} }
@Override public boolean isConnected() @Override public boolean isConnected()
{ {
if (underlyingSocket != null) return underlyingSocket.isConnected();
return underlyingSocket.isConnected();
return super.isConnected();
} }
@Override public boolean isBound() @Override public boolean isBound()
{ {
if (underlyingSocket != null) return underlyingSocket.isBound();
return underlyingSocket.isBound();
return super.isBound();
} }
@Override public boolean isClosed() @Override public boolean isClosed()
{ {
if (underlyingSocket != null) return underlyingSocket.isClosed();
return underlyingSocket.isClosed();
return super.isClosed();
} }
@Override public boolean isInputShutdown() @Override public boolean isInputShutdown()
{ {
if (underlyingSocket != null) return underlyingSocket.isInputShutdown();
return underlyingSocket.isInputShutdown();
return super.isInputShutdown();
} }
@Override public boolean isOutputShutdown() @Override public boolean isOutputShutdown()
{ {
if (underlyingSocket != null) return underlyingSocket.isOutputShutdown();
return underlyingSocket.isOutputShutdown();
return super.isOutputShutdown();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment