harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r518614 - /harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
Date Thu, 15 Mar 2007 13:01:01 GMT
Author: varlax
Date: Thu Mar 15 06:01:00 2007
New Revision: 518614

URL: http://svn.apache.org/viewvc?view=rev&rev=518614
Log:
Fixed HARMONY-3368 [drlvm][kernel] Unnecessary NPE creation and catching in ClassLoader.getResourceAsStream(String)

Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java?view=diff&rev=518614&r1=518613&r2=518614
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/ClassLoader.java
Thu Mar 15 06:01:00 2007
@@ -247,10 +247,11 @@
      */
     public InputStream getResourceAsStream(String name) {
         URL foundResource = getResource(name);
-        try {
-            return foundResource.openStream();
-        } catch (IOException e) {
-        } catch (NullPointerException e) {
+        if (foundResource != null) {
+            try {
+                return foundResource.openStream();
+            } catch (IOException e) {
+            }
         }
         return null;
     }
@@ -578,13 +579,12 @@
     protected final void setSigners(Class<?> clazz, Object[] signers) {
         checkInitialized();
         String name = clazz.getName();
-        try {
-            ClassLoader classLoader = VMClassRegistry.getClassLoader(clazz);
+        ClassLoader classLoader = VMClassRegistry.getClassLoader(clazz);
+        if (classLoader != null) {
             if (classLoader.classSigners == null) {
                 classLoader.classSigners = new Hashtable<String, Object[]>();
             }
             classLoader.classSigners.put(name, signers);
-        } catch (NullPointerException e) {
         }
     }
 



Mime
View raw message