com.crashlytics.tools.android_2.1.0

Log;

public class ZeroConfSupport
{
  private static Object jmDNS = ;
  Object serviceInfo;
  private static Class jmDNSClass;
  private static Class serviceInfoClass;
  
  public ZeroConfSupport(String zone, int port, String name, Map properties)
  {
    boolean isVersion3 = false;
    try
    {
      jmDNSClass.getMethod("create", null);
      isVersion3 = true;
    }
    catch (NoSuchMethodException e) {}
    if (isVersion3)
    {
      LogLog.debug("using JmDNS version 3 to construct serviceInfo instance");
      serviceInfo = buildServiceInfoVersion3(zone, port, name, properties);
    }
    else
    {
      LogLog.debug("using JmDNS version 1.0 to construct serviceInfo instance");
      serviceInfo = buildServiceInfoVersion1(zone, port, name, properties);
    }
  }
  
  public ZeroConfSupport(String zone, int port, String name)
  {
    this(zone, port, name, new HashMap());
  }
  
  private static Object createJmDNSVersion1()
  {
    try
    {
      return jmDNSClass.newInstance();
    }
    catch (InstantiationException e)
    {
      LogLog.warn("Unable to instantiate JMDNS", e);
    }
    catch (IllegalAccessException e)
    {
      LogLog.warn("Unable to instantiate JMDNS", e);
    }
    return null;
  }
  
  private static Object createJmDNSVersion3()
  {
    try
    {
      Method jmDNSCreateMethod = jmDNSClass.getMethod("create", null);
      return jmDNSCreateMethod.invoke(null, null);
    }
    catch (IllegalAccessException e)
    {
      LogLog.warn("Unable to instantiate jmdns class", e);
    }
    catch (NoSuchMethodException e)
    {
      LogLog.warn("Unable to access constructor", e);
    }
    catch (InvocationTargetException e)
    {
      LogLog.warn("Unable to call constructor", e);
    }
    return null;
  }
  
  private Object buildServiceInfoVersion1(String zone, int port, String name, Map properties)
  {
    Hashtable hashtableProperties = new Hashtable(properties);
    try
    {
      Class[] args = new Class[6];
      args[0] = String.class;
      args[1] = String.class;
      args[2] = Integer.TYPE;
      args[3] = Integer.TYPE;
      args[4] = Integer.TYPE;
      args[5] = Hashtable.class;
      Constructor constructor = serviceInfoClass.getConstructor(args);
      Object[] values = new Object[6];
      values[0] = zone;
      values[1] = name;
      values[2] = new Integer(port);
      values[3] = new Integer(0);
      values[4] = new Integer(0);
      values[5] = hashtableProperties;
      Object result = constructor.newInstance(values);
      LogLog.debug("created serviceinfo: " + result);
      return result;
    }
    catch (IllegalAccessException e)
    {
      LogLog.warn("Unable to construct ServiceInfo instance", e);
    }
    catch (NoSuchMethodException e)
    {
      LogLog.warn("Unable to get ServiceInfo constructor", e);
    }
    catch (InstantiationException e)
    {
      LogLog.warn("Unable to construct ServiceInfo instance", e);
    }
    catch (InvocationTargetException e)
    {
      LogLog.warn("Unable to construct ServiceInfo instance", e);
    }
    return null;
  }
  
  private Object buildServiceInfoVersion3(String zone, int port, String name, Map properties)
  {
    try
    {
      Class[] args = new Class[6];
      args[0] = String.class;
      args[1] = String.class;
      args[2] = Integer.TYPE;
      args[3] = Integer.TYPE;
      args[4] = Integer.TYPE;
      args[5] = Map.class;
      Method serviceInfoCreateMethod = serviceInfoClass.getMethod("create", args);
      Object[] values = new Object[6];
      values[0] = zone;
      values[1] = name;
      values[2] = new Integer(port);
      values[3] = new Integer(0);
      values[4] = new Integer(0);
      values[5] = properties;
      Object result = serviceInfoCreateMethod.invoke(null, values);
      LogLog.debug("created serviceinfo: " + result);
      return result;
    }
    catch (IllegalAccessException e)
    {
      LogLog.warn("Unable to invoke create method", e);
    }
    catch (NoSuchMethodException e)
    {
      LogLog.warn("Unable to find create method", e);
    }
    catch (InvocationTargetException e)
    {
      LogLog.warn("Unable to invoke create method", e);
    }
    return null;
  }
  
