diff options
Diffstat (limited to 'libjava/classpath/java/util/logging')
-rw-r--r-- | libjava/classpath/java/util/logging/LogManager.java | 16 | ||||
-rw-r--r-- | libjava/classpath/java/util/logging/Logger.java | 18 |
2 files changed, 21 insertions, 13 deletions
diff --git a/libjava/classpath/java/util/logging/LogManager.java b/libjava/classpath/java/util/logging/LogManager.java index fbc0fe78abf..6daf3dbd9eb 100644 --- a/libjava/classpath/java/util/logging/LogManager.java +++ b/libjava/classpath/java/util/logging/LogManager.java @@ -1,6 +1,6 @@ /* LogManager.java -- a class for maintaining Loggers and managing configuration properties - Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -446,8 +446,8 @@ public class LogManager Iterator<WeakReference<Logger>> iter = loggers.values().iterator(); while (iter.hasNext()) - for (WeakReference<Logger> ref : loggers.values()) { + WeakReference<Logger> ref; Logger logger; ref = iter.next(); @@ -559,13 +559,21 @@ public class LogManager if ("handlers".equals(key)) { - StringTokenizer tokenizer = new StringTokenizer(value); + // In Java 5 and earlier this was specified to be + // whitespace-separated, but in reality it also accepted + // commas (tomcat relied on this), and in Java 6 the + // documentation was updated to fit the implementation. + StringTokenizer tokenizer = new StringTokenizer(value, + " \t\n\r\f,"); while (tokenizer.hasMoreTokens()) { String handlerName = tokenizer.nextToken(); Handler handler = (Handler) createInstance(handlerName, Handler.class, key); - Logger.root.addHandler(handler); + // Tomcat also relies on the implementation ignoring + // items in 'handlers' which are not class names. + if (handler != null) + Logger.root.addHandler(handler); } } diff --git a/libjava/classpath/java/util/logging/Logger.java b/libjava/classpath/java/util/logging/Logger.java index 46588e542ee..01ef8f522b8 100644 --- a/libjava/classpath/java/util/logging/Logger.java +++ b/libjava/classpath/java/util/logging/Logger.java @@ -1,5 +1,5 @@ /* Logger.java -- a class for logging messages - Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -276,8 +276,8 @@ public class Logger LogManager lm = LogManager.getLogManager(); Logger result; - /* Throw NullPointerException if name is null. */ - name.getClass(); + if (name == null) + throw new NullPointerException(); /* Without synchronized(lm), it could happen that another thread * would create a logger between our calls to getLogger and @@ -1013,8 +1013,8 @@ public class Logger public synchronized void addHandler(Handler handler) throws SecurityException { - /* Throw a new NullPointerException if handler is null. */ - handler.getClass(); + if (handler == null) + throw new NullPointerException(); /* An application is allowed to control an anonymous logger * without having the permission to control the logging @@ -1057,8 +1057,8 @@ public class Logger if (!anonymous) LogManager.getLogManager().checkAccess(); - /* Throw a new NullPointerException if handler is null. */ - handler.getClass(); + if (handler == null) + throw new NullPointerException(); handlerList.remove(handler); handlers = getHandlers(); @@ -1166,8 +1166,8 @@ public class Logger */ public synchronized void setParent(Logger parent) { - /* Throw a new NullPointerException if parent is null. */ - parent.getClass(); + if (parent == null) + throw new NullPointerException(); if (this == root) throw new IllegalArgumentException( |