This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: missing synchronization


I'm checking this in.

My previous ClassLoader patch was missing a `synchronized'.
`loadedClasses' is a HashMap, which is not synchronized.
I'll check in something similar in Classpath.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java/lang/ClassLoader.java (findLoadedClass): Now synchronized.

Index: java/lang/ClassLoader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/ClassLoader.java,v
retrieving revision 1.22
diff -u -r1.22 ClassLoader.java
--- java/lang/ClassLoader.java 11 Dec 2002 19:18:59 -0000 1.22
+++ java/lang/ClassLoader.java 12 Dec 2002 00:57:43 -0000
@@ -450,7 +450,7 @@
 				  + "are meaningless");
 
     // as per 5.3.5.1
-    if (name != null  &&  findLoadedClass (name) != null)
+    if (name != null && findLoadedClass (name) != null)
       throw new java.lang.LinkageError ("class " 
 					+ name 
 					+ " already loaded");
@@ -731,7 +731,7 @@
    * @param     name  class to find.
    * @return    the class loaded, or null.
    */ 
-  protected final Class findLoadedClass(String name)
+  protected final synchronized Class findLoadedClass(String name)
   {
     return (Class) loadedClasses.get(name);
   }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]