  public void advertise()
  {
    try
    {
      Method method = jmDNSClass.getMethod("registerService", new Class[] { serviceInfoClass });
      method.invoke(jmDNS, new Object[] { serviceInfo });
      LogLog.debug("registered serviceInfo: " + serviceInfo);
    }
    catch (IllegalAccessException e)
    {
      LogLog.warn("Unable to invoke registerService method", e);
    }
    catch (NoSuchMethodException e)
    {
      LogLog.warn("No registerService method", e);
    }
    catch (InvocationTargetException e)
    {
      LogLog.warn("Unable to invoke registerService method", e);
    }
  }
  
  public void unadvertise()
  {
    try
    {
      Method method = jmDNSClass.getMethod("unregisterService", new Class[] { serviceInfoClass });
      method.invoke(jmDNS, new Object[] { serviceInfo });
      LogLog.debug("unregistered serviceInfo: " + serviceInfo);
    }
    catch (IllegalAccessException e)
    {
      LogLog.warn("Unable to invoke unregisterService method", e);
    }
    catch (NoSuchMethodException e)
    {
      LogLog.warn("No unregisterService method", e);
    }
    catch (InvocationTargetException e)
    {
      LogLog.warn("Unable to invoke unregisterService method", e);
    }
  }
  
  private static Object initializeJMDNS()
  {
    try
    {
      jmDNSClass = Class.forName("javax.jmdns.JmDNS");
      serviceInfoClass = Class.forName("javax.jmdns.ServiceInfo");
    }
    catch (ClassNotFoundException e)
    {
      LogLog.warn("JmDNS or serviceInfo class not found", e);
    }
    boolean isVersion3 = false;
    try
    {
      jmDNSClass.getMethod("create", null);
      isVersion3 = true;
    }
    catch (NoSuchMethodException e) {}
    if (isVersion3) {
      return createJmDNSVersion3();
    }
    return createJmDNSVersion1();
  }
  
  public static Object getJMDNSInstance()
  {
    return jmDNS;
  }
}

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

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Layout;
import org.apache.log4j.Level;
import org.apache.log4j.TTCCLayout;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.spi.LoggingEvent;

public class NTEventLogAppender
  extends AppenderSkeleton
{
  private int _handle = 0;
  private String source = null;
  private String server = null;
  
  public NTEventLogAppender()
  {
    this(null, null, null);
  }
  
  public NTEventLogAppender(String source)
  {
    this(null, source, null);
  }
  
  public NTEventLogAppender(String server, String source)
  {
    this(server, source, null);
  }
  
  public NTEventLogAppender(Layout layout)
  {
    this(null, null, layout);
  }
  
  public NTEventLogAppender(String source, Layout layout)
  {
    this(null, source, layout);
  }
  
  public NTEventLogAppender(String server, String source, Layout layout)
  {
    if (source == null) {
      source = "Log4j";
    }
    if (layout == null) {
      this.layout = new TTCCLayout();
    } else {
      this.layout = layout;
    }
    try
    {
      _handle = registerEventSource(server, source);
    }
    catch (Exception e)
    {
      e.printStackTrace();
      _handle = 0;
    }
  }
  
  public void close() {}
  
  public void activateOptions()
  {
    if (source != null) {
      try
      {
        _handle = registerEventSource(server, source);
      }
      catch (Exception e)
      {
        LogLog.error("Could not register event source.", e);
        _handle = 0;
      }
    }
  }
  
  public void append(LoggingEvent event)
  {
    StringBuffer sbuf = new StringBuffer();
    
    sbuf.append(layout.format(event));
    if (layout.ignoresThrowable())
    {
      String[] s = event.getThrowableStrRep();
      if (s != null)
      {
        int len = s.length;
        for (int i = 0; i < len; i++) {
          sbuf.append(s[i]);
        }
      }
    }
    int nt_category = event.getLevel().toInt();
    
    reportEvent(_handle, sbuf.toString(), nt_category);
  }
  
  public void finalize()
  {
    deregisterEventSource(_handle);
    _handle = 0;
  }
  
  public void setSource(String source)
  {
    this.source = source.trim();
  }
  
  public String getSource()
  {
    return source;
  }
  
  public boolean requiresLayout()
  {
    return true;
  }
  
  private native int registerEventSource(String paramString1, String paramString2);
  
  private native void reportEvent(int paramInt1, String paramString, int paramInt2);
  
  private native void deregisterEventSource(int paramInt);
  
  static
  {
    String[] archs;
    try
    {
      archs = new String[] { System.getProperty("os.arch") };
    }
    catch (SecurityException e)
    {
      archs = new String[] { "amd64", "ia64", "x86" };
    }
    boolean loaded = false;
    for (int i = 0; i < archs.length; i++) {
      try
      {
        System.loadLibrary("NTEventLogAppender." + archs[i]);
        loaded = true;
      }
      catch (UnsatisfiedLinkError e)
      {
        loaded = false;
      }
    }
    if (!loaded) {
      System.loadLibrary("NTEventLogAppender");
    }
  }
}

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

