From: chiba Date: Thu, 25 Aug 2005 09:52:35 +0000 (+0000) Subject: Fixed a threading bug reported by JIRA Javassist-13 X-Git-Tag: rel_3_17_1_ga~427 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1d89891b544624cabe7ec0d374e2edee32a11bd7;p=javassist.git Fixed a threading bug reported by JIRA Javassist-13 git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@197 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- diff --git a/src/main/javassist/Loader.java b/src/main/javassist/Loader.java index ff8d4ced..fe340510 100644 --- a/src/main/javassist/Loader.java +++ b/src/main/javassist/Loader.java @@ -284,20 +284,23 @@ public class Loader extends ClassLoader { */ protected Class loadClass(String name, boolean resolve) throws ClassFormatError, ClassNotFoundException { - Class c = findLoadedClass(name); - if (c == null) - c = loadClassByDelegation(name); + name = name.intern(); + synchronized (name) { + Class c = findLoadedClass(name); + if (c == null) + c = loadClassByDelegation(name); - if (c == null) - c = findClass(name); + if (c == null) + c = findClass(name); - if (c == null) - c = delegateToParent(name); + if (c == null) + c = delegateToParent(name); - if (resolve) - resolveClass(c); + if (resolve) + resolveClass(c); - return c; + return c; + } } /**