diff options
author | Sven Gothel <[email protected]> | 2012-03-07 03:27:11 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-03-07 03:27:11 +0100 |
commit | be3c68fada7cf9503f3d501d29283628e0056bcb (patch) | |
tree | 97b6802014458ab4b1da48592410955403c7f755 /src | |
parent | 5a68344ea254e70d88c754a011fd06d2bb87aaa7 (diff) |
TempJarCache: Check for NULL jarURL and reuse contains queries
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/jogamp/common/util/cache/TempJarCache.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/java/com/jogamp/common/util/cache/TempJarCache.java b/src/java/com/jogamp/common/util/cache/TempJarCache.java index dd3e306..162b151 100644 --- a/src/java/com/jogamp/common/util/cache/TempJarCache.java +++ b/src/java/com/jogamp/common/util/cache/TempJarCache.java @@ -152,16 +152,25 @@ public class TempJarCache { public static boolean containsNativeLibs(URL jarURL) throws IOException { checkInitialized(); + if(null == jarURL) { + throw new IllegalArgumentException("jarURL is null"); + } return nativeLibJars.contains(jarURL); } public static boolean containsClasses(URL jarURL) throws IOException { checkInitialized(); + if(null == jarURL) { + throw new IllegalArgumentException("jarURL is null"); + } return classFileJars.contains(jarURL); } public static boolean containsResources(URL jarURL) throws IOException { checkInitialized(); + if(null == jarURL) { + throw new IllegalArgumentException("jarURL is null"); + } return resourceFileJars.contains(jarURL); } @@ -175,8 +184,7 @@ public class TempJarCache { * @throws SecurityException */ public static final void addNativeLibs(Class<?> certClass, URL jarURL, ClassLoader cl) throws IOException, SecurityException { - checkInitialized(); - if(!nativeLibJars.contains(jarURL)) { + if(!containsNativeLibs(jarURL)) { final JarFile jarFile = JarUtil.getJarFile(jarURL, cl); if(DEBUG) { System.err.println("TempJarCache: addNativeLibs: "+jarURL+": nativeJar "+jarFile.getName()); @@ -201,8 +209,7 @@ public class TempJarCache { * @throws SecurityException */ public static final void addClasses(Class<?> certClass, URL jarURL, ClassLoader cl) throws IOException, SecurityException { - checkInitialized(); - if(!classFileJars.contains(jarURL)) { + if(!containsClasses(jarURL)) { final JarFile jarFile = JarUtil.getJarFile(jarURL, cl); if(DEBUG) { System.err.println("TempJarCache: addClasses: "+jarURL+": nativeJar "+jarFile.getName()); @@ -225,8 +232,7 @@ public class TempJarCache { * @throws SecurityException */ public static final void addResources(Class<?> certClass, URL jarURL, ClassLoader cl) throws IOException, SecurityException { - checkInitialized(); - if(!resourceFileJars.contains(jarURL)) { + if(!containsResources(jarURL)) { final JarFile jarFile = JarUtil.getJarFile(jarURL, cl); if(DEBUG) { System.err.println("TempJarCache: addResources: "+jarURL+": nativeJar "+jarFile.getName()); @@ -253,6 +259,9 @@ public class TempJarCache { */ public static final void addAll(Class<?> certClass, URL jarURL, ClassLoader cl) throws IOException, SecurityException { checkInitialized(); + if(null == jarURL) { + throw new IllegalArgumentException("jarURL is null"); + } if(!nativeLibJars.contains(jarURL) || !classFileJars.contains(jarURL) || !resourceFileJars.contains(jarURL)) { |