com.crashlytics.tools.android_2.1.0

lic void setPriority(Priority priority) {}
  
  public void setResourceBundle(ResourceBundle bundle) {}
  
  public void warn(Object message) {}
  
  public void warn(Object message, Throwable t) {}
  
  public void trace(Object message) {}
  
  public void trace(Object message, Throwable t) {}
  
  public boolean isTraceEnabled()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.NOPLogger
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

import java.util.Enumeration;
import java.util.Vector;
import org.apache.log4j.Appender;
import org.apache.log4j.Category;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

public final class NOPLoggerRepository
  implements LoggerRepository
{
  public void addHierarchyEventListener(HierarchyEventListener listener) {}
  
  public boolean isDisabled(int level)
  {
    return true;
  }
  
  public void setThreshold(Level level) {}
  
  public void setThreshold(String val) {}
  
  public void emitNoAppenderWarning(Category cat) {}
  
  public Level getThreshold()
  {
    return Level.OFF;
  }
  
  public Logger getLogger(String name)
  {
    return new NOPLogger(this, name);
  }
  
  public Logger getLogger(String name, LoggerFactory factory)
  {
    return new NOPLogger(this, name);
  }
  
  public Logger getRootLogger()
  {
    return new NOPLogger(this, "root");
  }
  
  public Logger exists(String name)
  {
    return null;
  }
  
  public void shutdown() {}
  
  public Enumeration getCurrentLoggers()
  {
    return new Vector().elements();
  }
  
  public Enumeration getCurrentCategories()
  {
    return getCurrentLoggers();
  }
  
  public void fireAddAppenderEvent(Category logger, Appender appender) {}
  
  public void resetConfiguration() {}
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.NOPLoggerRepository
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

import java.io.Writer;

/**
 * @deprecated
 */
class NullWriter
  extends Writer
{
  public void close() {}
  
  public void flush() {}
  
  public void write(char[] cbuf, int off, int len) {}
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.NullWriter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

public abstract interface OptionHandler
{
  public abstract void activateOptions();
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.OptionHandler
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

import org.apache.log4j.or.ObjectRenderer;
import org.apache.log4j.or.RendererMap;

public abstract interface RendererSupport
{
  public abstract RendererMap getRendererMap();
  
  public abstract void setRenderer(Class paramClass, ObjectRenderer paramObjectRenderer);
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.RendererSupport
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

public abstract interface RepositorySelector
{
  public abstract LoggerRepository getLoggerRepository();
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.RepositorySelector
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.helpers.LogLog;

/**
 * @deprecated
 */
public final class RootCategory
  extends Logger
{
  public RootCategory(Level level)
  {
    super("root");
    setLevel(level);
  }
  
  public final Level getChainedLevel()
  {
    return level;
  }
  
  public final void setLevel(Level level)
  {
    if (level == null) {
      LogLog.error("You have tried to set a null level to root.", new Throwable());
    } else {
      this.level = level;
    }
  }
  
  public final void setPriority(Level level)
  {
    setLevel(level);
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.RootCategory
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.helpers.LogLog;

public final class RootLogger
  extends Logger
{
  public RootLogger(Level level)
  {
    super("root");
    setLevel(level);
  }
  
  public final Level getChainedLevel()
  {
    return level;
  }
  
  public final void setLevel(Level level)
  {
    if (level == null) {
      LogLog.error("You have tried to set a null level to root.", new Throwable());
    } else {
      this.level = level;
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.RootLogger
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

import java.io.Serializable;
import org.apache.log4j.Category;
import org.apache.log4j.DefaultThrowableRenderer;

public class ThrowableInformation
  implements Serializable
{
  static final long serialVersionUID = -4748765566864322735L;
  private transient Throwable throwable;
  private transient Category category;
  private String[] rep;
  
  public ThrowableInformation(Throwable throwable)
  {
    this.throwable = throwable;
  }
  
  public ThrowableInformation(Throwable throwable, Category category)
  {
    this.throwable = throwable;
    this.category = category;
  }
  
  public ThrowableInformation(String[] r)
  {
    if (r != null) {
      rep = ((String[])r.clone());
    }
  }
  
  public Throwable getThrowable()
  {
    return throwable;
  }
  
  public synchronized String[] getThrowableStrRep()
  {
    if (rep == null)
    {
      ThrowableRenderer renderer = null;
      if (category != null)
      {
        LoggerRepository repo = category.getLoggerRepository();
        if ((repo instanceof ThrowableRendererSupport)) {
          renderer = ((ThrowableRendererSupport)repo).getThrowableRenderer();
        }
      }
      if (renderer == null) {
        rep = DefaultThrowableRenderer.render(throwable);
      } else {
        rep = renderer.doRender(throwable);
      }
    }
    return (String[])rep.clone();
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.ThrowableInformation
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

public abstract interface ThrowableRenderer
{
  public abstract String[] doRender(Throwable paramThrowable);
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.ThrowableRenderer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

public abstract interface ThrowableRendererSupport
{
  public abstract ThrowableRenderer getThrowableRenderer();
  
  public abstract void setThrowableRenderer(ThrowableRenderer paramThrowableRenderer);
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.ThrowableRendererSupport
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

public abstract interface TriggeringEventEvaluator
{
  public abstract boolean isTriggeringEvent(LoggingEvent paramLoggingEvent);
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.TriggeringEventEvaluator
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.spi;

import java.io.PrintWriter;
import java.util.Vector;

/**
 * @deprecated
 */
class VectorWriter
  extends PrintWriter
{
  private Vector v;
  
  /**
   * @deprecated
   */
  VectorWriter()
  {
    super(new NullWriter());
    v = new Vector();
  }
  
  public void print(Object o)
  {
    v.addElement(String.valueOf(o));
  }
  
  public void print(char[] chars)
  {
    v.addElement(new String(chars));
  }
  
  public void print(String s)
  {
    v.addElement(s);
  }
  
  public void println(Object o)
  {
    v.addElement(String.valueOf(o));
  }
  
  public void println(char[] chars)
  {
    v.addElement(new String(chars));
  }
  
  public void println(String s)
  {
    v.addElement(s);
  }
  
  public void write(char[] chars)
  {
    v.addElement(new String(chars));
  }
  
  public void write(char[] chars, int off, int len)
  {
    v.addElement(new String(chars, off, len));
  }
  
  public void write(String s, int off, int len)
  {
    v.addElement(s.substring(off, off + len));
  }
  
  public void write(String s)
  {
    v.addElement(s);
  }
  
  public String[] toStringArray()
  {
    int len = v.size();
    String[] sa = new String[len];
    for (int i = 0; i < len; i++) {
      sa[i] = ((String)v.elementAt(i));
    }
    return sa;
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.spi.VectorWriter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggingEvent;

public class DenyAllFilter
  extends Filter
{
  /**
   * @deprecated
   */
  public String[] getOptionStrings()
  {
    return null;
  }
  
  /**
   * @deprecated
   */
  public void setOption(String key, String value) {}
  
  public int decide(LoggingEvent event)
  {
    return -1;
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.DenyAllFilter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import org.apache.log4j.RollingFileAppender;

public class ExternallyRolledFileAppender
  extends RollingFileAppender
{
  public static final String ROLL_OVER = "RollOver";
  public static final String OK = "OK";
  int port = 0;
  HUP hup;
  
  public void setPort(int port)
  {
    this.port = port;
  }
  
  public int getPort()
  {
    return port;
  }
  
  public void activateOptions()
  {
    super.activateOptions();
    if (port != 0)
    {
      if (hup != null) {
        hup.interrupt();
      }
      hup = new HUP(this, port);
      hup.setDaemon(true);
      hup.start();
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.ExternallyRolledFileAppender
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import java.io.InterruptedIOException;
import java.util.Vector;
import org.apache.log4j.Appender;
import org.apache.log4j.Logger;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.spi.ErrorHandler;
import org.apache.log4j.spi.LoggingEvent;

public class FallbackErrorHandler
  implements ErrorHandler
{
  Appender backup;
  Appender primary;
  Vector loggers;
  
  public void setLogger(Logger logger)
  {
    LogLog.debug("FB: Adding logger [" + logger.getName() + "].");
    if (loggers == null) {
      loggers = new Vector();
    }
    loggers.addElement(logger);
  }
  
  public void activateOptions() {}
  
  public void error(String message, Exception e, int errorCode)
  {
    error(message, e, errorCode, null);
  }
  
  public void error(String message, Exception e, int errorCode, LoggingEvent event)
  {
    if ((e instanceof InterruptedIOException)) {
      Thread.currentThread().interrupt();
    }
    LogLog.debug("FB: The following error reported: " + message, e);
    LogLog.debug("FB: INITIATING FALLBACK PROCEDURE.");
    if (loggers != null) {
      for (int i = 0; i < loggers.size(); i++)
      {
        Logger l = (Logger)loggers.elementAt(i);
        LogLog.debug("FB: Searching for [" + primary.getName() + "] in logger [" + l.getName() + "].");
        
        LogLog.debug("FB: Replacing [" + primary.getName() + "] by [" + backup.getName() + "] in logger [" + l.getName() + "].");
        
        l.removeAppender(primary);
        LogLog.debug("FB: Adding appender [" + backup.getName() + "] to logger " + l.getName());
        
        l.addAppender(backup);
      }
    }
  }
  
  public void error(String message) {}
  
  public void setAppender(Appender primary)
  {
    LogLog.debug("FB: Setting primary appender to [" + primary.getName() + "].");
    this.primary = primary;
  }
  
  public void setBackupAppender(Appender backup)
  {
    LogLog.debug("FB: Setting backup appender to [" + backup.getName() + "].");
    this.backup = backup;
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.FallbackErrorHandler
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.ServerSocket;
import java.net.Socket;
import org.apache.log4j.helpers.LogLog;

class HUP
  extends Thread
{
  int port;
  ExternallyRolledFileAppender er;
  
  HUP(ExternallyRolledFileAppender er, int port)
  {
    this.er = er;
    this.port = port;
  }
  
  public void run()
  {
    while (!isInterrupted()) {
      try
      {
        ServerSocket serverSocket = new ServerSocket(port);
        for (;;)
        {
          Socket socket = serverSocket.accept();
          LogLog.debug("Connected to client at " + socket.getInetAddress());
          new Thread(new HUPNode(socket, er), "ExternallyRolledFileAppender-HUP").start();
        }
      }
      catch (InterruptedIOException e)
      {
        Thread.currentThread().interrupt();
        e.printStackTrace();
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
      catch (RuntimeException e)
      {
        e.printStackTrace();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.HUP
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.Socket;
import org.apache.log4j.helpers.LogLog;

class HUPNode
  implements Runnable
{
  Socket socket;
  DataInputStream dis;
  DataOutputStream dos;
  ExternallyRolledFileAppender er;
  
  public HUPNode(Socket socket, ExternallyRolledFileAppender er)
  {
    this.socket = socket;
    this.er = er;
    try
    {
      dis = new DataInputStream(socket.getInputStream());
      dos = new DataOutputStream(socket.getOutputStream());
    }
    catch (InterruptedIOException e)
    {
      Thread.currentThread().interrupt();
      e.printStackTrace();
    }
    catch (IOException e)
    {
      e.printStackTrace();
    }
    catch (RuntimeException e)
    {
      e.printStackTrace();
    }
  }
  
  public void run()
  {
    try
    {
      String line = dis.readUTF();
      LogLog.debug("Got external roll over signal.");
      if ("RollOver".equals(line))
      {
        synchronized (er)
        {
          er.rollOver();
        }
        dos.writeUTF("OK");
      }
      else
      {
        dos.writeUTF("Expecting [RollOver] string.");
      }
      dos.close();
    }
    catch (InterruptedIOException e)
    {
      Thread.currentThread().interrupt();
      LogLog.error("Unexpected exception. Exiting HUPNode.", e);
    }
    catch (IOException e)
    {
      LogLog.error("Unexpected exception. Exiting HUPNode.", e);
    }
    catch (RuntimeException e)
    {
      LogLog.error("Unexpected exception. Exiting HUPNode.", e);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.HUPNode
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import org.apache.log4j.Level;
import org.apache.log4j.helpers.OptionConverter;
import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggingEvent;

public class LevelMatchFilter
  extends Filter
{
  boolean acceptOnMatch = true;
  Level levelToMatch;
  
  public void setLevelToMatch(String level)
  {
    levelToMatch = OptionConverter.toLevel(level, null);
  }
  
  public String getLevelToMatch()
  {
    return levelToMatch == null ? null : levelToMatch.toString();
  }
  
  public void setAcceptOnMatch(boolean acceptOnMatch)
  {
    this.acceptOnMatch = acceptOnMatch;
  }
  
  public boolean getAcceptOnMatch()
  {
    return acceptOnMatch;
  }
  
  public int decide(LoggingEvent event)
  {
    if (levelToMatch == null) {
      return 0;
    }
    boolean matchOccured = false;
    if (levelToMatch.equals(event.getLevel())) {
      matchOccured = true;
    }
    if (matchOccured)
    {
      if (acceptOnMatch) {
        return 1;
      }
      return -1;
    }
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.LevelMatchFilter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import org.apache.log4j.Level;
import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggingEvent;

public class LevelRangeFilter
  extends Filter
{
  boolean acceptOnMatch = false;
  Level levelMin;
  Level levelMax;
  
  public int decide(LoggingEvent event)
  {
    if ((levelMin != null) && 
      (!event.getLevel().isGreaterOrEqual(levelMin))) {
      return -1;
    }
    if ((levelMax != null) && 
      (event.getLevel().toInt() > levelMax.toInt())) {
      return -1;
    }
    if (acceptOnMatch) {
      return 1;
    }
    return 0;
  }
  
  public Level getLevelMax()
  {
    return levelMax;
  }
  
  public Level getLevelMin()
  {
    return levelMin;
  }
  
  public boolean getAcceptOnMatch()
  {
    return acceptOnMatch;
  }
  
  public void setLevelMax(Level levelMax)
  {
    this.levelMax = levelMax;
  }
  
  public void setLevelMin(Level levelMin)
  {
    this.levelMin = levelMin;
  }
  
  public void setAcceptOnMatch(boolean acceptOnMatch)
  {
    this.acceptOnMatch = acceptOnMatch;
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.LevelRangeFilter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;

public class NullAppender
  extends AppenderSkeleton
{
  private static NullAppender instance = new NullAppender();
  
  public void activateOptions() {}
  
  /**
   * @deprecated
   */
  public NullAppender getInstance()
  {
    return instance;
  }
  
  public static NullAppender getNullAppender()
  {
    return instance;
  }
  
  public void close() {}
  
  public void doAppend(LoggingEvent event) {}
  
  protected void append(LoggingEvent event) {}
  
  public boolean requiresLayout()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.NullAppender
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import java.io.InputStream;
import java.net.URL;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.spi.Configurator;
import org.apache.log4j.spi.LoggerRepository;

public class ReloadingPropertyConfigurator
  implements Configurator
{
  PropertyConfigurator delegate = new PropertyConfigurator();
  
  public void doConfigure(InputStream inputStream, LoggerRepository repository) {}
  
  public void doConfigure(URL url, LoggerRepository repository) {}
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.ReloadingPropertyConfigurator
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

public class Roller
{
  static Logger cat = Logger.getLogger(Roller.class);
  static String host;
  static int port;
  
  public static void main(String[] argv)
  {
    
    if (argv.length == 2) {
      init(argv[0], argv[1]);
    } else {
      usage("Wrong number of arguments.");
    }
    roll();
  }
  
  static void usage(String msg)
  {
    System.err.println(msg);
    System.err.println("Usage: java " + Roller.class.getName() + "host_name port_number");
    
    System.exit(1);
  }
  
  static void init(String hostArg, String portArg)
  {
    host = hostArg;
    try
    {
      port = Integer.parseInt(portArg);
    }
    catch (NumberFormatException e)
    {
      usage("Second argument " + portArg + " is not a valid integer.");
    }
  }
  
  static void roll()
  {
    try
    {
      Socket socket = new Socket(host, port);
      DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
      DataInputStream dis = new DataInputStream(socket.getInputStream());
      dos.writeUTF("RollOver");
      String rc = dis.readUTF();
      if ("OK".equals(rc))
      {
        cat.info("Roll over signal acknowledged by remote appender.");
      }
      else
      {
        cat.warn("Unexpected return code " + rc + " from remote entity.");
        System.exit(2);
      }
    }
    catch (IOException e)
    {
      cat.error("Could not send roll signal on host " + host + " port " + port + " .", e);
      
      System.exit(2);
    }
    System.exit(0);
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.Roller
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.varia;

import org.apache.log4j.helpers.OptionConverter;
import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggingEvent;

public class StringMatchFilter
  extends Filter
{
  /**
   * @deprecated
   */
  public static final String STRING_TO_MATCH_OPTION = "StringToMatch";
  /**
   * @deprecated
   */
  public static final String ACCEPT_ON_MATCH_OPTION = "AcceptOnMatch";
  boolean acceptOnMatch = true;
  String stringToMatch;
  
  /**
   * @deprecated
   */
  public String[] getOptionStrings()
  {
    return new String[] { "StringToMatch", "AcceptOnMatch" };
  }
  
  /**
   * @deprecated
   */
  public void setOption(String key, String value)
  {
    if (key.equalsIgnoreCase("StringToMatch")) {
      stringToMatch = value;
    } else if (key.equalsIgnoreCase("AcceptOnMatch")) {
      acceptOnMatch = OptionConverter.toBoolean(value, acceptOnMatch);
    }
  }
  
  public void setStringToMatch(String s)
  {
    stringToMatch = s;
  }
  
  public String getStringToMatch()
  {
    return stringToMatch;
  }
  
  public void setAcceptOnMatch(boolean acceptOnMatch)
  {
    this.acceptOnMatch = acceptOnMatch;
  }
  
  public boolean getAcceptOnMatch()
  {
    return acceptOnMatch;
  }
  
  public int decide(LoggingEvent event)
  {
    String msg = event.getRenderedMessage();
    if ((msg == null) || (stringToMatch == null)) {
      return 0;
    }
    if (msg.indexOf(stringToMatch) == -1) {
      return 0;
    }
    if (acceptOnMatch) {
      return 1;
    }
    return -1;
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.varia.StringMatchFilter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.xml;

import java.io.File;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

class DOMConfigurator$1
  implements DOMConfigurator.ParseAction
{
  private final DOMConfigurator this$0;
  
  DOMConfigurator$1(DOMConfigurator paramDOMConfigurator, String paramString) {}
  
  public Document parse(DocumentBuilder parser)
    throws SAXException, IOException
  {
    return parser.parse(new File(val$filename));
  }
  
  public String toString()
  {
    return "file [" + val$filename + "]";
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.xml.DOMConfigurator.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.xml;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

class DOMConfigurator$2
  implements DOMConfigurator.ParseAction
{
  private final DOMConfigurator this$0;
  
  DOMConfigurator$2(DOMConfigurator paramDOMConfigurator, URL paramURL) {}
  
  public Document parse(DocumentBuilder parser)
    throws SAXException, IOException
  {
    URLConnection uConn = val$url.openConnection();
    uConn.setUseCaches(false);
    InputStream stream = uConn.getInputStream();
    try
    {
      InputSource src = new InputSource(stream);
      src.setSystemId(val$url.toString());
      return parser.parse(src);
    }
    finally
    {
      stream.close();
    }
  }
  
  public String toString()
  {
    return "url [" + val$url.toString() + "]";
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.xml.DOMConfigurator.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.xml;

import java.io.IOException;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

class DOMConfigurator$3
  implements DOMConfigurator.ParseAction
{
  private final DOMConfigurator this$0;
  
  DOMConfigurator$3(DOMConfigurator paramDOMConfigurator, InputStream paramInputStream) {}
  
  public Document parse(DocumentBuilder parser)
    throws SAXException, IOException
  {
    InputSource inputSource = new InputSource(val$inputStream);
    inputSource.setSystemId("dummy://log4j.dtd");
    return parser.parse(inputSource);
  }
  
  public String toString()
  {
    return "input stream [" + val$inputStream.toString() + "]";
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.xml.DOMConfigurator.3
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.xml;

import java.io.IOException;
import java.io.Reader;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

class DOMConfigurator$4
  implements DOMConfigurator.ParseAction
{
  private final DOMConfigurator this$0;
  
  DOMConfigurator$4(DOMConfigurator paramDOMConfigurator, Reader paramReader) {}
  
  public Document parse(DocumentBuilder parser)
    throws SAXException, IOException
  {
    InputSource inputSource = new InputSource(val$reader);
    inputSource.setSystemId("dummy://log4j.dtd");
    return parser.parse(inputSource);
  }
  
  public String toString()
  {
    return "reader [" + val$reader.toString() + "]";
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.xml.DOMConfigurator.4
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.xml;

import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

class DOMConfigurator$5
  implements DOMConfigurator.ParseAction
{
  private final DOMConfigurator this$0;
  
  DOMConfigurator$5(DOMConfigurator paramDOMConfigurator, InputSource paramInputSource) {}
  
  public Document parse(DocumentBuilder parser)
    throws SAXException, IOException
  {
    return parser.parse(val$inputSource);
  }
  
  public String toString()
  {
    return "input source [" + val$inputSource.toString() + "]";
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.xml.DOMConfigurator.5
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.xml;

import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

abstract interface DOMConfigurator$ParseAction
{
  public abstract Document parse(DocumentBuilder paramDocumentBuilder)
    throws SAXException, IOException;
}

/* Location:
 * Qualified Name:     org.apache.log4j.xml.DOMConfigurator.ParseAction
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.xml;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLConnection;
import java.util.Hashtable;
import java.util.Properties;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import org.apache.log4j.Appender;
import org.apache.log4j.Layout;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.config.PropertySetter;
import org.apache.log4j.helpers.Loader;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.helpers.OptionConverter;
import org.apache.log4j.or.RendererMap;
import org.apache.log4j.spi.AppenderAttachable;
import org.apache.log4j.spi.Configurator;
import org.apache.log4j.spi.ErrorHandler;
import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggerFactory;
import org.apache.log4j.spi.LoggerRepository;
import org.apache.log4j.spi.RendererSupport;
import org.apache.log4j.spi.ThrowableRenderer;
import org.apache.log4j.spi.ThrowableRendererSupport;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class DOMConfigurator
  implements Configurator
{
  static final String CONFIGURATION_TAG = "log4j:configuration";
  static final String OLD_CONFIGURATION_TAG = "configuration";
  static final String RENDERER_TAG = "renderer";
  private static final String THROWABLE_RENDERER_TAG = "throwableRenderer";
  static final String APPENDER_TAG = "appender";
  static final String APPENDER_REF_TAG = "appender-ref";
  static final String PARAM_TAG = "param";
  static final String LAYOUT_TAG = "layout";
  static final String CATEGORY = "category";
  static final String LOGGER = "logger";
  static final String LOGGER_REF = "logger-ref";
  static final String CATEGORY_FACTORY_TAG = "categoryFactory";
  static final String LOGGER_FACTORY_TAG = "loggerFactory";
  static final String NAME_ATTR = "name";
  static final String CLASS_ATTR = "class";
  static final String VALUE_ATTR = "value";
  static final String ROOT_TAG = "root";
  static final String ROOT_REF = "root-ref";
  static final String LEVEL_TAG = "level";
  static final String PRIORITY_TAG = "priority";
  static final String FILTER_TAG = "filter";
  static final String ERROR_HANDLER_TAG = "errorHandler";
  static final String REF_ATTR = "ref";
  static final String ADDITIVITY_ATTR = "additivity";
  static final String THRESHOLD_ATTR = "threshold";
  static final String CONFIG_DEBUG_ATTR = "configDebug";
  static final String INTERNAL_DEBUG_ATTR = "debug";
  private static final String RESET_ATTR = "reset";
  static final String RENDERING_CLASS_ATTR = "renderingClass";
  static final String RENDERED_CLASS_ATTR = "renderedClass";
  static final String EMPTY_STR = "";
  static final Class[] ONE_STRING_PARAM = { String.class };
  static final String dbfKey = "javax.xml.parsers.DocumentBuilderFactory";
  Hashtable appenderBag;
  Properties props;
  LoggerRepository repository;
  protected LoggerFactory catFactory = null;
  
  public DOMConfigurator()
  {
    appenderBag = new Hashtable();
  }
  
  protected Appender findAppenderByName(Document doc, String appenderName)
  {
    Appender appender = (Appender)appenderBag.get(appenderName);
    if (appender != null) {
      return appender;
    }
    Element element = null;
    NodeList list = doc.getElementsByTagName("appender");
    for (int t = 0; t < list.getLength(); t++)
    {
      Node node = list.item(t);
      NamedNodeMap map = node.getAttributes();
      Node attrNode = map.getNamedItem("name");
      if (appenderName.equals(attrNode.getNodeValue()))
      {
        element = (Element)node;
        break;
      }
    }
    if (element == null)
    {
      LogLog.error("No appender named [" + appenderName + "] could be found.");
      return null;
    }
    appender = parseAppender(element);
    if (appender != null) {
      appenderBag.put(appenderName, appender);
    }
    return appender;
  }
  
  protected Appender findAppenderByReference(Element appenderRef)
  {
    String appenderName = subst(appenderRef.getAttribute("ref"));
    Document doc = appenderRef.getOwnerDocument();
    return findAppenderByName(doc, appenderName);
  }
  
  private static void parseUnrecognizedElement(Object instance, Element element, Properties props)
    throws Exception
  {
    boolean recognized = false;
    if ((instance instanceof UnrecognizedElementHandler)) {
      recognized = ((UnrecognizedElementHandler)instance).parseUnrecognizedElement(element, props);
    }
    if (!recognized) {
      LogLog.warn("Unrecognized element " + element.getNodeName());
    }
  }
  
  private static void quietParseUnrecognizedElement(Object instance, Element element, Properties props)
  {
    try
    {
      parseUnrecognizedElement(instance, element, props);
    }
    catch (Exception ex)
    {
      if (((ex instanceof InterruptedException)) || ((ex instanceof InterruptedIOException))) {
        Thread.currentThread().interrupt();
      }
      LogLog.error("Error in extension content: ", ex);
    }
  }
  
  protected Appender parseAppender(Element appenderElement)
  {
    String className = subst(appenderElement.getAttribute("class"));
    LogLog.debug("Class name: [" + className + ']');
    try
    {
      Object instance = Loader.loadClass(className).newInstance();
      Appender appender = (Appender)instance;
      PropertySetter propSetter = new PropertySetter(appender);
      
      appender.setName(subst(appenderElement.getAttribute("name")));
      
      NodeList children = appenderElement.getChildNodes();
      int length = children.getLength();
      for (int loop = 0; loop < length; loop++)
      {
        Node currentNode = children.item(loop);
        if (currentNode.getNodeType() == 1)
        {
          Element currentElement = (Element)currentNode;
          if (currentElement.getTagName().equals("param"))
          {
            setParameter(currentElement, propSetter);
          }
          else if (currentElement.getTagName().equals("layout"))
          {
            appender.setLayout(parseLayout(currentElement));
          }
          else if (currentElement.getTagName().equals("filter"))
          {
            parseFilters(currentElement, appender);
          }
          else if (currentElement.getTagName().equals("errorHandler"))
          {
            parseErrorHandler(currentElement, appender);
          }
          else if (currentElement.getTagName().equals("appender-ref"))
          {
            String refName = subst(currentElement.getAttribute("ref"));
            if ((appender instanceof AppenderAttachable))
            {
              AppenderAttachable aa = (AppenderAttachable)appender;
              LogLog.debug("Attaching appender named [" + refName + "] to appender named [" + appender.getName() + "].");
              
              aa.addAppender(findAppenderByReference(currentElement));
            }
            else
            {
              LogLog.error("Requesting attachment of appender named [" + refName + "] to appender named [" + appender.getName() + "] which does not implement org.apache.log4j.spi.AppenderAttachable.");
            }
          }
          else
          {
            parseUnrecognizedElement(instance, currentElement, props);
          }
        }
      }
      propSetter.activate();
      return appender;
    }
    catch (Exception oops)
    {
      if (((oops instanceof InterruptedException)) || ((oops instanceof InterruptedIOException))) {
        Thread.currentThread().interrupt();
      }
      LogLog.error("Could not create an Appender. Reported error follows.", oops);
    }
    return null;
  }
  
  protected void parseErrorHandler(Element element, Appender appender)
  {
    ErrorHandler eh = (ErrorHandler)OptionConverter.instantiateByClassName(subst(element.getAttribute("class")), ErrorHandler.class, null);
    if (eh != null)
    {
      eh.setAppender(appender);
      
      PropertySetter propSetter = new PropertySetter(eh);
      NodeList children = element.getChildNodes();
      int length = children.getLength();
      for (int loop = 0; loop < length; loop++)
      {
        Node currentNode = children.item(loop);
        if (currentNode.getNodeType() == 1)
        {
          Element currentElement = (Element)currentNode;
          String tagName = currentElement.getTagName();
          if (tagName.equals("param"))
          {
            setParameter(currentElement, propSetter);
          }
          else if (tagName.equals("appender-ref"))
          {
            eh.setBackupAppender(findAppenderByReference(currentElement));
          }
          else if (tagName.equals("logger-ref"))
          {
            String loggerName = currentElement.getAttribute("ref");
            Logger logger = catFactory == null ? repository.getLogger(loggerName) : repository.getLogger(loggerName, catFactory);
            
            eh.setLogger(logger);
          }
          else if (tagName.equals("root-ref"))
          {
            Logger root = repository.getRootLogger();
            eh.setLogger(root);
          }
          else
          {
            quietParseUnrecognizedElement(eh, currentElement, props);
          }
        }
      }
      propSetter.activate();
      appender.setErrorHandler(eh);
    }
  }
  
  protected void parseFilters(Element element, Appender appender)
  {
    String clazz = subst(element.getAttribute("class"));
    Filter filter = (Filter)OptionConverter.instantiateByClassName(clazz, Filter.class, null);
    if (filter != null)
    {
      PropertySetter propSetter = new PropertySetter(filter);
      NodeList children = element.getChildNodes();
      int length = children.getLength();
      for (int loop = 0; loop < length; loop++)
      {
        Node currentNode = children.item(loop);
        if (currentNode.getNodeType() == 1)
        {
          Element currentElement = (Element)currentNode;
          String tagName = currentElement.getTagName();
          if (tagName.equals("param")) {
            setParameter(currentElement, propSetter);
          } else {
            quietParseUnrecognizedElement(filter, currentElement, props);
          }
        }
      }
      propSetter.activate();
      LogLog.debug("Adding filter of type [" + filter.getClass() + "] to appender named [" + appender.getName() + "].");
      
      appender.addFilter(filter);
    }
  }
  
  protected void parseCategory(Element loggerElement)
  {
    String catName = subst(loggerElement.getAttribute("name"));
    
    String className = subst(loggerElement.getAttribute("class"));
    Logger cat;
    Logger cat;
    if ("".equals(className))
    {
      LogLog.debug("Retreiving an instance of org.apache.log4j.Logger.");
      cat = catFactory == null ? repository.getLogger(catName) : repository.getLogger(catName, catFactory);
    }
    else
    {
      LogLog.debug("Desired logger sub-class: [" + className + ']');
      try
      {
        Class clazz = Loader.loadClass(className);
        Method getInstanceMethod = clazz.getMethod("getLogger", ONE_STRING_PARAM);
        
        cat = (Logger)getInstanceMethod.invoke(null, new Object[] { catName });
      }
      catch (InvocationTargetException oops)
      {
        if (((oops.getTargetException() instanceof InterruptedException)) || ((oops.getTargetException() instanceof InterruptedIOException))) {
          Thread.currentThread().interrupt();
        }
        LogLog.error("Could not retrieve category [" + catName + "]. Reported error follows.", oops);
        
        return;
      }
      catch (Exception oops)
      {
        LogLog.error("Could not retrieve category [" + catName + "]. Reported error follows.", oops);
        
        return;
      }
    }
    synchronized (cat)
    {
      boolean additivity = OptionConverter.toBoolean(subst(loggerElement.getAttribute("additivity")), true);
      
      LogLog.debug("Setting [" + cat.getName() + "] additivity to [" + additivity + "].");
      cat.setAdditivity(additivity);
      parseChildrenOfLoggerElement(loggerElement, ca
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

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-2019. Infinite Loop Ltd