Patch: FYI: ClassLoader cleanup

Tom Tromey tromey@redhat.com
Thu Sep 19 18:48:00 GMT 2002


I'm checking this in.

This changes the ClassLoader re-throwing code to use a chained
exception.  This makes the eventual stack trace more useful.

It also fixes indentation in resolveClass0.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java/lang/ClassLoader.java (resolveClass0): Set cause for
	newly-created exception.

Index: java/lang/ClassLoader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/ClassLoader.java,v
retrieving revision 1.18
diff -u -r1.18 ClassLoader.java
--- java/lang/ClassLoader.java 7 Aug 2002 05:28:24 -0000 1.18
+++ java/lang/ClassLoader.java 19 Sep 2002 17:41:55 -0000
@@ -432,17 +432,24 @@
   {
     synchronized (clazz)
       {
-	try {
-	  linkClass0 (clazz);
-	} catch (Throwable x) {
-	  markClassErrorState0 (clazz);
+	try
+	  {
+	    linkClass0 (clazz);
+	  }
+	catch (Throwable x)
+	  {
+	    markClassErrorState0 (clazz);
 
-	  if (x instanceof Error)
-	    throw (Error)x;
-	  else    
-	    throw new java.lang.InternalError
-	      ("unexpected exception during linking: " + x);
-	}
+	    if (x instanceof Error)
+	      throw (Error)x;
+	    else
+	      {
+		InternalError e
+		  = new InternalError ("unexpected exception during linking");
+		e.initCause (x);
+		throw e;
+	      }
+	  }
       }
   }
 



More information about the Java-patches mailing list