From 1d89891b544624cabe7ec0d374e2edee32a11bd7 Mon Sep 17 00:00:00 2001 From: chiba Date: Thu, 25 Aug 2005 09:52:35 +0000 Subject: [PATCH] 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 --- src/main/javassist/Loader.java | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) 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; + } } /** -- 2.39.5