classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] Patch: replace NullPointerException with ClassCastException


From: Anthony Green
Subject: [cp-patches] Patch: replace NullPointerException with ClassCastException
Date: Wed, 14 Sep 2005 17:56:49 -0700

This doesn't really fix a bug.  FindBugs was complaining about a
potential null dereference.  This patch essentially turns a potential
NullPointerException into a ClassCastException, which is no worse - and
quiets FindBugs on this issue.

Ok?

AG


2005-09-14  Anthony Green  <address@hidden>

        * java/security/KeyPairGenerator.java (getInstance): Remove
        instanceof test.  Now we'll get a ClassCastException instead of a
        NullPointerException.


Index: java/security/KeyPairGenerator.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/KeyPairGenerator.java,v
retrieving revision 1.15
diff -u -r1.15 KeyPairGenerator.java
--- java/security/KeyPairGenerator.java 9 Aug 2005 06:13:54 -0000       1.15
+++ java/security/KeyPairGenerator.java 15 Sep 2005 00:20:19 -0000
@@ -251,7 +251,7 @@
       {
        result = new DummyKeyPairGenerator((KeyPairGeneratorSpi) o, algorithm);
       }
-    else if (o instanceof KeyPairGenerator)
+    else
       {
         result = (KeyPairGenerator) o;
         result.algorithm = algorithm;






reply via email to

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