class DefaultRenderer
  implements ObjectRenderer
{
  public String doRender(Object o)
  {
    try
    {
      return o.toString();
    }
    catch (Exception ex)
    {
      return ex.toString();
    }
  }
}

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

public abstract interface ObjectRenderer
{
  public abstract String doRender(Object paramObject);
}

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

import java.util.Hashtable;
import org.apache.log4j.helpers.Loader;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.helpers.OptionConverter;
import org.apache.log4j.spi.RendererSupport;

public class RendererMap
{
  Hashtable map;
  static ObjectRenderer defaultRenderer = new DefaultRenderer();
  
  public RendererMap()
  {
    map = new Hashtable();
  }
  
  public static void addRenderer(RendererSupport repository, String renderedClassName, String renderingClassName)
  {
    LogLog.debug("Rendering class: [" + renderingClassName + "], Rendered class: [" + renderedClassName + "].");
    
    ObjectRenderer renderer = (ObjectRenderer)OptionConverter.instantiateByClassName(renderingClassName, ObjectRenderer.class, null);
    if (renderer == null)
    {
      LogLog.error("Could not instantiate renderer [" + renderingClassName + "].");
      return;
    }
    try
    {
      Class renderedClass = Loader.loadClass(renderedClassName);
      repository.setRenderer(renderedClass, renderer);
    }
    catch (ClassNotFoundException e)
    {
      LogLog.error("Could not find class [" + renderedClassName + "].", e);
    }
  }
  
  public String findAndRender(Object o)
  {
    if (o == null) {
      return null;
    }
    return get(o.getClass()).doRender(o);
  }
  
  public ObjectRenderer get(Object o)
  {
    if (o == null) {
      return null;
    }
    return get(o.getClass());
  }
  
  public ObjectRenderer get(Class clazz)
  {
    ObjectRenderer r = null;
    for (Class c = clazz; c != null; c = c.getSuperclass())
    {
      r = (ObjectRenderer)map.get(c);
      if (r != null) {
        return r;
      }
      r = searchInterfaces(c);
      if (r != null) {
        return r;
      }
    }
    return defaultRenderer;
  }
  
  ObjectRenderer searchInterfaces(Class c)
  {
    ObjectRenderer r = (ObjectRenderer)map.get(c);
    if (r != null) {
      return r;
    }
    Class[] ia = c.getInterfaces();
    for (int i = 0; i < ia.length; i++)
    {
      r = searchInterfaces(ia[i]);
      if (r != null) {
        return r;
      }
    }
    return null;
  }
  
  public ObjectRenderer getDefaultRenderer()
  {
    return defaultRenderer;
  }
  
  public void clear()
  {
    map.clear();
  }
  
  public void put(Class clazz, ObjectRenderer or)
  {
    map.put(clazz, or);
  }
}

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

import org.apache.log4j.Layout;

public class ThreadGroupRenderer
  implements ObjectRenderer
{
  public String doRender(Object o)
  {
    if ((o instanceof ThreadGroup))
    {
      StringBuffer sbuf = new StringBuffer();
      ThreadGroup tg = (ThreadGroup)o;
      sbuf.append("java.lang.ThreadGroup[name=");
      sbuf.append(tg.getName());
      sbuf.append(", maxpri=");
      sbuf.append(tg.getMaxPriority());
      sbuf.append("]");
      Thread[] t = new Thread[tg.activeCount()];
      tg.enumerate(t);
      for (int i = 0; i < t.length; i++)
      {
        sbuf.append(Layout.LINE_SEP);
        sbuf.append("   Thread=[");
        sbuf.append(t[i].getName());
        sbuf.append(",");
        sbuf.append(t[i].getPriority());
        sbuf.append(",");
        sbuf.append(t[i].isDaemon());
        sbuf.append("]");
      }
      return sbuf.toString();
    }
    try
    {
      return o.toString();
    }
    catch (Exception ex)
    {
      return ex.toString();
    }
  }
}

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

