bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug crypto/28678] Misleading error message from gnu.java.security.Engin


From: edwin dot steiner at gmx dot net
Subject: [Bug crypto/28678] Misleading error message from gnu.java.security.Engine
Date: 10 Aug 2006 20:54:55 -0000


------- Comment #5 from edwin dot steiner at gmx dot net  2006-08-10 20:54 
-------
Subject: Re:  Misleading error message from gnu.java.security.Engine

On Thu, Aug 10, 2006 at 06:56:34PM -0000, raif at swiftdsl dot com dot au
wrote:
> 
> 
> ------- Comment #4 from raif at swiftdsl dot com dot au  2006-08-10 18:56 
> -------
> hello Edwin,
> 
> the gnu.java.security.Engine#getInstance()'s message is only a part of the
> chain of finding an implementation of a given algorithm.  effectively, the
> lookup for an implementation of a designated algorithm, will query _all_ the
> installed security providers for an implementation of that algorithm.  if 
> there
> are N providers, there may be cases where N such NoSuchAlgorithmExceptions
> (with the error message form you indicated) are thrown, and caught by a higher
> level class, before an ultimate NoSuchAlgorithmException with just the name of
> the desired algorithm is raised.
> 
> what do you think is a better way for handling this situation?

I don't understand the java.security framework, but from my debugging
experience I can say that the absolutely most valuable information is
the low-level cause of an exception, in this case the
ClassNotFoundException. Just including its message in the error message
as in the patch below would have cut down my debugging time for this 
problem from hours to 5 minutes ;) BTW this is also how the code already
handles other exception classes.

Maybe creating a chained exception would be even better?

Cheers
-Edwin


Index: gnu/java/security/Engine.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/java/security/Engine.java,v
retrieving revision 1.5
diff -u -p -r1.5 Engine.java
--- gnu/java/security/Engine.java       30 Jul 2006 20:34:50 -0000      1.5
+++ gnu/java/security/Engine.java       10 Aug 2006 20:52:09 -0000
@@ -202,7 +202,7 @@ public final class Engine
       }
     catch (ClassNotFoundException cnfe)
       {
-        error = "class not found: " + algorithm;
+        error = "class not found: " + cnfe.getMessage();
       }
     catch (IllegalAccessException iae)
       {


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28678





reply via email to

[Prev in Thread] Current Thread [Next in Thread]