diff options
Diffstat (limited to 'libjava/classpath/javax/net')
-rw-r--r-- | libjava/classpath/javax/net/ssl/SSLServerSocketFactory.java | 55 | ||||
-rw-r--r-- | libjava/classpath/javax/net/ssl/SSLSocketFactory.java | 66 |
2 files changed, 115 insertions, 6 deletions
diff --git a/libjava/classpath/javax/net/ssl/SSLServerSocketFactory.java b/libjava/classpath/javax/net/ssl/SSLServerSocketFactory.java index f02619a..8bfe8c1 100644 --- a/libjava/classpath/javax/net/ssl/SSLServerSocketFactory.java +++ b/libjava/classpath/javax/net/ssl/SSLServerSocketFactory.java @@ -38,6 +38,9 @@ exception statement from your version. */ package javax.net.ssl; +import java.io.IOException; +import java.net.InetAddress; +import java.net.ServerSocket; import java.security.KeyStore; import java.security.Security; @@ -138,8 +141,9 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory } catch (Exception ex) { - throw new RuntimeException("error instantiating default server socket factory: " - + ex.toString()); + return new ErrorServerSocketFactory(new RuntimeException( + "error instantiating default server socket factory: " + + ex.toString(), ex)); } } try @@ -149,7 +153,52 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory catch (Exception e) { } - throw new RuntimeException("no SSLSocketFactory implementation available"); + return new ErrorServerSocketFactory(new RuntimeException( + "no SSLSocketFactory implementation available")); + } + + private static final class ErrorServerSocketFactory + extends SSLServerSocketFactory + { + private RuntimeException x; + + ErrorServerSocketFactory(RuntimeException x) + { + this.x = x; + } + + public ServerSocket createServerSocket() throws IOException + { + throw (IOException) new IOException().initCause(x); + } + + public ServerSocket createServerSocket(int port) throws IOException + { + throw (IOException) new IOException().initCause(x); + } + + public ServerSocket createServerSocket(int port, int backlog) + throws IOException + { + throw (IOException) new IOException().initCause(x); + } + + public ServerSocket createServerSocket(int port, int backlog, + InetAddress ifAddress) + throws IOException + { + throw (IOException) new IOException().initCause(x); + } + + public String[] getDefaultCipherSuites() + { + throw new RuntimeException(x); + } + + public String[] getSupportedCipherSuites() + { + throw new RuntimeException(x); + } } // Abstract methods. diff --git a/libjava/classpath/javax/net/ssl/SSLSocketFactory.java b/libjava/classpath/javax/net/ssl/SSLSocketFactory.java index 7348b2e..2cfb492 100644 --- a/libjava/classpath/javax/net/ssl/SSLSocketFactory.java +++ b/libjava/classpath/javax/net/ssl/SSLSocketFactory.java @@ -39,6 +39,7 @@ exception statement from your version. */ package javax.net.ssl; import java.io.IOException; +import java.net.InetAddress; import java.net.Socket; import java.security.KeyStore; import java.security.Security; @@ -141,8 +142,9 @@ public abstract class SSLSocketFactory extends SocketFactory } catch (Exception ex) { - throw new RuntimeException("error instantiating default socket factory: " - + ex.toString(), ex); + return new ErrorSocketFactory(new RuntimeException( + "error instantiating default socket factory: " + ex.toString(), + ex)); } } try @@ -152,7 +154,65 @@ public abstract class SSLSocketFactory extends SocketFactory catch (Exception e) { } - throw new RuntimeException("no SSLSocketFactory implementation available"); + return new ErrorSocketFactory(new RuntimeException( + "no SSLSocketFactory implementation available")); + } + + private static final class ErrorSocketFactory extends SSLSocketFactory + { + private RuntimeException x; + + ErrorSocketFactory(RuntimeException x) + { + this.x = x; + } + + public Socket createSocket() throws IOException + { + throw (IOException) new IOException().initCause(x); + } + + public Socket createSocket(String host, int port) + throws IOException + { + throw (IOException) new IOException().initCause(x); + } + + public Socket createSocket(String host, int port, InetAddress localHost, + int localPort) + throws IOException + { + throw (IOException) new IOException().initCause(x); + } + + public Socket createSocket(InetAddress host, int port) throws IOException + { + throw (IOException) new IOException().initCause(x); + } + + public Socket createSocket(InetAddress hast, int port, InetAddress localHost, + int localPort) + throws IOException + { + throw (IOException) new IOException().initCause(x); + } + + public String[] getDefaultCipherSuites() + { + throw new RuntimeException(x); + } + + public String[] getSupportedCipherSuites() + { + throw new RuntimeException(x); + } + + public Socket createSocket(Socket s, String host, int port, + boolean autoClose) + throws IOException + { + throw new RuntimeException(x); + } } // Abstract methods. |