FYi: Add exception message and/or chain exceptions in SSLEngine

Mark Wielaard mark@klomp.org
Tue Feb 15 22:28:00 GMT 2005


Hi,

This makes the exceptions throw much more clear:

2005-02-15  Mark Wielaard  <mark@klomp.org>

       * javax/net/ssl/SSLContext.java (getInstance): Add exception message
       and/or cause before throwing.

Committed to both classpath and libgcj.

Cheers,

Mark


diff -u -r1.2 SSLContext.java
--- javax/net/ssl/SSLContext.java       21 Oct 2004 20:57:39 -0000      1.2
+++ javax/net/ssl/SSLContext.java       15 Feb 2005 21:57:13 -0000
@@ -140,7 +140,7 @@
   {
     if (provider == null)
       {
-        throw new IllegalArgumentException();
+        throw new IllegalArgumentException("null provider");
       }
     Provider p = Security.getProvider(provider);
     if (p == null)
@@ -174,13 +174,13 @@
       }
     catch (InvocationTargetException ite)
       {
-        ite.printStackTrace();
-        throw new NoSuchAlgorithmException();
+        NoSuchAlgorithmException nsae = new NoSuchAlgorithmException(protocol);+        throw (NoSuchAlgorithmException) nsae.initCause(ite);
       }
     catch (ClassCastException cce)
       {
-        cce.printStackTrace();
-        throw new NoSuchAlgorithmException();
+        NoSuchAlgorithmException nsae = new NoSuchAlgorithmException(protocol);+        throw (NoSuchAlgorithmException) nsae.initCause(cce);
       }
   }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050215/503ad84b/attachment.sig>


More information about the Java-patches mailing list