[Patch] java.util.logging.LogManager

Michael Koch konqueror@gmx.de
Mon Oct 18 14:06:00 GMT 2004


Hi list,


I just commited the attached patch to fix a bug in
java.util.logging.LogManager.


Michael


2004-10-18  Jeroen Frijters  <jeroen@frijters.net>

	* java/util/logging/LogManager.java
	(findAncestor): Fixed IndexOutOfBoundsException.

-------------- next part --------------
Index: java/util/logging/LogManager.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/logging/LogManager.java,v
retrieving revision 1.4
diff -u -r1.4 LogManager.java
--- java/util/logging/LogManager.java	20 Apr 2004 14:45:08 -0000	1.4
+++ java/util/logging/LogManager.java	18 Oct 2004 14:04:08 -0000
@@ -351,6 +351,7 @@
   private synchronized Logger findAncestor(Logger child)
   {
     String childName = child.getName();
+    int    childNameLength = childName.length();
     Logger best = rootLogger;
     int    bestNameLength = 0;
 
@@ -366,9 +367,10 @@
       candName = (String) iter.next();
       candNameLength = candName.length();
 
-      if ((candNameLength > bestNameLength)
+      if (candNameLength > bestNameLength
+	  && childNameLength > candNameLength
 	  && childName.startsWith(candName)
-	  && (childName.charAt(candNameLength) == '.'))
+	  && childName.charAt(candNameLength) == '.')
       {
         cand = (Logger) ((WeakReference) loggers.get(candName)).get();
 	if ((cand == null) || (cand == child))


More information about the Java-patches mailing list