changeset 428:f8be8bf150c3

6881317: regression: NPE in CloseableURLClassLoader Reviewed-by: darcy
author jjg
date Mon, 14 Sep 2009 17:13:00 -0700
parents 071a4e36cd87
children 9dd34ed62341
files src/share/classes/com/sun/tools/javac/file/CloseableURLClassLoader.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/file/CloseableURLClassLoader.java	Tue Sep 08 14:08:26 2009 -0700
+++ b/src/share/classes/com/sun/tools/javac/file/CloseableURLClassLoader.java	Mon Sep 14 17:13:00 2009 -0700
@@ -69,8 +69,10 @@
                 if (l.getClass().getName().equals("sun.misc.URLClassPath$JarLoader")) {
                     Field jarField = l.getClass().getDeclaredField("jar");
                     JarFile jar = (JarFile) getField(l, jarField);
-                    //System.err.println("CloseableURLClassLoader: closing " + jar);
-                    jar.close();
+                    if (jar != null) {
+                        //System.err.println("CloseableURLClassLoader: closing " + jar);
+                        jar.close();
+                    }
                 }
             }
         } catch (Throwable t) {