Hi,

Here are some fixes for java.util.logging.

ChangeLog:

2005-07-13  Guilhem Lavaux  <[EMAIL PROTECTED]>

        * java/util/logging/Logger.java
        (resetLogger): Remove all handlers from the handler list.

        * java/util/logging/LogManager.java
        (reset): Call resetLogger() too.
        (readConfiguration): Call reset() and use the system class
        loader to resolve classes.

Here is some reference for why we must use getSystemClassLoader().

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4373577

This patch fixes this PR (against kaffe):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=307983

It is not appearing on jamvm/gij due to some other limitation of the VM
which has been reported to jamvm's author.

Regards,

Guilhem.
Index: java/util/logging/LogManager.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/logging/LogManager.java,v
retrieving revision 1.14
diff -u -r1.14 LogManager.java
--- java/util/logging/LogManager.java	2 Jul 2005 20:32:44 -0000	1.14
+++ java/util/logging/LogManager.java	13 Jul 2005 18:43:41 -0000
@@ -443,6 +443,7 @@
 	  {
 	    logger = (Logger) ref.get();
 
+	    logger.resetLogger();
 	    if (logger == null)
 	      iter.remove();
 	    else if (logger != rootLogger)
@@ -451,6 +452,7 @@
       }
 
     rootLogger.setLevel(Level.INFO);
+    rootLogger.resetLogger();
   }
 
   /**
@@ -513,6 +515,7 @@
     checkAccess();
     newProperties = new Properties();
     newProperties.load(inputStream);
+    reset();
     this.properties = newProperties;
     keys = newProperties.propertyNames();
 
@@ -534,7 +537,7 @@
 		String handlerName = tokenizer.nextToken();
 		try
 		  {
-		    Class handlerClass = Class.forName(handlerName);
+		    Class handlerClass = ClassLoader.getSystemClassLoader().loadClass(handlerName);
 		    getLogger("").addHandler((Handler) handlerClass
 		                             .newInstance());
 		  }
Index: java/util/logging/Logger.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/logging/Logger.java,v
retrieving revision 1.9
diff -u -r1.9 Logger.java
--- java/util/logging/Logger.java	2 Jul 2005 20:32:44 -0000	1.9
+++ java/util/logging/Logger.java	13 Jul 2005 18:43:41 -0000
@@ -1177,4 +1177,17 @@
     return stackTrace[index];
   }
   
+  /**
+   * Reset and close handlers attached to this logger. This function is package
+   * private because it must only be avaiable to the LogManager.
+   */
+  void resetLogger()
+  {
+    for (int i = 0; i < handlers.length; i++)
+      {
+        handlers[i].close();
+        handlerList.remove(handlers[i]);
+      }
+    handlers = getHandlers();
+  }
 }
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to