From: kkhan Date: Thu, 17 Aug 2006 13:18:11 +0000 (+0000) Subject: getClassLoader0() should not throw an exception X-Git-Tag: rel_3_17_1_ga~317 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=816bdec6e44d43111d7cd686980f417954adb2b2;p=javassist.git getClassLoader0() should not throw an exception git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@317 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- diff --git a/src/main/javassist/scopedpool/ScopedClassPool.java b/src/main/javassist/scopedpool/ScopedClassPool.java index 3157afb9..46fdd38f 100644 --- a/src/main/javassist/scopedpool/ScopedClassPool.java +++ b/src/main/javassist/scopedpool/ScopedClassPool.java @@ -31,7 +31,7 @@ import javassist.NotFoundException; * @author Bill Burke * @author Adrian Brock * @author Kabir Khan - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ public class ScopedClassPool extends ClassPool { protected ScopedClassPoolRepository repository; @@ -75,15 +75,15 @@ public class ScopedClassPool extends ClassPool { * @return the class loader */ public ClassLoader getClassLoader() { - return getClassLoader0(); + ClassLoader cl = getClassLoader0(); + if (cl == null) + throw new IllegalStateException( + "ClassLoader has been garbage collected"); + return cl; } protected ClassLoader getClassLoader0() { - ClassLoader cl = (ClassLoader)classLoader.get(); - if (cl == null) - throw new IllegalStateException( - "ClassLoader has been garbage collected"); - return cl; + return (ClassLoader)classLoader.get(); } /**