import javax.jms.JMSException;
import javax.jms.Message;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.or.ObjectRenderer;

public class MessageRenderer
  implements ObjectRenderer
{
  public String doRender(Object o)
  {
    if ((o instanceof Message))
    {
      StringBuffer sbuf = new StringBuffer();
      Message m = (Message)o;
      try
      {
        sbuf.append("DeliveryMode=");
        switch (m.getJMSDeliveryMode())
        {
        case 1: 
          sbuf.append("NON_PERSISTENT");
          break;
        case 2: 
          sbuf.append("PERSISTENT");
          break;
        default: 
          sbuf.append("UNKNOWN");
        }
        sbuf.append(", CorrelationID=");
        sbuf.append(m.getJMSCorrelationID());
        
        sbuf.append(", Destination=");
        sbuf.append(m.getJMSDestination());
        
        sbuf.append(", Expiration=");
        sbuf.append(m.getJMSExpiration());
        
        sbuf.append(", MessageID=");
        sbuf.append(m.getJMSMessageID());
        
        sbuf.append(", Priority=");
        sbuf.append(m.getJMSPriority());
        
        sbuf.append(", Redelivered=");
        sbuf.append(m.getJMSRedelivered());
        
        sbuf.append(", ReplyTo=");
        sbuf.append(m.getJMSReplyTo());
        
        sbuf.append(", Timestamp=");
        sbuf.append(m.getJMSTimestamp());
        
        sbuf.append(", Type=");
        sbuf.append(m.getJMSType());
      }
      catch (JMSException e)
      {
        LogLog.error("Could not parse Message.", e);
      }
      return sbuf.toString();
    }
    return o.toString();
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.or.jms.MessageRenderer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.or.sax;

import org.apache.log4j.or.ObjectRenderer;
import org.xml.sax.Attributes;

public class AttributesRenderer
  implements ObjectRenderer
{
  public String doRender(Object o)
  {
    if ((o instanceof Attributes))
    {
      StringBuffer sbuf = new StringBuffer();
      Attributes a = (Attributes)o;
      int len = a.getLength();
      boolean first = true;
      for (int i = 0; i < len; i++)
      {
        if (first) {
          first = false;
        } else {
          sbuf.append(", ");
        }
        sbuf.append(a.getQName(i));
        sbuf.append('=');
        sbuf.append(a.getValue(i));
      }
      return sbuf.toString();
    }
    try
    {
      return o.toString();
    }
    catch (Exception ex)
    {
      return ex.toString();
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.log4j.or.sax.AttributesRenderer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.log4j.pattern;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.helpers.PatternConverter;
import org.apache.log4j.spi.LoggingEvent;

public final class BridgePatternConverter
  extends PatternConverter
{
  private LoggingEventPatternConverter[] patternConverters;
  private FormattingInfo[] patternFields;
  private boolean handlesExceptions;
  
  public BridgePatternConverter(String pattern)
  {
    next = null;
    handlesExceptions = false;
    
    List converters = new ArrayList();
    List fields = new ArrayList();
    Map converterRegistry = null;
    
    PatternParser.parse(pattern, converters, fields, converterRegistry, PatternParser.getPatternLayoutRules());
    
    patternConverters = new LoggingEventPatternConverter[converters.size()];
    patternFields = new FormattingInfo[converters.size()];
    
    int i = 0;
    Iterator converterIter = converters.iterator();
    Iterator fieldIter = fields.iterator();
    while (converterIter.hasNext())
    {
      Object converter = converterIter.next();
      if ((converter instanceof LoggingEventPatternConverter))
      {
        patternConverters[i] = ((LoggingEventPatternConverter)converter);
        handlesExceptions |= patternConverters[i].handlesThrowable();
      }
      else
      {
        patternConverters[i] = new LiteralPatternConverter("");
      }
      if (fieldIter.hasNext()) {
        patternFields[i] = ((FormattingInfo)fieldIter.next());
      } else {
        patternFields[i] = FormattingInfo.getDefault();
      }
      i++;
    }
  }
  
  protected String convert(LoggingEvent event)
  {
    StringBuffer sbuf = new StringBuffer();
    format(sbuf, event);
    
    return sbuf.toString();
  }
  
  public void format(StringBuffer sbuf, LoggingEvent e)
  {
    for (int i = 0; i < patternConverters.length; i++)
    {
      int startField = sbuf.length();
      patternConverters[i].format(e, sbuf);
      patternFields[i].format(startField, sbuf);
    }
  }
  
  public boolean ignoresThrowable()
  {
    return !handlesExceptions;
  }
}

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

import org.apache.log4j.helpers.PatternConverter;
import org.apache.log4j.helpers.PatternParser;

public final class BridgePatternParser
  extends PatternParser
{
  public BridgePatternParser(String conversionPattern)
  {
    super(conversionPattern);
  }
  
  public PatternConverter parse()
  {
    return new BridgePatternConverter(pattern);
  }
}

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

import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.NumberFormat;
import java.text.ParsePosition;
import java.util.Date;
import java.util.TimeZone;

public final class CachedDateFormat
  extends DateFormat
{
  private static final long serialVersionUID = 1L;
  public static final int NO_MILLISECONDS = -2;
  private static final String DIGITS = "0123456789";
  public static final int UNRECOGNIZED_MILLISECONDS = -1;
  private static final int MAGIC1 = 654;
  private static final String MAGICSTRING1 = "654";
  private static final int MAGIC2 = 987;
  private static final String MAGICSTRING2 = "987";
  private static final String ZERO_STRING = "000";
  private final DateFormat formatter;
  private int millisecondStart;
  private long slotBegin;
  private StringBuffer cache = new StringBuffer(50);
  private final int expiration;
  private long previousTime;
  private final Date tmpDate = new Date(0L);
  
  public CachedDateFormat(DateFormat dateFormat, int expiration)
  {
    if (dateFormat == null) {
      throw new IllegalArgumentException("dateFormat cannot be null");
    }
    if (expiration < 0) {
      throw new IllegalArgumentException("expiration must be non-negative");
    }
    formatter = dateFormat;
    this.expiration = expiration;
    millisecondStart = 0;
    
    previousTime = Long.MIN_VALUE;
    slotBegin = Long.MIN_VALUE;
  }
  
  public static int findMillisecondStart(long time, String formatted, DateFormat formatter)
  {
    long slotBegin = time / 1000L * 1000L;
    if (slotBegin > time) {
      slotBegin -= 1000L;
    }
    int millis = (int)(time - slotBegin);
    
    int magic = 654;
    String magicString = "654";
    if (millis == 654)
    {
      magic = 987;
      magicString = "987";
    }
    String plusMagic = formatter.format(new Date(slotBegin + magic));
    if (plusMagic.length() != formatted.length()) {
      return -1;
    }
    for (int i = 0; i < formatted.length(); i++) {
      if (formatted.charAt(i) != plusMagic.charAt(i))
      {
        StringBuffer formattedMillis = new StringBuffer("ABC");
        millisecondFormat(millis, formattedMillis, 0);
        
        String plusZero = formatter.format(new Date(slotBegin));
        if ((plusZero.length() == formatted.length()) && (magicString.regionMatches(0, plusMagic, i, magicString.length())) && (formattedMillis.toString().regionMatches(0, formatted, i, magicString.length())) && ("000".regionMatches(0, plusZero, i, "000".length()))) {
          return i;
        }
        return -1;
      }
    }
    return -2;
  }
  
  public StringBuffer format(Date date, StringBuffer sbuf, FieldPosition fieldPosition)
  {
    format(date.getTime(), sbuf);
    
    return sbuf;
  }
  
  public StringBuffer format(long now, StringBuffer buf)
  {
    if (now == previousTime)
    {
      buf.append(cache);
      
      return buf;
    }
    if ((millisecondStart != -1) && (now < slotBegin + expiration) && (now >= slotBegin) && (now < slotBegin + 1000L))
    {
      if (millisecondStart >= 0) {
        millisecondFormat((int)(now - slotBegin), cache, millisecondStart);
      }
      previousTime = now;
      buf.append(cache);
      
      return buf;
    }
    cache.setLength(0);
    tmpDate.setTime(now);
    cache.append(formatter.format(tmpDate));
    buf.append(cache);
    previousTime = now;
    slotBegin = (previousTime / 1000L * 1000L);
    if (slotBegin > previousTime) {
      slotBegin -= 1000L;
    }
    if (millisecondStart >= 0) {
      millisecondStart = findMillisecondStart(now, cache.toString(), formatter);
    }
    return buf;
  }
  
  private static void millisecondFormat(int millis, StringBuffer buf, int offset)
  {
    buf.setCharAt(offset, "0123456789".charAt(millis / 100));
    buf.setCharAt(offset + 1, "0123456789".charAt(millis / 10 % 10));
    buf.setCharAt(offset + 2, "0123456789".charAt(millis % 10));
  }
  
  public void setTimeZone(TimeZone timeZone)
  {
    formatter.setTimeZone(timeZone);
    previousTime = Long.MIN_VALUE;
    slotBegin = Long.MIN_VALUE;
  }
  
  public Date parse(String s, ParsePosition pos)
  {
    return formatter.parse(s, pos);
  }
  
  public NumberFormat getNumberFormat()
  {
    return formatter.getNumberFormat();
  }
  
  public static int getMaximumCacheValidity(String pattern)
  {
    int firstS = pattern.indexOf('S');
    if ((firstS >= 0) && (firstS != pattern.lastIndexOf("SSS"))) {
      return 1;
    }
    return 1000;
  }
}

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

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

public final class ClassNamePatternConverter
  extends NamePatternConverter
{
  private ClassNamePatternConverter(String[] options)
  {
    super("Class Name", "class name", options);
  }
  
  public static ClassNamePatternConverter newInstance(String[] options)
  {
    return new ClassNamePatternConverter(options);
  }
  
  public void format(LoggingEvent event, StringBuffer toAppendTo)
  {
    int initialLength = toAppendTo.length();
    LocationInfo li = event.getLocationInformation();
    if (li == null) {
      toAppendTo.append("?");
    } else {
      toAppendTo.append(li.getClassName());
    }
    abbreviate(initialLength, toAppendTo);
  }
}

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

import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date;
import java.util.TimeZone;

class DatePatternConverter$DefaultZoneDateFormat
  extends DateFormat
{
  private static final long serialVersionUID = 1L;
  private final DateFormat dateFormat;
  
  public DatePatternConverter$DefaultZoneDateFormat(DateFormat format)
  {
    dateFormat = format;
  }
  
  public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
  {
    dateFormat.setTimeZone(TimeZone.getDefault());
    return dateFormat.format(date, toAppendTo, fieldPosition);
  }
  
  public Date parse(String source, ParsePosition pos)
  {
    dateFormat.setTimeZone(TimeZone.getDefault());
    return dateFormat.parse(source, pos);
  }
}

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

import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.spi.LoggingEvent;

public final class DatePatternConverter
  extends LoggingEventPatternConverter
{
  private static final String ABSOLUTE_FORMAT = "ABSOLUTE";
  private static final String ABSOLUTE_TIME_PATTERN = "HH:mm:ss,SSS";
  private static final String DATE_AND_TIME_FORMAT = "DATE";
  private static final String DATE_AND_TIME_PATTERN = "dd MMM yyyy HH:mm:ss,SSS";
  private static final String ISO8601_FORMAT = "ISO8601";
  private static final String ISO8601_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
  private final CachedDateFormat df;
  
  private static class DefaultZoneDateFormat
    extends DateFormat
  {
    private static final long serialVersionUID = 1L;
    private final DateFormat dateFormat;
    
    public DefaultZoneDateFormat(DateFormat format)
    {
      dateFormat = format;
    }
    
    public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
    {
      dateFormat.setTimeZone(TimeZone.getDefault());
      return dateFormat.format(date, toAppendTo, fieldPosition);
    }
    
    public Date parse(String source, ParsePosition pos)
    {
      dateFormat.setTimeZone(TimeZone.getDefault());
      return dateFormat.parse(source, pos);
    }
  }
  
  private DatePatternConverter(String[] options)
  {
    super("Date", "date");
    String patternOption;
    String patternOption;
    if ((options == null) || (options.length == 0)) {
      patternOption = null;
    } else {
      patternOption = options[0];
    }
    String pattern;
    String pattern;
    if ((patternOption == null) || (patternOption.equalsIgnoreCase("ISO8601")))
    {
      pattern = "yyyy-MM-dd HH:mm:ss,SSS";
    }
    else
    {
      String pattern;
      if (patternOption.equalsIgnoreCase("ABSOLUTE"))
      {
        pattern = "HH:mm:ss,SSS";
      }
      else
      {
        String pattern;
        if (patternOption.equalsIgnoreCase("DATE")) {
          pattern = "dd MMM yyyy HH:mm:ss,SSS";
        } else {
          pattern = patternOption;
        }
      }
    }
    int maximumCacheValidity = 1000;
    DateFormat simpleFormat = null;
    try
    {
      simpleFormat = new SimpleDateFormat(pattern);
      maximumCacheValidity = CachedDateFormat.getMaximumCacheValidity(pattern);
    }
    catch (IllegalArgumentException e)
    {
      LogLog.warn("Could not instantiate SimpleDateFormat with pattern " + patternOption, e);
      
      simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
    }
    if ((options != null) && (options.length > 1))
    {
      TimeZone tz = TimeZone.getTimeZone(options[1]);
      simpleFormat.setTimeZone(tz);
    }
    else
    {
      simpleFormat = new DefaultZoneDateFormat(simpleFormat);
    }
    df = new CachedDateFormat(simpleFormat, maximumCacheValidity);
  }
  
  public static DatePatternConverter newInstance(String[] options)
  {
    return new DatePatternConverter(options);
  }
  
  public void format(LoggingEvent event, StringBuffer output)
  {
    synchronized (this)
    {
      df.format(timeStamp, output);
    }
  }
  
  public void format(Object obj, StringBuffer output)
  {
    if ((obj instanceof Date)) {
      format((Date)obj, output);
    }
    super.format(obj, output);
  }
  
  public void format(Date date, StringBuffer toAppendTo)
  {
    synchronized (this)
    {
      df.format(date.getTime(), toAppendTo);
    }
  }
}

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

public final class FileDatePatternConverter
{
  public static PatternConverter newInstance(String[] options)
  {
    if ((options == null) || (options.length == 0)) {
      return DatePatternConverter.newInstance(new String[] { "yyyy-MM-dd" });
    }
    return DatePatternConverter.newInstance(options);
  }
}

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

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

public final class FileLocationPatternConverter
  extends LoggingEventPatternConverter
{
  private static final FileLocationPatternConverter INSTANCE = new FileLocationPatternConverter();
  
  private FileLocationPatternConverter()
  {
    super("File Location", "file");
  }
  
  public static FileLocationPatternConverter newInstance(String[] options)
  {
    return INSTANCE;
  }
  
  public void format(LoggingEvent event, StringBuffer output)
  {
    LocationInfo locationInfo = event.getLocationInformation();
    if (locationInfo != null) {
      output.append(locationInfo.getFileName());
    }
  }
}

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

public final class FormattingInfo
{
  private static final char[] SPACES = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
  private static final FormattingInfo DEFAULT = new FormattingInfo(false, 0, Integer.MAX_VALUE);
  private final int minLength;
  private final int maxLength;
  private final boolean leftAlign;
  
  public FormattingInfo(boolean leftAlign, int minLength, int maxLength)
  {
    this.leftAlign = leftAlign;
    this.minLength = minLength;
    this.maxLength = maxLength;
  }
  
  public static FormattingInfo getDefault()
  {
    return DEFAULT;
  }
  
  public boolean isLeftAligned()
  {
    return leftAlign;
  }
  
  public int getMinLength()
  {
    return minLength;
  }
  
  public int getMaxLength()
  {
    return maxLength;
  }
  
  public void format(int fieldStart, StringBuffer buffer)
  {
    int rawLength = buffer.length() - fieldStart;
    if (rawLength > maxLength) {
      buffer.delete(fieldStart, buffer.length() - maxLength);
    } else if (rawLength < minLength) {
      if (leftAlign)
      {
        int fieldEnd = buffer.length();
        buffer.setLength(fieldStart + minLength);
        for (int i = fieldEnd; i < buffer.length(); i++) {
          buffer.setCharAt(i, ' ');
        }
      }
      else
      {
        for (int padLength = minLength - rawLength; padLength > 8; padLength -= 8) {
          buffer.insert(fieldStart, SPACES);
        }
        buffer.insert(fieldStart, SPACES, 0, padLength);
      }
    }
  }
}

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

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

public final class FullLocationPatternConverter
  extends LoggingEventPatternConverter
{
  private static final FullLocationPatternConverter INSTANCE = new FullLocationPatternConverter();
  
  private FullLocationPatternConverter()
  {
    super("Full Location", "fullLocation");
  }
  
  public static FullLocationPatternConverter newInstance(String[] options)
  {
    return INSTANCE;
  }
  
  public void format(LoggingEvent event, StringBuffer output)
  {
    LocationInfo locationInfo = event.getLocationInformation();
    if (locationInfo != null) {
      output.append(fullInfo);
    }
  }
}

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

import java.util.Date;

public final class IntegerPatternConverter
  extends PatternConverter
{
  private static final IntegerPatternConverter INSTANCE = new IntegerPatternConverter();
  
  private IntegerPatternConverter()
  {
    super("Integer", "integer");
  }
  
  public static IntegerPatternConverter newInstance(String[] options)
  {
    return INSTANCE;
  }
  
  public void format(Object obj, StringBuffer toAppendTo)
  {
    if ((obj instanceof Integer)) {
      toAppendTo.append(obj.toString());
    }
    if ((obj instanceof Date)) {
      toAppendTo.append(Long.toString(((Date)obj).getTime()));
    }
  }
}

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

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

public final class LevelPatternConverter
  extends LoggingEventPatternConverter
{
  private static final int TRACE_INT = 5000;
  private static final LevelPatternConverter INSTANCE = new LevelPatternConverter();
  
  private LevelPatternConverter()
  {
    super("Level", "level");
  }
  
  public static LevelPatternConverter newInstance(String[] options)
  {
    return INSTANCE;
  }
  
  public void format(LoggingEvent event, StringBuffer output)
  {
    output.append(event.getLevel().toString());
  }
  
  public String getStyleClass(Object e)
  {
    if ((e instanceof LoggingEvent))
    {
      int lint = ((LoggingEvent)e).getLevel().toInt();
      switch (lint)
      {
      case 5000: 
        return "level trace";
      case 10000: 
        return "level debug";
      case 20000: 
        return "level info";
      case 30000: 
        return "level warn";
      case 40000: 
        return "level error";
      case 50000: 
        return "level fatal";
      }
      return "level " + ((LoggingEvent)e).getLevel().toString();
    }
    return "level";
  }
}

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

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

public final class LineLocationPatternConverter
  extends LoggingEventPatternConverter
{
  private static final LineLocationPatternConverter INSTANCE = new LineLocationPatternConverter();
  
  private LineLocationPatternConverter()
  {
    super("Line", "line");
  }
  
  public static LineLocationPatternConverter newInstance(String[] options)
  {
    return INSTANCE;
  }
  
  public void format(LoggingEvent event, StringBuffer output)
  {
    LocationInfo locationInfo = event.getLocationInformation();
    if (locationInfo != null) {
      output.append(locationInfo.getLineNumber());
    }
  }
}

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

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

public final class LineSeparatorPatternConverter
  extends LoggingEventPatternConverter
{
  private static final LineSeparatorPatternConverter INSTANCE = new LineSeparatorPatternConverter();
  private final String lineSep;
  
  private LineSeparatorPatternConverter()
  {
    super("Line Sep", "lineSep");
    lineSep = Layout.LINE_SEP;
  }
  
  public static LineSeparatorPatternConverter newInstance(String[] options)
  {
    return INSTANCE;
  }
  
  public void format(LoggingEvent event, StringBuffer toAppendTo)
  {
    toAppendTo.append(lineSep);
  }
  
  public void format(Object obj, StringBuffer toAppendTo)
  {
    toAppendTo.append(lineSep);
  }
}

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

import org.apache.log4j.spi.LoggingEvent;

public final class LiteralPatternConverter
  extends LoggingEventPatternConverter
{
  private final String literal;
  
  public LiteralPatternConverter(String literal)
  {
    super("Literal", "literal");
    this.literal = literal;
  }
  
  public void format(LoggingEvent event, StringBuffer toAppendTo)
  {
    toAppendTo.append(literal);
  }
  
  public void format(Object obj, StringBuffer toAppendTo)
  {
    toAppendTo.append(literal);
  }
}

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

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Category;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.apache.log4j.NDC;
import org.apache.log4j.Priority;
import org.apache.log4j.helpers.Loader;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.or.RendererMap;
import org.apache.log4j.spi.LocationInfo;
import org.apache.log4j.spi.LoggerRepository;
import org.apache.log4j.spi.RendererSupport;
import org.apache.log4j.spi.ThrowableInformation;

public class LogEvent
  implements Serializable
{
  private static long startTime = ;
  public final transient String fqnOfCategoryClass;
  /**
   * @deprecated
   */
  private transient Category logger;
  /**
   * @deprecated
   */
  public final String categoryName;
  /**
   * @deprecated
   */
  public transient Priority level;
  private String ndc;
  private Hashtable mdcCopy;
  private boolean ndcLookupRequired = true;
  private boolean mdcCopyLookupRequired = true;
  private transient Object message;
  private String renderedMessage;
  private String threadName;
  private ThrowableInformation throwableInfo;
  public final long timeStamp;
  private LocationInfo locationInfo;
  static final long serialVersionUID = -868428216207166145L;
  static final Integer[] PARAM_ARRAY = new Integer[1];
  static final String TO_LEVEL = "toLevel";
  static final Class[] TO_LEVEL_PARAMS = { Integer.TY
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