org.eclipse.jetty.util_8.1.3.v20120522

16:45:25.459 INFO  jd.cli.Main - Decompiling org.eclipse.jetty.util_8.1.3.v20120522.jar
package org.eclipse.jetty.util.log;

import org.slf4j.LoggerFactory;
import org.slf4j.spi.LocationAwareLogger;

public class Slf4jLog
  extends AbstractLogger
{
  private final org.slf4j.Logger _logger;
  
  public Slf4jLog()
    throws Exception
  {
    this("org.eclipse.jetty.util.log");
  }
  
  public Slf4jLog(String name)
  {
    org.slf4j.Logger logger = LoggerFactory.getLogger(name);
    if ((logger instanceof LocationAwareLogger)) {
      _logger = new JettyAwareLogger((LocationAwareLogger)logger);
    } else {
      _logger = logger;
    }
  }
  
  public String getName()
  {
    return _logger.getName();
  }
  
  public void warn(String msg, Object... args)
  {
    _logger.warn(msg, args);
  }
  
  public void warn(Throwable thrown)
  {
    warn("", thrown);
  }
  
  public void warn(String msg, Throwable thrown)
  {
    _logger.warn(msg, thrown);
  }
  
  public void info(String msg, Object... args)
  {
    _logger.info(msg, args);
  }
  
  public void info(Throwable thrown)
  {
    info("", thrown);
  }
  
  public void info(String msg, Throwable thrown)
  {
    _logger.info(msg, thrown);
  }
  
  public void debug(String msg, Object... args)
  {
    _logger.debug(msg, args);
  }
  
  public void debug(Throwable thrown)
  {
    debug("", thrown);
  }
  
  public void debug(String msg, Throwable thrown)
  {
    _logger.debug(msg, thrown);
  }
  
  public boolean isDebugEnabled()
  {
    return _logger.isDebugEnabled();
  }
  
  public void setDebugEnabled(boolean enabled)
  {
    warn("setDebugEnabled not implemented", new Object[] { null, null });
  }
  
  protected Logger newLogger(String fullname)
  {
    return new Slf4jLog(fullname);
  }
  
  public void ignore(Throwable ignored)
  {
    if (Log.isIgnored()) {
      warn("IGNORED ", ignored);
    }
  }
  
  public String toString()
  {
    return _logger.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.util.log.Slf4jLog
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.util.log;

import java.util.Properties;
import java.util.logging.Level;

public class JavaUtilLog
  extends AbstractLogger
{
  private Level configuredLevel;
  private java.util.logging.Logger _logger;
  
  public JavaUtilLog()
  {
    this("org.eclipse.jetty.util.log");
  }
  
  public JavaUtilLog(String name)
  {
    _logger = java.util.logging.Logger.getLogger(name);
    if (Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.DEBUG", "false"))) {
      _logger.setLevel(Level.FINE);
    }
    configuredLevel = _logger.getLevel();
  }
  
  public String getName()
  {
    return _logger.getName();
  }
  
  public void warn(String msg, Object... args)
  {
    _logger.log(Level.WARNING, format(msg, args));
  }
  
  public void warn(Throwable thrown)
  {
    warn("", thrown);
  }
  
  public void warn(String msg, Throwable thrown)
  {
    _logger.log(Level.WARNING, msg, thrown);
  }
  
  public void info(String msg, Object... args)
  {
    _logger.log(Level.INFO, format(msg, args));
  }
  
  public void info(Throwable thrown)
  {
    info("", thrown);
  }
  
  public void info(String msg, Throwable thrown)
  {
    _logger.log(Level.INFO, msg, thrown);
  }
  
  public boolean isDebugEnabled()
  {
    return _logger.isLoggable(Level.FINE);
  }
  
  public void setDebugEnabled(boolean enabled)
  {
    if (enabled)
    {
      configuredLevel = _logger.getLevel();
      _logger.setLevel(Level.FINE);
    }
    else
    {
      _logger.setLevel(configuredLevel);
    }
  }
  
  public void debug(String msg, Object... args)
  {
    _logger.log(Level.FINE, format(msg, args));
  }
  
  public void debug(Throwable thrown)
  {
    debug("", thrown);
  }
  
  public void debug(String msg, Throwable thrown)
  {
    _logger.log(Level.FINE, msg, thrown);
  }
  
  protected Logger newLogger(String fullname)
  {
    return new JavaUtilLog(fullname);
  }
  
  public void ignore(Throwable ignored)
  {
    if (Log.isIgnored()) {
      warn("IGNORED ", ignored);
    }
  }
  
  private String format(String msg, Object... args)
  {
    msg = String.valueOf(msg);
    String braces = "{}";
    StringBuilder builder = new StringBuilder();
    int start = 0;
    for (Object arg : args)
    {
      int bracesIndex = msg.indexOf(braces, start);
      if (bracesIndex < 0)
      {
        builder.append(msg.substring(start));
        builder.append(" ");
        builder.append(arg);
        start = msg.length();
      }
      else
      {
        builder.append(msg.substring(start, bracesIndex));
        builder.append(String.valueOf(arg));
        start = bracesIndex + braces.length();
      }
    }
    builder.append(msg.substring(start));
    return builder.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.util.log.JavaUtilLog
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.util.log;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.Loader;

public class Log
{
  public static final String EXCEPTION = "EXCEPTION ";
  public static final String IGNORED = "IGNORED ";
  protected static Properties __props;
  public static String __logClass;
  public static boolean __ignored;
  private static final ConcurrentMap<String, Logger> __loggers = new ConcurrentHashMap();
  private static Logger LOG;
  private static boolean __initialized;
  
  static
  {
    __props = new Properties();
    
    AccessController.doPrivileged(new PrivilegedAction()
    {
      public Object run()
      {
        URL testProps = Log.class.getClassLoader().getResource("jetty-logging.properties");
        if (testProps != null)
        {
          InputStream in = null;
          try
          {
            in = testProps.openStream();
            Log.__props.load(in);
          }
          catch (IOException e)
          {
            System.err.println("Unable to load " + testProps);
            e.printStackTrace(System.err);
          }
          finally
          {
            IO.close(in);
          }
        }
        Enumeration<String> systemKeyEnum = System.getProperties().propertyNames();
        while (systemKeyEnum.hasMoreElements())
        {
          String key = (String)systemKeyEnum.nextElement();
          String val = System.getProperty(key);
          if (val != null) {
            Log.__props.setProperty(key, val);
          }
        }
        Log.__logClass = Log.__props.getProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.Slf4jLog");
        Log.__ignored = Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.IGNORED", "false"));
        return null;
      }
    });
  }
  
  public static boolean initialized()
  {
    if (LOG != null) {
      return true;
    }
    synchronized (Log.class)
    {
      if (__initialized) {
        return LOG != null;
      }
      __initialized = true;
    }
    try
    {
      Class<?> log_class = Loader.loadClass(Log.class, __logClass);
      if ((LOG == null) || (!LOG.getClass().equals(log_class)))
      {
        LOG = (Logger)log_class.newInstance();
        LOG.debug("Logging to {} via {}", new Object[] { LOG, log_class.getName() });
      }
    }
    catch (Throwable e)
    {
      initStandardLogging(e);
    }
    return LOG != null;
  }
  
  private static void initStandardLogging(Throwable e)
  {
    if ((e != null) && (__ignored)) {
      e.printStackTrace();
    }
    if (LOG == null)
    {
      Class<?> log_class = StdErrLog.class;
      LOG = new StdErrLog();
      LOG.debug("Logging to {} via {}", new Object[] { LOG, log_class.getName() });
    }
  }
  
  public static void setLog(Logger log)
  {
    LOG = log;
  }
  
  @Deprecated
  public static Logger getLog()
  {
    initialized();
    return LOG;
  }
  
  public static Logger getRootLogger()
  {
    initialized();
    return LOG;
  }
  
  static boolean isIgnored()
  {
    return __ignored;
  }
  
  public static void setLogToParent(String name)
  {
    ClassLoader loader = Log.class.getClassLoader();
    if (loader.getParent() != null) {
      try
      {
        Class<?> uberlog = loader.getParent().loadClass("org.eclipse.jetty.util.log.Log");
        Method getLogger = uberlog.getMethod("getLogger", new Class[] { String.class });
        Object logger = getLogger.invoke(null, new Object[] { name });
        setLog(new LoggerLog(logger));
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
    } else {
      setLog(getLogger(name));
    }
  }
  
  @Deprecated
  public static void debug(Throwable th)
  {
    if (!isDebugEnabled()) {
      return;
    }
    LOG.debug("EXCEPTION ", th);
  }
  
  @Deprecated
  public static void debug(String msg)
  {
    if (!initialized()) {
      return;
    }
    LOG.debug(msg, new Object[0]);
  }
  
  @Deprecated
  public static void debug(String msg, Object arg)
  {
    if (!initialized()) {
      return;
    }
    LOG.debug(msg, new Object[] { arg });
  }
  
  @Deprecated
  public static void debug(String msg, Object arg0, Object arg1)
  {
    if (!initialized()) {
      return;
    }
    LOG.debug(msg, new Object[] { arg0, arg1 });
  }
  
  @Deprecated
  public static void ignore(Throwable thrown)
  {
    if (!initialized()) {
      return;
    }
    LOG.ignore(thrown);
  }
  
  @Deprecated
  public static void info(String msg)
  {
    if (!initialized()) {
      return;
    }
    LOG.info(msg, new Object[0]);
  }
  
  @Deprecated
  public static void info(String msg, Object arg)
  {
    if (!initialized()) {
      return;
    }
    LOG.info(msg, new Object[] { arg });
  }
  
  @Deprecated
  public static void info(String msg, Object arg0, Object arg1)
  {
    if (!initialized()) {
      return;
    }
    LOG.info(msg, new Object[] { arg0, arg1 });
  }
  
  @Deprecated
  public static boolean isDebugEnabled()
  {
    if (!initialized()) {
      return false;
    }
    return LOG.isDebugEnabled();
  }
  
  @Deprecated
  public static void warn(String msg)
  {
    if (!initialized()) {
      return;
    }
    LOG.warn(msg, new Object[0]);
  }
  
  @Deprecated
  public static void warn(String msg, Object arg)
  {
    if (!initialized()) {
      return;
    }
    LOG.warn(msg, new Object[] { arg });
  }
  
  @Deprecated
  public static void warn(String msg, Object arg0, Object arg1)
  {
    if (!initialized()) {
      return;
    }
    LOG.warn(msg, new Object[] { arg0, arg1 });
  }
  
  @Deprecated
  public static void warn(String msg, Throwable th)
  {
    if (!initialized()) {
      return;
    }
    LOG.warn(msg, th);
  }
  
  @Deprecated
  public static void warn(Throwable th)
  {
    if (!initialized()) {
      return;
    }
    LOG.warn("EXCEPTION ", th);
  }
  
  public static Logger getLogger(Class<?> clazz)
  {
    return getLogger(clazz.getName());
  }
  
  public static Logger getLogger(String name)
  {
    if (!initialized()) {
      return null;
    }
    if (name == null) {
      return LOG;
    }
    Logger logger = (Logger)__loggers.get(name);
    if (logger == null) {
      logger = LOG.getLogger(name);
    }
    return logger;
  }
  
  static ConcurrentMap<String, Logger> getMutableLoggers()
  {
    return __loggers;
  }
  
  public static Map<String, Logger> getLoggers()
  {
    return Collections.unmodifiableMap(__loggers);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.util.log.Log
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.util.log;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.net.URL;
import java.security.PrivilegedAction;
import java.util.Enumeration;
import java.util.Properties;
import org.eclipse.jetty.util.IO;

final class Log$1
  implements PrivilegedAction<Object>
{
  public Object run()
  {
    URL testProps = Log.class.getClassLoader().getResource("jetty-logging.properties");
    if (testProps != null)
    {
      InputStream in = null;
      try
      {
        in = testProps.openStream();
        Log.__props.load(in);
      }
      catch (IOException e)
      {
        System.err.println("Unable to load " + testProps);
        e.printStackTrace(System.err);
      }
      finally
      {
        IO.close(in);
      }
    }
    Enumeration<String> systemKeyEnum = System.getProperties().propertyNames();
    while (systemKeyEnum.hasMoreElements())
    {
      String key = (String)systemKeyEnum.nextElement();
      String val = System.getProperty(key);
      if (val != null) {
        Log.__props.setProperty(key, val);
      }
    }
    Log.__logClass = Log.__props.getProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.Slf4jLog");
    Log.__ignored = Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.IGNORED", "false"));
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.util.log.Log.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.util.log;

import java.lang.reflect.Method;

public class LoggerLog
  extends AbstractLogger
{
  private final Object _logger;
  private final Method _debugMT;
  private final Method _debugMAA;
  private final Method _infoMT;
  private final Method _infoMAA;
  private final Method _warnMT;
  private final Method _warnMAA;
  private final Method _setDebugEnabledE;
  private final Method _getLoggerN;
  private final Method _getName;
  private volatile boolean _debug;
  
  public LoggerLog(Object logger)
  {
    try
    {
      _logger = logger;
      Class<?> lc = logger.getClass();
      _debugMT = lc.getMethod("debug", new Class[] { String.class, Throwable.class });
      _debugMAA = lc.getMethod("debug", new Class[] { String.class, Object[].class });
      _infoMT = lc.getMethod("info", new Class[] { String.class, Throwable.class });
      _infoMAA = lc.getMethod("info", new Class[] { String.class, Object[].class });
      _warnMT = lc.getMethod("warn", new Class[] { String.class, Throwable.class });
      _warnMAA = lc.getMethod("warn", new Class[] { String.class, Object[].class });
      Method _isDebugEnabled = lc.getMethod("isDebugEnabled", new Class[0]);
      _setDebugEnabledE = lc.getMethod("setDebugEnabled", new Class[] { Boolean.TYPE });
      _getLoggerN = lc.getMethod("getLogger", new Class[] { String.class });
      _getName = lc.getMethod("getName", new Class[0]);
      
      _debug = ((Boolean)_isDebugEnabled.invoke(_logger, new Object[0])).booleanValue();
    }
    catch (Exception x)
    {
      throw new IllegalStateException(x);
    }
  }
  
  public String getName()
  {
    try
    {
      return (String)_getName.invoke(_logger, new Object[0]);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    return null;
  }
  
  public void warn(String msg, Object... args)
  {
    try
    {
      _warnMAA.invoke(_logger, args);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  
  public void warn(Throwable thrown)
  {
    warn("", thrown);
  }
  
  public void warn(String msg, Throwable thrown)
  {
    try
    {
      _warnMT.invoke(_logger, new Object[] { msg, thrown });
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  
  public void info(String msg, Object... args)
  {
    try
    {
      _infoMAA.invoke(_logger, args);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  
  public void info(Throwable thrown)
  {
    info("", thrown);
  }
  
  public void info(String msg, Throwable thrown)
  {
    try
    {
      _infoMT.invoke(_logger, new Object[] { msg, thrown });
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  
  public boolean isDebugEnabled()
  {
    return _debug;
  }
  
  public void setDebugEnabled(boolean enabled)
  {
    try
    {
      _setDebugEnabledE.invoke(_logger, new Object[] { Boolean.valueOf(enabled) });
      _debug = enabled;
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  
  public void debug(String msg, Object... args)
  {
    if (!_debug) {
      return;
    }
    try
    {
      _debugMAA.invoke(_logger, args);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  
  public void debug(Throwable thrown)
  {
    debug("", thrown);
  }
  
  public void debug(String msg, Throwable th)
  {
    if (!_debug) {
      return;
    }
    try
    {
      _debugMT.invoke(_logger, new Object[] { msg, th });
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  
  public void ignore(Throwable ignored)
  {
    if (Log.isIgnored()) {
      warn("IGNORED ", ignored);
    }
  }
  
  protected Logger newLogger(String fullname)
  {
    try
    {
      Object logger = _getLoggerN.invoke(_logger, new Object[] { fullname });
      return new LoggerLog(logger);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    return this;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.util.log.LoggerLog
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.util.log;

import java.util.Map;
import java.util.concurrent.ConcurrentMap;

public abstract class AbstractLogger
  implements Logger
{
  public final Logger getLogger(String name)
  {
    if (isBlank(name)) {
      return this;
    }
    String basename = getName();
    String fullname = basename + "." + name;
    
    Logger logger = (Logger)Log.getLoggers().get(fullname);
    if (logger == null)
    {
      Logger newlog = newLogger(fullname);
      
      logger = (Logger)Log.getMutableLoggers().putIfAbsent(fullname, newlog);
      if (logger == null) {
        logger = newlog;
      }
    }
    return logger;
  }
  
  protected abstract Logger newLogger(String paramString);
  
  private static boolean isBlank(String name)
  {
    if (name == null) {
      return true;
    }
    int size = name.length();
    for (int i = 0; i < size; i++)
    {
      char c = name.charAt(i);
      if (!Character.isWhitespace(c)) {
        return false;
      }
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.util.log.AbstractLogger
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.util.log;

import java.io.PrintStream;
import java.security.AccessControlException;
import java.util.Map;
import java.util.Properties;
import org.eclipse.jetty.util.DateCache;

public class StdErrLog
  extends AbstractLogger
{
  private static final String EOL = System.getProperty("line.separator");
  private static DateCache _dateCache;
  private static final Properties __props = new Properties();
  private static final boolean __source = Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.SOURCE", Log.__props.getProperty("org.eclipse.jetty.util.log.stderr.SOURCE", "false")));
  private static final boolean __long = Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.stderr.LONG", "false"));
  public static final int LEVEL_ALL = 0;
  public static final int LEVEL_DEBUG = 1;
  public static final int LEVEL_INFO = 2;
  public static final int LEVEL_WARN = 3;
  
  static
  {
    __props.putAll(Log.__props);
    
    String[] deprecatedProperties = { "DEBUG", "org.eclipse.jetty.util.log.DEBUG", "org.eclipse.jetty.util.log.stderr.DEBUG" };
    for (String deprecatedProp : deprecatedProperties) {
      if (System.getProperty(deprecatedProp) != null) {
        System.err.printf("System Property [%s] has been deprecated! (Use org.eclipse.jetty.LEVEL=DEBUG instead)%n", new Object[] { deprecatedProp });
      }
    }
    try
    {
      _dateCache = new DateCache("yyyy-MM-dd HH:mm:ss");
    }
    catch (Exception x)
    {
      x.printStackTrace(System.err);
    }
  }
  
  private int _level = 2;
  private int _configuredLevel;
  private PrintStream _stderr = null;
  private boolean _source = __source;
  private boolean _printLongNames = __long;
  private final String _name;
  private final String _abbrevname;
  private boolean _hideStacks = false;
  
  public StdErrLog()
  {
    this(null);
  }
  
  public StdErrLog(String name)
  {
    this(name, __props);
  }
  
  public StdErrLog(String name, Properties props)
  {
    if ((props != null) && (props != __props)) {
      __props.putAll(props);
    }
    _name = (name == null ? "" : name);
    _abbrevname = condensePackageString(_name);
    _level = getLoggingLevel(props, _name);
    _configuredLevel = _level;
    try
    {
      _source = Boolean.parseBoolean(props.getProperty(_name + ".SOURCE", Boolean.toString(_source)));
    }
    catch (AccessControlException ace)
    {
      _source = __source;
    }
  }
  
  public static int getLoggingLevel(Properties props, String name)
  {
    String nameSegment = name;
    while ((nameSegment != null) && (nameSegment.length() > 0))
    {
      String levelStr = props.getProperty(nameSegment + ".LEVEL");
      
      int level = getLevelId(nameSegment + ".LEVEL", levelStr);
      if (level != -1) {
        return level;
      }
      int idx = nameSegment.lastIndexOf('.');
      if (idx >= 0) {
        nameSegment = nameSegment.substring(0, idx);
      } else {
        nameSegment = null;
      }
    }
    return getLevelId("log.LEVEL", props.getProperty("log.LEVEL", "INFO"));
  }
  
  protected static int getLevelId(String levelSegment, String levelName)
  {
    if (levelName == null) {
      return -1;
    }
    String levelStr = levelName.trim();
    if ("ALL".equalsIgnoreCase(levelStr)) {
      return 0;
    }
    if ("DEBUG".equalsIgnoreCase(levelStr)) {
      return 1;
    }
    if ("INFO".equalsIgnoreCase(levelStr)) {
      return 2;
    }
    if ("WARN".equalsIgnoreCase(levelStr)) {
      return 3;
    }
    System.err.println("Unknown StdErrLog level [" + levelSegment + "]=[" + levelStr + "], expecting only [ALL, DEBUG, INFO, WARN] as values.");
    return -1;
  }
  
  protected static String condensePackageString(String classname)
  {
    String[] parts = classname.split("\\.");
    StringBuilder dense = new StringBuilder();
    for (int i = 0; i < parts.length - 1; i++) {
      dense.append(parts[i].charAt(0));
    }
    if (dense.length() > 0) {
      dense.append('.');
    }
    dense.append(parts[(parts.length - 1)]);
    return dense.toString();
  }
  
  public String getName()
  {
    return _name;
  }
  
  public void setPrintLongNames(boolean printLongNames)
  {
    _printLongNames = printLongNames;
  }
  
  public boolean isPrintLongNames()
  {
    return _printLongNames;
  }
  
  public boolean isHideStacks()
  {
    return _hideStacks;
  }
  
  public void setHideStacks(boolean hideStacks)
  {
    _hideStacks = hideStacks;
  }
  
  public boolean isSource()
  {
    return _source;
  }
  
  public void setSource(boolean source)
  {
    _source = source;
  }
  
  public void warn(String msg, Object... args)
  {
    if (_level <= 3)
    {
      StringBuilder buffer = new StringBuilder(64);
      format(buffer, ":WARN:", msg, args);
      (_stderr == null ? System.err : _stderr).println(buffer);
    }
  }
  
  public void warn(Throwable thrown)
  {
    warn("", thrown);
  }
  
  public void warn(String msg, Throwable thrown)
  {
    if (_level <= 3)
    {
      StringBuilder buffer = new StringBuilder(64);
      format(buffer, ":WARN:", msg, thrown);
      (_stderr == null ? System.err : _stderr).println(buffer);
    }
  }
  
  public void info(String msg, Object... args)
  {
    if (_level <= 2)
    {
      StringBuilder buffer = new StringBuilder(64);
      format(buffer, ":INFO:", msg, args);
      (_stderr == null ? System.err : _stderr).println(buffer);
    }
  }
  
  public void info(Throwable thrown)
  {
    info("", thrown);
  }
  
  public void info(String msg, Throwable thrown)
  {
    if (_level <= 2)
    {
      StringBuilder buffer = new StringBuilder(64);
      format(buffer, ":INFO:", msg, thrown);
      (_stderr == null ? System.err : _stderr).println(buffer);
    }
  }
  
  public boolean isDebugEnabled()
  {
    return _level <= 1;
  }
  
  public void setDebugEnabled(boolean enabled)
  {
    if (enabled)
    {
      _level = 1;
      for (Logger log : Log.getLoggers().values()) {
        if ((log instanceof StdErrLog)) {
          ((StdErrLog)log).setLevel(1);
        }
      }
    }
    else
    {
      _level = _configuredLevel;
      for (Logger log : Log.getLoggers().values()) {
        if ((log instanceof StdErrLog)) {
          ((StdErrLog)log).setLevel(_configuredLevel);
        }
      }
    }
  }
  
  public int getLevel()
  {
    return _level;
  }
  
  public void setLevel(int level)
  {
    _level = level;
  }
  
  public void setStdErrStream(PrintStream stream)
  {
    _stderr = (stream == System.err ? null : stream);
  }
  
  public void debug(String msg, Object... args)
  {
    if (_level <= 1)
    {
      StringBuilder buffer = new StringBuilder(64);
      format(buffer, ":DBUG:", msg, args);
      (_stderr == null ? System.err : _stderr).println(buffer);
    }
  }
  
  public void debug(Throwable thrown)
  {
    debug("", thrown);
  }
  
  public void debug(String msg, Throwable thrown)
  {
    if (_level <= 1)
    {
      StringBuilder buffer = new StringBuilder(64);
      format(buffer, ":DBUG:", msg, thrown);
      (_stderr == null ? System.err : _stderr).println(buffer);
    }
  }
  
  private void format(StringBuilder buffer, String level, String msg, Object... args)
  {
    String d = _dateCache.now();
    int ms = _dateCache.lastMs();
    tag(buffer, d, ms, level);
    format(buffer, msg, args);
  }
  
  private void format(StringBuilder buffer, String level, String msg, Throwable thrown)
  {
    format(buffer, level, msg, new Object[0]);
    if (isHideStacks()) {
      format(buffer, String.valueOf(thrown), new Object[0]);
    } else {
      format(buffer, thrown);
    }
  }
  
  private void tag(StringBuilder buffer, String d, int ms, String tag)
  {
    buffer.setLength(0);
    buffer.append(d);
    if (ms > 99) {
      buffer.append('.');
    } else if (ms > 9) {
      buffer.append(".0");
    } else {
      buffer.append(".00");
    }
    buffer.append(ms).append(tag);
    if (_printLongNames) {
      buffer.append(_name);
    } else {
      buffer.append(_abbrevname);
    }
    buffer.append(':');
    if (_source)
    {
      Throwable source = new Throwable();
      StackTraceElement[] frames = source.getStackTrace();
      for (int i = 0; i < frames.length; i++)
      {
        StackTraceElement frame = frames[i];
        String clazz = frame.getClassName();
        if ((!clazz.equals(StdErrLog.class.getName())) && (!clazz.equals(Log.class.getName())))
        {
          if ((!_printLongNames) && (clazz.startsWith("org.eclipse.jetty."))) {
            buffer.append(condensePackageString(clazz));
          } else {
            buffer.append(clazz);
          }
          buffer.append('#').append(frame.getMethodName());
          if (frame.getFileName() != null) {
            buffer.append('(').append(frame.getFileName()).append(':').append(frame.getLineNumber()).append(')');
          }
          buffer.append(':');
          break;
        }
      }
    }
  }
  
  private void format(StringBuilder builder, String msg, Object... args)
  {
    if (msg == null)
    {
      msg = "";
      for (int i = 0; i < args.length; i++) {
        msg = msg + "{} ";
      }
    }
    String braces = "{}";
    int start = 0;
    for (Object arg : args)
    {
      int bracesIndex = msg.indexOf(braces, start);
      if (bracesIndex < 0)
      {
        escape(builder, msg.substring(start));
        builder.append(" ");
        builder.append(arg);
        start = msg.length();
      }
      else
      {
        escape(builder, msg.substring(start, bracesIndex));
        builder.append(String.valueOf(arg));
        start = bracesIndex + braces.length();
      }
    }
    escape(builder, msg.substring(start));
  }
  
  private void escape(StringBuilder builder, String string)
  {
    for (int i = 0; i < string.length(); i++)
    {
      char c = string.charAt(i);
      if (Character.isISOControl(c))
      {
        if (c == '\n') {
          builder.append('|');
        } else if (c == '\r') {
          builder.append('<');
        } else {
          builder.append('?');
        }
      }
      else {
        builder.append(c);
      }
    }
  }
  
  private void format(StringBuilder buffer, Throwable thrown)
  {
    if (thrown == null)
    {
      buffer.append("null");
    }
    else
    {
      buffer.append(EOL);
      format(buffer, thrown.toString(), new Object[0]);
      StackTraceElement[] elements = thrown.getStackTrace();
      for (int i = 0; (elements != null) && (i < elements.length); i++)
      {
        buffer.append(EOL).append("\tat ");
        format(buffer, elements[i].toString(), new Object[0]);
      }
      Throwable cause = thrown.getCause();
      if ((cause != null) && (cause != thrown))
      {
        buffer.append(EOL).append("Caused by: ");
        format(buffer, cause);
      }
    }
  }
  
  protected Logger newLogger(String fullname)
  {
    StdErrLog logger = new StdErrLog(fullname);
    
    logger.setPrintLongNames(_printLongNames);
    
    logger.setSource(_source);
    _stderr = _stderr;
    
    return logger;
  }
  
  public String toString()
  {
    StringBuilder s = new StringBuilder();
    s.append("StdErrLog:");
    s.append(_name);
    s.append(":LEVEL=");
    switch (_level)
    {
    case 0: 
      s.append("ALL");
      break;
    case 1: 
      s.append("DEBUG");
      break;
    case 2: 
      s.append("INFO");
      break;
    case 3: 
      s.append("WARN");
      break;
    default: 
      s.append("?");
    }
    return s.toString();
  }
  
  public static void setProperties(Properties props)
  {
    __props.clear();
    __props.putAll(props);
  }
  
  public void ignore(Throwable ignored)
  {
    if (_level <= 0)
    {
      StringBuilder buffer = new StringBuilder(64);
      format(buffer, ":IGNORED:", "", ignored);
      (_stderr == null ? System.err : _stderr).println(buffer);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.util.log.StdErrLog
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.util.log;

import org.slf4j.Logger;
import org.slf4j.Marker;
import org.slf4j.helpers.FormattingTuple;
import org.slf4j.helpers.MessageFormatter;
import org.slf4j.spi.LocationAwareLogger;

class JettyAwareLogger
  implements Logger
{
  private static final int DEBUG = 10;
  private static final int ERROR = 40;
  private static final int INFO = 20;
  private static final int TRACE = 0;
  private static final int WARN = 30;
  private static final String FQCN = Slf4jLog.class.getName();
  private final LocationAwareLogger _logger;
  
  public JettyAwareLogger(LocationAwareLogger logger)
  {
    _logger = logger;
  }
  
  public String getName()
  {
    return _logger.getName();
  }
  
  public boolean isTraceEnabled()
  {
    return _logger.isTraceEnabled();
  }
  
  public void trace(String msg)
  {
    log(null, 0, msg, null, null);
  }
  
  public void trace(String format, Object arg)
  {
    log(null, 0, format, new Object[] { arg }, null);
  }
  
  public void trace(String format, Object arg1, Object arg2)
  {
    log(null, 0, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void trace(String format, Object[] argArray)
  {
    log(null, 0, format, argArray, null);
  }
  
  public void trace(String msg, Throwable t)
  {
    log(null, 0, msg, null, t);
  }
  
  public boolean isTraceEnabled(Marker marker)
  {
    return _logger.isTraceEnabled(marker);
  }
  
  public void trace(Marker marker, String msg)
  {
    log(marker, 0, msg, null, null);
  }
  
  public void trace(Marker marker, String format, Object arg)
  {
    log(marker, 0, format, new Object[] { arg }, null);
  }
  
  public void trace(Marker marker, String format, Object arg1, Object arg2)
  {
    log(marker, 0, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void trace(Marker marker, String format, Object[] argArray)
  {
    log(marker, 0, format, argArray, null);
  }
  
  public void trace(Marker marker, String msg, Throwable t)
  {
    log(marker, 0, msg, null, t);
  }
  
  public boolean isDebugEnabled()
  {
    return _logger.isDebugEnabled();
  }
  
  public void debug(String msg)
  {
    log(null, 10, msg, null, null);
  }
  
  public void debug(String format, Object arg)
  {
    log(null, 10, format, new Object[] { arg }, null);
  }
  
  public void debug(String format, Object arg1, Object arg2)
  {
    log(null, 10, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void debug(String format, Object[] argArray)
  {
    log(null, 10, format, argArray, null);
  }
  
  public void debug(String msg, Throwable t)
  {
    log(null, 10, msg, null, t);
  }
  
  public boolean isDebugEnabled(Marker marker)
  {
    return _logger.isDebugEnabled(marker);
  }
  
  public void debug(Marker marker, String msg)
  {
    log(marker, 10, msg, null, null);
  }
  
  public void debug(Marker marker, String format, Object arg)
  {
    log(marker, 10, format, new Object[] { arg }, null);
  }
  
  public void debug(Marker marker, String format, Object arg1, Object arg2)
  {
    log(marker, 10, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void debug(Marker marker, String format, Object[] argArray)
  {
    log(marker, 10, format, argArray, null);
  }
  
  public void debug(Marker marker, String msg, Throwable t)
  {
    log(marker, 10, msg, null, t);
  }
  
  public boolean isInfoEnabled()
  {
    return _logger.isInfoEnabled();
  }
  
  public void info(String msg)
  {
    log(null, 20, msg, null, null);
  }
  
  public void info(String format, Object arg)
  {
    log(null, 20, format, new Object[] { arg }, null);
  }
  
  public void info(String format, Object arg1, Object arg2)
  {
    log(null, 20, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void info(String format, Object[] argArray)
  {
    log(null, 20, format, argArray, null);
  }
  
  public void info(String msg, Throwable t)
  {
    log(null, 20, msg, null, t);
  }
  
  public boolean isInfoEnabled(Marker marker)
  {
    return _logger.isInfoEnabled(marker);
  }
  
  public void info(Marker marker, String msg)
  {
    log(marker, 20, msg, null, null);
  }
  
  public void info(Marker marker, String format, Object arg)
  {
    log(marker, 20, format, new Object[] { arg }, null);
  }
  
  public void info(Marker marker, String format, Object arg1, Object arg2)
  {
    log(marker, 20, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void info(Marker marker, String format, Object[] argArray)
  {
    log(marker, 20, format, argArray, null);
  }
  
  public void info(Marker marker, String msg, Throwable t)
  {
    log(marker, 20, msg, null, t);
  }
  
  public boolean isWarnEnabled()
  {
    return _logger.isWarnEnabled();
  }
  
  public void warn(String msg)
  {
    log(null, 30, msg, null, null);
  }
  
  public void warn(String format, Object arg)
  {
    log(null, 30, format, new Object[] { arg }, null);
  }
  
  public void warn(String format, Object[] argArray)
  {
    log(null, 30, format, argArray, null);
  }
  
  public void warn(String format, Object arg1, Object arg2)
  {
    log(null, 30, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void warn(String msg, Throwable t)
  {
    log(null, 30, msg, null, t);
  }
  
  public boolean isWarnEnabled(Marker marker)
  {
    return _logger.isWarnEnabled(marker);
  }
  
  public void warn(Marker marker, String msg)
  {
    log(marker, 30, msg, null, null);
  }
  
  public void warn(Marker marker, String format, Object arg)
  {
    log(marker, 30, format, new Object[] { arg }, null);
  }
  
  public void warn(Marker marker, String format, Object arg1, Object arg2)
  {
    log(marker, 30, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void warn(Marker marker, String format, Object[] argArray)
  {
    log(marker, 30, format, argArray, null);
  }
  
  public void warn(Marker marker, String msg, Throwable t)
  {
    log(marker, 30, msg, null, t);
  }
  
  public boolean isErrorEnabled()
  {
    return _logger.isErrorEnabled();
  }
  
  public void error(String msg)
  {
    log(null, 40, msg, null, null);
  }
  
  public void error(String format, Object arg)
  {
    log(null, 40, format, new Object[] { arg }, null);
  }
  
  public void error(String format, Object arg1, Object arg2)
  {
    log(null, 40, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void error(String format, Object[] argArray)
  {
    log(null, 40, format, argArray, null);
  }
  
  public void error(String msg, Throwable t)
  {
    log(null, 40, msg, null, t);
  }
  
  public boolean isErrorEnabled(Marker marker)
  {
    return _logger.isErrorEnabled(marker);
  }
  
  public void error(Marker marker, String msg)
  {
    log(marker, 40, msg, null, null);
  }
  
  public void error(Marker marker, String format, Object arg)
  {
    log(marker, 40, format, new Object[] { arg }, null);
  }
  
  public void error(Marker marker, String format, Object arg1, Object arg2)
  {
    log(marker, 40, format, new Object[] { arg1, arg2 }, null);
  }
  
  public void error(Marker marker, String format, Object[] argArray)
  {
    log(marker, 40, format, argArray, null);
  }
  
  public void error(Marker marker, String msg, Throwable t)
  {
    log(marker, 40, msg, null, t);
  }
  
  public String toString()
  {
    return _logger.toString();
  }
  
  private void log(Marker marker, int level, String msg, Object[] argArray, Throwable t)
  {
    if (argArray == null)
    {
      _logger.log(marker, FQCN, level, msg, null, t);
    }
    else
    {
      int loggerLevel = _logger.isWarnEnabled() ? 30 : _logger.isInfoEnabled() ? 20 : _logger.isDebugEnabled() ? 10 : _logger.isTraceEnabled() ? 0 : 40;
      if (loggerLevel <= level)
      {
        FormattingTuple ft = MessageFormatter.arrayFormat(msg, argArray);
        _logger.log(marker, FQCN, level, ft.getMessage(), null, t);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.util.log.JettyAwareLogger
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.util.log;

public abstract interface Logger
{
  public abstract String getName();
  
  public abstract void warn(String paramString, Object... paramVarArgs);
  
  public abstract void warn(Throwable paramThrowable);
  
  public abstract void warn(String paramString, Throwable paramThrowable);
  
  public abstract void info(String paramString, Object... paramVarArgs);
  
  public abstract void info(Throwable paramThrowable);
  
  public abstract void info(String paramString, Throwable paramThrowable);
  
  public abstract boolean isDebugEnabled();
  
  public abstract void setDebugEnabled(boolean paramBoolean);
  
  public abstract void debug(String paramString, Object... paramVarArgs);
  
  public abstract void debug(Throwable paramThrowable);
  
  public abstract void debug(String paramString, Throwable paramThrowable);
  
  public abstract Logger getLogger(String paramString);
  
  public abstract void ignore(Throwable paramThrowable);
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.util.log.Logger
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.util.ssl;

import java.net.Socket;
import java.security.Principal;
import java.security.PrivateK
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd