diff options
Diffstat (limited to 'libjava/classpath/java/util/logging')
15 files changed, 304 insertions, 307 deletions
diff --git a/libjava/classpath/java/util/logging/ConsoleHandler.java b/libjava/classpath/java/util/logging/ConsoleHandler.java index 3cf4bca3354..9f6bb724014 100644 --- a/libjava/classpath/java/util/logging/ConsoleHandler.java +++ b/libjava/classpath/java/util/logging/ConsoleHandler.java @@ -81,7 +81,7 @@ public class ConsoleHandler public ConsoleHandler() { super(System.err, "java.util.logging.ConsoleHandler", Level.INFO, - /* formatter */ null, SimpleFormatter.class); + /* formatter */ null, SimpleFormatter.class); } diff --git a/libjava/classpath/java/util/logging/ErrorManager.java b/libjava/classpath/java/util/logging/ErrorManager.java index 57c079fe25b..291efb2f13f 100644 --- a/libjava/classpath/java/util/logging/ErrorManager.java +++ b/libjava/classpath/java/util/logging/ErrorManager.java @@ -82,7 +82,7 @@ public class ErrorManager */ public static final int CLOSE_FAILURE = 3; - + /** * Indicates that there was a problem upon opening * an output stream. @@ -146,7 +146,7 @@ public class ErrorManager * widespread acceptance. See Classpath bug #2944. */ if (everUsed) - return; + return; everUsed = true; } @@ -191,4 +191,3 @@ public class ErrorManager ex.printStackTrace(); } } - diff --git a/libjava/classpath/java/util/logging/FileHandler.java b/libjava/classpath/java/util/logging/FileHandler.java index deba5c2e55c..00d967f57d6 100644 --- a/libjava/classpath/java/util/logging/FileHandler.java +++ b/libjava/classpath/java/util/logging/FileHandler.java @@ -120,7 +120,7 @@ import java.util.ListIterator; * system property <code>user.home</code>.</li> * * <li><code>%g</code> - replaced by a generation number for - * distinguisthing the individual items in the rotating set + * distinguisthing the individual items in the rotating set * of log files. The generation number cycles through the * sequence 0, 1, ..., <code>count</code> - 1.</li> * @@ -160,7 +160,7 @@ import java.util.ListIterator; * step is performed after any generation number has been * appended. * - * <p><em>Examples for the GNU platform:</em> + * <p><em>Examples for the GNU platform:</em> * * <p><ul> * @@ -269,7 +269,7 @@ public class FileHandler /** * A linked list of files we are, or have written to. The entries - * are file path strings, kept in the order + * are file path strings, kept in the order */ private LinkedList logFiles; @@ -291,9 +291,9 @@ public class FileHandler throws IOException, SecurityException { this(LogManager.getLogManager().getProperty(PATTERN_KEY), - LogManager.getIntProperty(LIMIT_KEY, DEFAULT_LIMIT), - LogManager.getIntProperty(COUNT_KEY, DEFAULT_COUNT), - LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND)); + LogManager.getIntProperty(LIMIT_KEY, DEFAULT_LIMIT), + LogManager.getIntProperty(COUNT_KEY, DEFAULT_COUNT), + LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND)); } @@ -317,8 +317,8 @@ public class FileHandler public FileHandler(String pattern, int limit, int count) throws IOException, SecurityException { - this(pattern, limit, count, - LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND)); + this(pattern, limit, count, + LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND)); } @@ -368,16 +368,16 @@ public class FileHandler * the Sun reference implementation. */ public FileHandler(String pattern, - int limit, - int count, - boolean append) + int limit, + int count, + boolean append) throws IOException, SecurityException { super(/* output stream, created below */ null, - PROPERTY_PREFIX, - /* default level */ Level.ALL, - /* formatter */ null, - /* default formatter */ XMLFormatter.class); + PROPERTY_PREFIX, + /* default level */ Level.ALL, + /* formatter */ null, + /* default formatter */ XMLFormatter.class); if ((limit <0) || (count < 1)) throw new IllegalArgumentException(); @@ -426,7 +426,7 @@ public class FileHandler try { - File file = new File(path); + File file = new File(path); if (!file.exists () || append) { FileOutputStream fout = new FileOutputStream (file, append); @@ -476,9 +476,9 @@ public class FileHandler * <code>pattern</code>. */ private static String replaceFileNameEscapes(String pattern, - int generation, - int uniqueNumber, - int count) + int generation, + int uniqueNumber, + int count) { CPStringBuilder buf = new CPStringBuilder(pattern); String replaceWith; @@ -489,49 +489,49 @@ public class FileHandler { // Uncomment the next line for finding bugs. // System.out.println(buf.substring(0,pos) + '|' + buf.substring(pos)); - + if (buf.charAt(pos) == '/') { - /* The same value is also provided by java.io.File.separator. */ - replaceWith = System.getProperty("file.separator"); - buf.replace(pos, pos + 1, replaceWith); - pos = pos + replaceWith.length() - 1; - continue; + /* The same value is also provided by java.io.File.separator. */ + replaceWith = System.getProperty("file.separator"); + buf.replace(pos, pos + 1, replaceWith); + pos = pos + replaceWith.length() - 1; + continue; } if (buf.charAt(pos) == '%') { switch (buf.charAt(pos + 1)) - { - case 't': - replaceWith = System.getProperty("java.io.tmpdir"); - break; - - case 'h': - replaceWith = System.getProperty("user.home"); - break; - - case 'g': - replaceWith = Integer.toString(generation); - foundGeneration = true; - break; - - case 'u': - replaceWith = Integer.toString(uniqueNumber); - break; - - case '%': - replaceWith = "%"; - break; - - default: - replaceWith = "??"; - break; // FIXME: Throw exception? - } - - buf.replace(pos, pos + 2, replaceWith); - pos = pos + replaceWith.length() - 1; - continue; + { + case 't': + replaceWith = System.getProperty("java.io.tmpdir"); + break; + + case 'h': + replaceWith = System.getProperty("user.home"); + break; + + case 'g': + replaceWith = Integer.toString(generation); + foundGeneration = true; + break; + + case 'u': + replaceWith = Integer.toString(uniqueNumber); + break; + + case '%': + replaceWith = "%"; + break; + + default: + replaceWith = "??"; + break; // FIXME: Throw exception? + } + + buf.replace(pos, pos + 2, replaceWith); + pos = pos + replaceWith.length() - 1; + continue; } } while (++pos < buf.length() - 1); diff --git a/libjava/classpath/java/util/logging/Formatter.java b/libjava/classpath/java/util/logging/Formatter.java index ee747b0b978..feaf553152c 100644 --- a/libjava/classpath/java/util/logging/Formatter.java +++ b/libjava/classpath/java/util/logging/Formatter.java @@ -150,7 +150,7 @@ public abstract class Formatter { try { - msg = bundle.getString(msg); + msg = bundle.getString(msg); } catch (java.util.MissingResourceException _) { @@ -160,8 +160,8 @@ public abstract class Formatter /* Format the message if there are parameters. */ params = record.getParameters(); if ((params != null) - && (params.length > 0) - && (msg.indexOf("{0") >= 0)) + && (params.length > 0) + && (msg.indexOf("{0") >= 0)) { msg = MessageFormat.format(msg, params); } diff --git a/libjava/classpath/java/util/logging/Handler.java b/libjava/classpath/java/util/logging/Handler.java index 616b50234c4..e254b4d35a6 100644 --- a/libjava/classpath/java/util/logging/Handler.java +++ b/libjava/classpath/java/util/logging/Handler.java @@ -179,7 +179,7 @@ h.setFormatter(h.getFormatter());</pre> throws SecurityException { LogManager.getLogManager().checkAccess(); - + /* Throws a NullPointerException if formatter is null. */ formatter.getClass(); @@ -377,7 +377,7 @@ h.setFormatter(h.getFormatter());</pre> { if (record.getLevel().intValue() < level.intValue()) return false; - + if (filter != null) return filter.isLoggable(record); else diff --git a/libjava/classpath/java/util/logging/Level.java b/libjava/classpath/java/util/logging/Level.java index 48ff318a464..ea2c83fb2b8 100644 --- a/libjava/classpath/java/util/logging/Level.java +++ b/libjava/classpath/java/util/logging/Level.java @@ -180,12 +180,12 @@ public class Level implements Serializable * @param value the integer value of the level. Please note * that the Java<small><sup>TM</sup></small> * Logging API does not specify integer - * values for standard levels (such as - * Level.FINE). Therefore, a custom - * level should pass an integer value that - * is calculated at run-time, e.g. - * <code>(Level.FINE.intValue() + Level.CONFIG.intValue()) - * / 2</code> for a level between FINE and CONFIG. + * values for standard levels (such as + * Level.FINE). Therefore, a custom + * level should pass an integer value that + * is calculated at run-time, e.g. + * <code>(Level.FINE.intValue() + Level.CONFIG.intValue()) + * / 2</code> for a level between FINE and CONFIG. */ protected Level(String name, int value) { @@ -205,13 +205,13 @@ public class Level implements Serializable * * @param value the integer value of the level. Please note * that the Java<small><sup>TM</sup></small> - * Logging API does not specify integer - * values for standard levels (such as - * Level.FINE). Therefore, a custom - * level should pass an integer value that - * is calculated at run-time, e.g. - * <code>(Level.FINE.intValue() + Level.CONFIG.intValue()) - * / 2</code> for a level between FINE and CONFIG. + * Logging API does not specify integer + * values for standard levels (such as + * Level.FINE). Therefore, a custom + * level should pass an integer value that + * is calculated at run-time, e.g. + * <code>(Level.FINE.intValue() + Level.CONFIG.intValue()) + * / 2</code> for a level between FINE and CONFIG. * * @param resourceBundleName the name of a resource bundle * for localizing the level name, or <code>null</code> @@ -243,7 +243,7 @@ public class Level implements Serializable { for (int i = 0; i < knownLevels.length; i++) if (value == knownLevels[i].intValue()) - return knownLevels[i]; + return knownLevels[i]; return this; } @@ -286,7 +286,7 @@ public class Level implements Serializable try { ResourceBundle b = ResourceBundle.getBundle(resourceBundleName); - localizedName = b.getString(name); + localizedName = b.getString(name); } catch (Exception _) { @@ -345,15 +345,15 @@ public class Level implements Serializable // standard logging levels will be returned by this method, and // they are all created using string literals. if (name == knownLevels[i].name) - return knownLevels[i]; + return knownLevels[i]; } - + try { int num = Integer.parseInt(name); for (int i = 0; i < knownLevels.length; i++) - if (num == knownLevels[i].value) - return knownLevels[i]; + if (num == knownLevels[i].value) + return knownLevels[i]; } catch (NumberFormatException _) { @@ -369,7 +369,7 @@ public class Level implements Serializable * another object. * * @return <code>true</code> if <code>other</code> is an instance of - * <code>java.util.logging.Level</code> and has the same integer + * <code>java.util.logging.Level</code> and has the same integer * value, <code>false</code> otherwise. */ public boolean equals(Object other) @@ -388,7 +388,7 @@ public class Level implements Serializable public int hashCode() { return value; - } + } /** @@ -409,9 +409,8 @@ public class Level implements Serializable { for (int i = 0; i < knownLevels.length; i++) if (knownLevels[i] == this) - return true; + return true; return false; } } - diff --git a/libjava/classpath/java/util/logging/LogManager.java b/libjava/classpath/java/util/logging/LogManager.java index 6daf3dbd9eb..dffa44d9cf0 100644 --- a/libjava/classpath/java/util/logging/LogManager.java +++ b/libjava/classpath/java/util/logging/LogManager.java @@ -150,7 +150,7 @@ public class LogManager * this case. */ private final PropertyChangeSupport pcs = new PropertyChangeSupport( /* source bean */ - LogManager.class); + LogManager.class); protected LogManager() { @@ -272,13 +272,13 @@ public class LogManager ref = loggers.get(name); if (ref != null) { - if (ref.get() != null) - return false; + if (ref.get() != null) + return false; - /* There has been a logger under this name in the past, - * but it has been garbage collected. - */ - loggers.remove(ref); + /* There has been a logger under this name in the past, + * but it has been garbage collected. + */ + loggers.remove(ref); } /* Adding a named logger requires a security permission. */ @@ -292,10 +292,10 @@ public class LogManager // The level of the newly added logger must be specified. // The easiest case is if there is a level for exactly this logger - // in the properties. If no such level exists the level needs to be + // in the properties. If no such level exists the level needs to be // searched along the hirachy. So if there is a new logger 'foo.blah.blub' // and an existing parent logger 'foo' the properties 'foo.blah.blub.level' - // and 'foo.blah.level' need to be checked. If both do not exist in the + // and 'foo.blah.level' need to be checked. If both do not exist in the // properties the level of the new logger is set to 'null' (i.e. it uses the // level of its parent 'foo'). Level logLevel = logger.getLevel(); @@ -320,21 +320,21 @@ public class LogManager */ for (Iterator iter = loggers.keySet().iterator(); iter.hasNext();) { - Logger possChild = (Logger) ((WeakReference) loggers.get(iter.next())) - .get(); - if ((possChild == null) || (possChild == logger) - || (possChild.getParent() != parent)) - continue; - - if (! possChild.getName().startsWith(name)) - continue; - - if (possChild.getName().charAt(name.length()) != '.') - continue; - - possChild.setParent(logger); - } - + Logger possChild = (Logger) ((WeakReference) loggers.get(iter.next())) + .get(); + if ((possChild == null) || (possChild == logger) + || (possChild.getParent() != parent)) + continue; + + if (! possChild.getName().startsWith(name)) + continue; + + if (possChild.getName().charAt(name.length()) != '.') + continue; + + possChild.setParent(logger); + } + return true; } @@ -369,20 +369,20 @@ public class LogManager for (String candName : loggers.keySet()) { - candNameLength = candName.length(); + candNameLength = candName.length(); - if (candNameLength > bestNameLength - && childNameLength > candNameLength - && childName.startsWith(candName) - && childName.charAt(candNameLength) == '.') - { - cand = loggers.get(candName).get(); - if ((cand == null) || (cand == child)) - continue; + if (candNameLength > bestNameLength + && childNameLength > candNameLength + && childName.startsWith(candName) + && childName.charAt(candNameLength) == '.') + { + cand = loggers.get(candName).get(); + if ((cand == null) || (cand == child)) + continue; - bestNameLength = candName.length(); - best = cand; - } + bestNameLength = candName.length(); + best = cand; + } } return best; @@ -447,22 +447,22 @@ public class LogManager Iterator<WeakReference<Logger>> iter = loggers.values().iterator(); while (iter.hasNext()) { - WeakReference<Logger> ref; - Logger logger; + WeakReference<Logger> ref; + Logger logger; - ref = iter.next(); - if (ref != null) - { - logger = ref.get(); + ref = iter.next(); + if (ref != null) + { + logger = ref.get(); - if (logger == null) - iter.remove(); - else if (logger != Logger.root) - { - logger.resetLogger(); - logger.setLevel(null); - } - } + if (logger == null) + iter.remove(); + else if (logger != Logger.root) + { + logger.resetLogger(); + logger.setLevel(null); + } + } } Logger.root.setLevel(Level.INFO); @@ -505,7 +505,7 @@ public class LogManager try { inputStream = new URL(url).openStream(); - } + } catch (Exception e) { inputStream=null; @@ -549,46 +549,46 @@ public class LogManager while (keys.hasMoreElements()) { - String key = ((String) keys.nextElement()).trim(); - String value = newProperties.getProperty(key); - - if (value == null) - continue; - - value = value.trim(); - - if ("handlers".equals(key)) - { - // 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(); + String key = ((String) keys.nextElement()).trim(); + String value = newProperties.getProperty(key); + + if (value == null) + continue; + + value = value.trim(); + + if ("handlers".equals(key)) + { + // 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); - // Tomcat also relies on the implementation ignoring - // items in 'handlers' which are not class names. - if (handler != null) - Logger.root.addHandler(handler); - } - } - - if (key.endsWith(".level")) - { - String loggerName = key.substring(0, key.length() - 6); - Logger logger = getLogger(loggerName); - - if (logger == null) - { - logger = Logger.getLogger(loggerName); - addLogger(logger); - } + // Tomcat also relies on the implementation ignoring + // items in 'handlers' which are not class names. + if (handler != null) + Logger.root.addHandler(handler); + } + } + + if (key.endsWith(".level")) + { + String loggerName = key.substring(0, key.length() - 6); + Logger logger = getLogger(loggerName); + + if (logger == null) + { + logger = Logger.getLogger(loggerName); + addLogger(logger); + } Level level = null; - try + try { level = Level.parse(value); } @@ -600,8 +600,8 @@ public class LogManager { logger.setLevel(level); } - continue; - } + continue; + } } /* The API specification does not talk about the @@ -640,11 +640,11 @@ public class LogManager { try { - return Integer.parseInt(getLogManager().getProperty(name)); + return Integer.parseInt(getLogManager().getProperty(name)); } catch (Exception ex) { - return defaultValue; + return defaultValue; } } @@ -691,11 +691,11 @@ public class LogManager { try { - return (Boolean.valueOf(getLogManager().getProperty(name))).booleanValue(); + return (Boolean.valueOf(getLogManager().getProperty(name))).booleanValue(); } catch (Exception ex) { - return defaultValue; + return defaultValue; } } @@ -717,14 +717,14 @@ public class LogManager try { String value = getLogManager().getProperty(propertyName); - if (value != null) - return Level.parse(getLogManager().getProperty(propertyName)); + if (value != null) + return Level.parse(getLogManager().getProperty(propertyName)); else - return defaultValue; + return defaultValue; } catch (Exception ex) { - return defaultValue; + return defaultValue; } } @@ -784,15 +784,15 @@ public class LogManager try { - return defaultClass.newInstance(); + return defaultClass.newInstance(); } catch (java.lang.InstantiationException ex) { - throw new RuntimeException(ex.getMessage()); + throw new RuntimeException(ex.getMessage()); } catch (java.lang.IllegalAccessException ex) { - throw new RuntimeException(ex.getMessage()); + throw new RuntimeException(ex.getMessage()); } } diff --git a/libjava/classpath/java/util/logging/LogRecord.java b/libjava/classpath/java/util/logging/LogRecord.java index af7f2058dbe..ee99ee69a22 100644 --- a/libjava/classpath/java/util/logging/LogRecord.java +++ b/libjava/classpath/java/util/logging/LogRecord.java @@ -140,7 +140,7 @@ public class LogRecord * * @param message the message text (which will be used as key * for looking up the localized message text - * if a resource bundle has been associated). + * if a resource bundle has been associated). */ public LogRecord(Level level, String message) { @@ -182,7 +182,7 @@ public class LogRecord { parameters = new Object[numParams]; for (int i = 0; i < numParams; i++) - parameters[i] = in.readObject(); + parameters[i] = in.readObject(); } } @@ -220,10 +220,10 @@ public class LogRecord out.writeInt(parameters.length); for (int i = 0; i < parameters.length; i++) { - if (parameters[i] == null) - out.writeObject(null); - else - out.writeObject(parameters[i].toString()); + if (parameters[i] == null) + out.writeObject(null); + else + out.writeObject(parameters[i].toString()); } } } @@ -331,11 +331,11 @@ public class LogRecord { resourceBundleName = name; bundle = null; - + try { if (resourceBundleName != null) - bundle = ResourceBundle.getBundle(resourceBundleName); + bundle = ResourceBundle.getBundle(resourceBundleName); } catch (java.util.MissingResourceException _) { @@ -427,7 +427,7 @@ public class LogRecord * parameter to some logging calls, and in certain cases, the * logging framework tries to determine an approximation * (which may or may not be accurate). - * + * * @return the name of the class that issued the logging request, * or <code>null</code> if this information could not * be obtained. @@ -450,7 +450,7 @@ public class LogRecord * to the logging framework, applications should not modify it * anymore. Therefore, this method should only be called on * freshly constructed LogRecords. - * + * * @param sourceClassName the name of the class that issued the * logging request, or <code>null</code> to indicate that * this information could not be obtained. @@ -467,7 +467,7 @@ public class LogRecord * parameter to some logging calls, and in certain cases, the * logging framework tries to determine an approximation * (which may or may not be accurate). - * + * * @return the name of the method that issued the logging request, * or <code>null</code> if this information could not * be obtained. @@ -490,7 +490,7 @@ public class LogRecord * to the logging framework, applications should not modify it * anymore. Therefore, this method should only be called on * freshly constructed LogRecords. - * + * * @param sourceMethodName the name of the method that issued the * logging request, or <code>null</code> to indicate that * this information could not be obtained. @@ -543,7 +543,7 @@ public class LogRecord * * @param message the message text (which will be used as key * for looking up the localized message text - * if a resource bundle has been associated). + * if a resource bundle has been associated). */ public void setMessage(String message) { diff --git a/libjava/classpath/java/util/logging/Logger.java b/libjava/classpath/java/util/logging/Logger.java index cddc02d1c9c..c55e133e5bf 100644 --- a/libjava/classpath/java/util/logging/Logger.java +++ b/libjava/classpath/java/util/logging/Logger.java @@ -65,7 +65,7 @@ import java.security.PrivilegedAction; * to perform any modifications to the logger. * <p> * FIXME: Write more documentation. - * + * * @author Sascha Brawer (brawer@acm.org) */ public class Logger @@ -85,7 +85,7 @@ public class Logger * to avoid deadlocks. Yeah, no kidding, we got them :) */ private static final Object[] lock = new Object[0]; - + static { // Our class might be initialized from an unprivileged context @@ -159,7 +159,7 @@ public class Logger * (with ResourceBundle for localization) or * {@link #getLogger(java.lang.String) getLogger} (without ResourceBundle), * respectively. - * + * * @param name the name for the logger, for example "java.awt" or * "com.foo.bar". The name should be based on the name of the * package issuing log records and consist of dot-separated Java @@ -196,7 +196,7 @@ public class Logger /** * Finds a registered logger for a subsystem, or creates one in case no logger * has been registered yet. - * + * * @param name the name for the logger, for example "java.awt" or * "com.foo.bar". The name should be based on the name of the * package issuing log records and consist of dot-separated Java @@ -232,7 +232,7 @@ public class Logger * a different one than specified by <code>resourceBundleName</code>, an * <code>IllegalArgumentException</code> is thrown.</li> * </ul> - * + * * @param name the name for the logger, for example "java.awt" or * "org.gnu.foo". The name should be based on the name of the * package issuing log records and consist of dot-separated Java @@ -351,7 +351,7 @@ public class Logger * <p> * The parent of the newly created logger will the the root logger, from which * the level threshold and the handlers are inherited. - * + * * @param resourceBundleName the name of a resource bundle for localizing * messages, or <code>null</code> to indicate that messages do * not need to be localized. @@ -372,7 +372,7 @@ public class Logger /** * Returns the name of the resource bundle that is being used for localizing * messages. - * + * * @return the name of the resource bundle used for localizing messages, or * <code>null</code> if the parent's resource bundle is used for * this purpose. @@ -387,7 +387,7 @@ public class Logger /** * Returns the resource bundle that is being used for localizing messages. - * + * * @return the resource bundle used for localizing messages, or * <code>null</code> if the parent's resource bundle is used for * this purpose. @@ -405,7 +405,7 @@ public class Logger * log records with a lower severity level will be discarded; a log record of * the same or a higher level will be published unless an installed * <code>Filter</code> decides to discard it. - * + * * @return the severity level below which all log messages will be discarded, * or <code>null</code> if the logger inherits the threshold from * its parent. @@ -421,7 +421,7 @@ public class Logger /** * Returns whether or not a message of the specified level would be logged by * this logger. - * + * * @throws NullPointerException if <code>level</code> is <code>null</code>. */ public boolean isLoggable(Level level) @@ -443,7 +443,7 @@ public class Logger * records with a lower severity level will be discarded immediately. A log * record of the same or a higher level will be published unless an installed * <code>Filter</code> decides to discard it. - * + * * @param level the severity level below which all log messages will be * discarded, or <code>null</code> to indicate that the logger * should inherit the threshold from its parent. @@ -502,7 +502,7 @@ public class Logger /** * Returns the name of this logger. - * + * * @return the name of this logger, or <code>null</code> if the logger is * anonymous. */ @@ -528,7 +528,7 @@ public class Logger * create a new LogRecord and pass it to this method. Therefore, subclasses * usually just need to override this single method for customizing the * logging behavior. - * + * * @param record the log record to be inspected and possibly forwarded. */ public void log(LogRecord record) @@ -825,7 +825,7 @@ public class Logger * understandable to an inexperienced, non-technical end user. Ideally, they * explain in simple words what actions the user can take in order to resolve * the problem. - * + * * @see Level#SEVERE * @param message the message text, also used as look-up key if the logger is * localizing messages with a resource bundle. While it is possible @@ -847,7 +847,7 @@ public class Logger * should be understandable to an inexperienced, non-technical end user. * Ideally, they explain in simple words what actions the user can take in * order to resolve the problem. - * + * * @see Level#WARNING * @param message the message text, also used as look-up key if the logger is * localizing messages with a resource bundle. While it is possible @@ -871,7 +871,7 @@ public class Logger * used only for messages that are important to end users and system * administrators. Messages at this level should be understandable to an * inexperienced, non-technical user. - * + * * @param message the message text, also used as look-up key if the logger is * localizing messages with a resource bundle. While it is possible * to pass <code>null</code>, this is not recommended, since a @@ -890,7 +890,7 @@ public class Logger * Logs a message with severity level CONFIG. {@link Level#CONFIG} is intended * for static configuration messages, for example about the windowing * environment, the operating system version, etc. - * + * * @param message the message text, also used as look-up key if the logger is * localizing messages with a resource bundle. While it is possible * to pass <code>null</code>, this is not recommended, since a @@ -910,7 +910,7 @@ public class Logger * messages that are relevant for developers using the component generating * log messages. Examples include minor, recoverable failures, or possible * inefficiencies. - * + * * @param message the message text, also used as look-up key if the logger is * localizing messages with a resource bundle. While it is possible * to pass <code>null</code>, this is not recommended, since a @@ -929,7 +929,7 @@ public class Logger * Logs a message with severity level FINER. {@link Level#FINER} is intended * for rather detailed tracing, for example entering a method, returning from * a method, or throwing an exception. - * + * * @param message the message text, also used as look-up key if the logger is * localizing messages with a resource bundle. While it is possible * to pass <code>null</code>, this is not recommended, since a @@ -948,7 +948,7 @@ public class Logger * Logs a message with severity level FINEST. {@link Level#FINEST} is intended * for highly detailed tracing, for example reaching a certain point inside * the body of a method. - * + * * @param message the message text, also used as look-up key if the logger is * localizing messages with a resource bundle. While it is possible * to pass <code>null</code>, this is not recommended, since a @@ -966,7 +966,7 @@ public class Logger /** * Adds a handler to the set of handlers that get notified when a log record * is to be published. - * + * * @param handler the handler to be added. * @throws NullPointerException if <code>handler</code> is <code>null</code>. * @throws SecurityException if this logger is not anonymous, a security @@ -1001,7 +1001,7 @@ public class Logger /** * Removes a handler from the set of handlers that get notified when a log * record is to be published. - * + * * @param handler the handler to be removed. * @throws SecurityException if this logger is not anonymous, a security * manager exists, and the caller is not granted the permission to @@ -1053,7 +1053,7 @@ public class Logger /** * Returns whether or not this Logger forwards log records to handlers * registered for its parent loggers. - * + * * @return <code>false</code> if this Logger sends log records merely to * Handlers registered with itself; <code>true</code> if this Logger * sends log records not only to Handlers registered with itself, but @@ -1070,7 +1070,7 @@ public class Logger /** * Sets whether or not this Logger forwards log records to handlers registered * for its parent loggers. - * + * * @param useParentHandlers <code>false</code> to let this Logger send log * records merely to Handlers registered with itself; * <code>true</code> to let this Logger send log records not only @@ -1101,7 +1101,7 @@ public class Logger /** * Returns the parent of this logger. By default, the parent is assigned by * the LogManager by inspecting the logger's name. - * + * * @return the parent of this logger (as detemined by the LogManager by * inspecting logger names), the root logger if no other logger has a * name which is a prefix of this logger's name, or <code>null</code> @@ -1121,7 +1121,7 @@ public class Logger * loggers reflects the hierarchical logger namespace. Basically, this method * should not be public at all, but the GNU implementation follows the API * specification. - * + * * @throws NullPointerException if <code>parent</code> is <code>null</code>. * @throws SecurityException if this logger is not anonymous, a security * manager exists, and the caller is not granted the permission to @@ -1155,7 +1155,7 @@ public class Logger /** * Gets the StackTraceElement of the first class that is not this class. That * should be the initial caller of a logging method. - * + * * @return caller of the initial logging method or null if unknown. */ private StackTraceElement getCallerStackFrame() diff --git a/libjava/classpath/java/util/logging/LoggingMXBean.java b/libjava/classpath/java/util/logging/LoggingMXBean.java index 3e0a7276db3..24d8834c74a 100644 --- a/libjava/classpath/java/util/logging/LoggingMXBean.java +++ b/libjava/classpath/java/util/logging/LoggingMXBean.java @@ -44,7 +44,7 @@ import java.util.List; * This interface represents the management interface for logging. * There is a single logging bean per VM instance, which can be * retrieved via {@link LogManager#getLoggingMXBean()}. - * + * * @since 1.5 */ public interface LoggingMXBean @@ -73,7 +73,7 @@ public interface LoggingMXBean /** * Sets the logging level for a particular logger. - * + * * @param logger the name of the logger * @param level the name of the new logging level, or null * @throws IllegalArgumentException if the level is not diff --git a/libjava/classpath/java/util/logging/LoggingPermission.java b/libjava/classpath/java/util/logging/LoggingPermission.java index 1139a793a70..804fb940168 100644 --- a/libjava/classpath/java/util/logging/LoggingPermission.java +++ b/libjava/classpath/java/util/logging/LoggingPermission.java @@ -59,17 +59,17 @@ public final class LoggingPermission public LoggingPermission(String name, String actions) { super("control", ""); - + if (!"control".equals(name)) { throw new IllegalArgumentException( "name of LoggingPermission must be \"control\""); } - + if ((actions != null) && (actions.length() != 0)) { throw new IllegalArgumentException( - "actions of LoggingPermissions must be null or empty"); - } + "actions of LoggingPermissions must be null or empty"); + } } } diff --git a/libjava/classpath/java/util/logging/MemoryHandler.java b/libjava/classpath/java/util/logging/MemoryHandler.java index ffa589f1668..e5c258bbf23 100644 --- a/libjava/classpath/java/util/logging/MemoryHandler.java +++ b/libjava/classpath/java/util/logging/MemoryHandler.java @@ -122,19 +122,19 @@ public class MemoryHandler public MemoryHandler() { this((Handler) LogManager.getInstanceProperty( - "java.util.logging.MemoryHandler.target", - Handler.class, /* default */ null), - LogManager.getIntPropertyClamped( - "java.util.logging.MemoryHandler.size", - /* default */ 1000, - /* minimum value */ 1, - /* maximum value */ Integer.MAX_VALUE), - LogManager.getLevelProperty( - "java.util.logging.MemoryHandler.push", - /* default push level */ Level.SEVERE)); + "java.util.logging.MemoryHandler.target", + Handler.class, /* default */ null), + LogManager.getIntPropertyClamped( + "java.util.logging.MemoryHandler.size", + /* default */ 1000, + /* minimum value */ 1, + /* maximum value */ Integer.MAX_VALUE), + LogManager.getLevelProperty( + "java.util.logging.MemoryHandler.push", + /* default push level */ Level.SEVERE)); } - + /** * Constructs a <code>MemoryHandler</code> for keeping a circular * buffer of LogRecords, given some parameters. The values of the @@ -162,7 +162,7 @@ public class MemoryHandler * in those cases. */ public MemoryHandler(Handler target, int size, Level pushLevel) - { + { if ((target == null) || (size <= 0) || (pushLevel == null)) throw new IllegalArgumentException(); @@ -235,9 +235,9 @@ public class MemoryHandler else { for (i = position; i < buffer.length; i++) - target.publish(buffer[i]); + target.publish(buffer[i]); for (i = 0; i < position; i++) - target.publish(buffer[i]); + target.publish(buffer[i]); } numPublished = 0; @@ -298,7 +298,7 @@ public class MemoryHandler target.close(); } - + /** * Returns the push level threshold for this <code>Handler</code>. diff --git a/libjava/classpath/java/util/logging/SocketHandler.java b/libjava/classpath/java/util/logging/SocketHandler.java index 002dfdbbe5e..3c17b9bbcc7 100644 --- a/libjava/classpath/java/util/logging/SocketHandler.java +++ b/libjava/classpath/java/util/logging/SocketHandler.java @@ -104,10 +104,10 @@ public class SocketHandler throws java.io.IOException { this(LogManager.getLogManager().getProperty("java.util.logging.SocketHandler.host"), - getPortNumber()); + getPortNumber()); } - + /** * Constructs a <code>SocketHandler</code> that publishes log * records to a TCP/IP socket. With the exception of the internet @@ -131,10 +131,10 @@ public class SocketHandler throws java.io.IOException { super(createSocket(host, port), - "java.util.logging.SocketHandler", - /* default level */ Level.ALL, - /* formatter */ null, - /* default formatter */ XMLFormatter.class); + "java.util.logging.SocketHandler", + /* default level */ Level.ALL, + /* formatter */ null, + /* default formatter */ XMLFormatter.class); } @@ -218,4 +218,3 @@ public class SocketHandler flush(); } } - diff --git a/libjava/classpath/java/util/logging/StreamHandler.java b/libjava/classpath/java/util/logging/StreamHandler.java index 5c35c1e481d..d74dfac0ca3 100644 --- a/libjava/classpath/java/util/logging/StreamHandler.java +++ b/libjava/classpath/java/util/logging/StreamHandler.java @@ -114,7 +114,7 @@ public class StreamHandler public StreamHandler(OutputStream out, Formatter formatter) { this(out, "java.util.logging.StreamHandler", Level.INFO, - formatter, SimpleFormatter.class); + formatter, SimpleFormatter.class); } @@ -125,7 +125,7 @@ public class StreamHandler Formatter formatter, Class defaultFormatterClass) { this.level = LogManager.getLevelProperty(propertyPrefix + ".level", - defaultLevel); + defaultLevel); this.filter = (Filter) LogManager.getInstanceProperty( propertyPrefix + ".filter", @@ -136,14 +136,14 @@ public class StreamHandler this.formatter = formatter; else this.formatter = (Formatter) LogManager.getInstanceProperty( - propertyPrefix + ".formatter", + propertyPrefix + ".formatter", /* must be instance of */ Formatter.class, /* default: new instance of */ defaultFormatterClass); try { String enc = LogManager.getLogManager().getProperty(propertyPrefix - + ".encoding"); + + ".encoding"); /* make sure enc actually is a valid encoding */ if ((enc != null) && (enc.length() > 0)) @@ -163,10 +163,10 @@ public class StreamHandler } catch (UnsupportedEncodingException uex) { - /* This should never happen, since the validity of the encoding - * name has been checked above. - */ - throw new RuntimeException(uex.getMessage()); + /* This should never happen, since the validity of the encoding + * name has been checked above. + */ + throw new RuntimeException(uex.getMessage()); } } } @@ -263,9 +263,9 @@ public class StreamHandler * null would throw an exception. */ if (encoding == null) - writer = new OutputStreamWriter(out); + writer = new OutputStreamWriter(out); else - writer = new OutputStreamWriter(out, encoding); + writer = new OutputStreamWriter(out, encoding); } } @@ -330,7 +330,7 @@ public class StreamHandler * would depend on the exact behavior in this rather obscure, * erroneous case -- especially since the API specification does not * prescribe what is supposed to happen. - * + * * @param record the log event to be published. */ public void publish(LogRecord record) @@ -348,13 +348,13 @@ public class StreamHandler } catch (java.io.IOException ex) { - reportError(null, ex, ErrorManager.WRITE_FAILURE); - return; + reportError(null, ex, ErrorManager.WRITE_FAILURE); + return; } catch (Exception ex) { - reportError(null, ex, ErrorManager.GENERIC_FAILURE); - return; + reportError(null, ex, ErrorManager.GENERIC_FAILURE); + return; } streamState = STATE_PUBLISHED; @@ -449,7 +449,7 @@ public class StreamHandler /** * Closes this <code>StreamHandler</code> after having forced any * data that may have been buffered to the underlying output - * device. + * device. * * <p>As soon as <code>close</code> has been called, * a <code>Handler</code> should not be used anymore. Attempts @@ -496,20 +496,20 @@ public class StreamHandler if (writer != null) { - if (formatter != null) - { - /* Even if the StreamHandler has never published a record, - * it emits head and tail upon closing. An earlier version - * of the GNU Classpath implementation did not emitted - * anything. However, this had caused XML log files to be - * entirely empty instead of containing no log records. - */ - if (streamState == STATE_FRESH) + if (formatter != null) + { + /* Even if the StreamHandler has never published a record, + * it emits head and tail upon closing. An earlier version + * of the GNU Classpath implementation did not emitted + * anything. However, this had caused XML log files to be + * entirely empty instead of containing no log records. + */ + if (streamState == STATE_FRESH) writer.write(formatter.getHead(this)); - if (streamState != STATE_CLOSED) - writer.write(formatter.getTail(this)); - } - streamState = STATE_CLOSED; + if (streamState != STATE_CLOSED) + writer.write(formatter.getTail(this)); + } + streamState = STATE_CLOSED; writer.close(); } } diff --git a/libjava/classpath/java/util/logging/XMLFormatter.java b/libjava/classpath/java/util/logging/XMLFormatter.java index 194fcd238ce..da7c6ef29f2 100644 --- a/libjava/classpath/java/util/logging/XMLFormatter.java +++ b/libjava/classpath/java/util/logging/XMLFormatter.java @@ -75,7 +75,7 @@ public class XMLFormatter */ private static final String lineSep = SimpleFormatter.lineSep; - + /** * A DateFormat for emitting time in the ISO 8601 format. * Since the API specification of SimpleDateFormat does not talk @@ -129,29 +129,29 @@ public class XMLFormatter switch (c) { case '&': - buf.append("&"); - break; + buf.append("&"); + break; case '<': - buf.append("<"); - break; + buf.append("<"); + break; case '>': - buf.append(">"); - break; + buf.append(">"); + break; default: - if (((c >= 0x20) && (c <= 0x7e)) - || (c == /* line feed */ 10) - || (c == /* carriage return */ 13)) - buf.append(c); - else - { - buf.append("&#"); - buf.append((int) c); - buf.append(';'); - } - break; + if (((c >= 0x20) && (c <= 0x7e)) + || (c == /* line feed */ 10) + || (c == /* carriage return */ 13)) + buf.append(c); + else + { + buf.append("&#"); + buf.append((int) c); + buf.append(';'); + } + break; } /* switch (c) */ } /* for i */ @@ -190,11 +190,11 @@ public class XMLFormatter Object[] params = record.getParameters(); ResourceBundle bundle = record.getResourceBundle(); String message; - + buf.append("<record>"); buf.append(lineSep); - - + + appendTag(buf, 1, "date", iso8601.format(new Date(millis))); appendTag(buf, 1, "millis", millis); appendTag(buf, 1, "sequence", record.getSequenceNumber()); @@ -346,7 +346,7 @@ public class XMLFormatter */ if (encoding == null) encoding = "UTF-8"; - + /* On Windows XP localized for Swiss German (this is one of * my [Sascha Brawer's] test machines), the default encoding * has the canonical name "windows-1252". The "historical" name |