c3p0-0.9.1-pre6

16:33:19.159 INFO  jd.cli.Main - Decompiling c3p0-0.9.1-pre6.jar
package com.mchange;

import com.mchange.v2.debug.DebugConstants;

final class Debug
  implements DebugConstants
{
  static final boolean DEBUG = true;
  static final int TRACE = 10;
}

/* Location:
 * Qualified Name:     com.mchange.Debug
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.lang;

import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;

public final class ByteUtils
{
  public static final short UNSIGNED_MAX_VALUE = 255;
  
  public static short toUnsigned(byte b)
  {
    return (short)(b < 0 ? 256 + b : b);
  }
  
  public static String toHexAscii(byte b)
  {
    StringWriter sw = new StringWriter(2);
    addHexAscii(b, sw);
    return sw.toString();
  }
  
  public static String toHexAscii(byte[] bytes)
  {
    int len = bytes.length;
    StringWriter sw = new StringWriter(len * 2);
    for (int i = 0; i < len; i++) {
      addHexAscii(bytes[i], sw);
    }
    return sw.toString();
  }
  
  public static byte[] fromHexAscii(String s)
    throws NumberFormatException
  {
    try
    {
      int len = s.length();
      if (len % 2 != 0) {
        throw new NumberFormatException("Hex ascii must be exactly two digits per byte.");
      }
      int out_len = len / 2;
      byte[] out = new byte[out_len];
      int i = 0;
      StringReader sr = new StringReader(s);
      while (i < out_len)
      {
        int val = 16 * fromHexDigit(sr.read()) + fromHexDigit(sr.read());
        out[(i++)] = ((byte)val);
      }
      return out;
    }
    catch (IOException e)
    {
      throw new InternalError("IOException reading from StringReader?!?!");
    }
  }
  
  static void addHexAscii(byte b, StringWriter sw)
  {
    short ub = toUnsigned(b);
    int h1 = ub / 16;
    int h2 = ub % 16;
    sw.write(toHexDigit(h1));
    sw.write(toHexDigit(h2));
  }
  
  private static int fromHexDigit(int c)
    throws NumberFormatException
  {
    if ((c >= 48) && (c < 58)) {
      return c - 48;
    }
    if ((c >= 65) && (c < 71)) {
      return c - 55;
    }
    if ((c >= 97) && (c < 103)) {
      return c - 87;
    }
    throw new NumberFormatException(39 + c + "' is not a valid hexadecimal digit.");
  }
  
  private static char toHexDigit(int h)
  {
    char out;
    char out;
    if (h <= 9) {
      out = (char)(h + 48);
    } else {
      out = (char)(h + 55);
    }
    return out;
  }
}

/* Location:
 * Qualified Name:     com.mchange.lang.ByteUtils
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.lang;

import com.mchange.v2.debug.DebugConstants;

final class Debug
  implements DebugConstants
{
  static final boolean DEBUG = true;
  static final int TRACE = 10;
}

/* Location:
 * Qualified Name:     com.mchange.lang.Debug
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.lang;

public abstract interface PotentiallySecondary
{
  public abstract Throwable getNestedThrowable();
}

/* Location:
 * Qualified Name:     com.mchange.lang.PotentiallySecondary
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.lang;

import java.io.PrintStream;
import java.io.PrintWriter;

public class PotentiallySecondaryError
  extends Error
  implements PotentiallySecondary
{
  static final String NESTED_MSG = ">>>>>>>>>> NESTED THROWABLE >>>>>>>>";
  Throwable nested;
  
  public PotentiallySecondaryError(String msg, Throwable t)
  {
    super(msg);
    nested = t;
  }
  
  public PotentiallySecondaryError(Throwable t)
  {
    this("", t);
  }
  
  public PotentiallySecondaryError(String msg)
  {
    this(msg, null);
  }
  
  public PotentiallySecondaryError()
  {
    this("", null);
  }
  
  public Throwable getNestedThrowable()
  {
    return nested;
  }
  
  public void printStackTrace(PrintWriter pw)
  {
    super.printStackTrace(pw);
    if (nested != null)
    {
      pw.println(">>>>>>>>>> NESTED THROWABLE >>>>>>>>");
      nested.printStackTrace(pw);
    }
  }
  
  public void printStackTrace(PrintStream ps)
  {
    super.printStackTrace(ps);
    if (nested != null)
    {
      ps.println("NESTED_MSG");
      nested.printStackTrace(ps);
    }
  }
  
  public void printStackTrace()
  {
    printStackTrace(System.err);
  }
}

/* Location:
 * Qualified Name:     com.mchange.lang.PotentiallySecondaryError
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.lang;

import com.mchange.v2.lang.VersionUtils;
import java.io.PrintStream;
import java.io.PrintWriter;

/**
 * @deprecated
 */
public class PotentiallySecondaryException
  extends Exception
  implements PotentiallySecondary
{
  static final String NESTED_MSG = ">>>>>>>>>> NESTED EXCEPTION >>>>>>>>";
  Throwable nested;
  
  public PotentiallySecondaryException(String msg, Throwable t)
  {
    super(msg);
    nested = t;
  }
  
  public PotentiallySecondaryException(Throwable t)
  {
    this("", t);
  }
  
  public PotentiallySecondaryException(String msg)
  {
    this(msg, null);
  }
  
  public PotentiallySecondaryException()
  {
    this("", null);
  }
  
  public Throwable getNestedThrowable()
  {
    return nested;
  }
  
  private void setNested(Throwable t)
  {
    nested = t;
    if (VersionUtils.isAtLeastJavaVersion14()) {
      initCause(t);
    }
  }
  
  public void printStackTrace(PrintWriter pw)
  {
    super.printStackTrace(pw);
    if ((!VersionUtils.isAtLeastJavaVersion14()) && (nested != null))
    {
      pw.println(">>>>>>>>>> NESTED EXCEPTION >>>>>>>>");
      nested.printStackTrace(pw);
    }
  }
  
  public void printStackTrace(PrintStream ps)
  {
    super.printStackTrace(ps);
    if ((!VersionUtils.isAtLeastJavaVersion14()) && (nested != null))
    {
      ps.println("NESTED_MSG");
      nested.printStackTrace(ps);
    }
  }
  
  public void printStackTrace()
  {
    if (VersionUtils.isAtLeastJavaVersion14()) {
      super.printStackTrace();
    } else {
      printStackTrace(System.err);
    }
  }
}

/* Location:
 * Qualified Name:     com.mchange.lang.PotentiallySecondaryException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.lang;

import java.io.PrintStream;
import java.io.PrintWriter;

public class PotentiallySecondaryRuntimeException
  extends RuntimeException
  implements PotentiallySecondary
{
  static final String NESTED_MSG = ">>>>>>>>>> NESTED EXCEPTION >>>>>>>>";
  Throwable nested;
  
  public PotentiallySecondaryRuntimeException(String msg, Throwable t)
  {
    super(msg);
    nested = t;
  }
  
  public PotentiallySecondaryRuntimeException(Throwable t)
  {
    this("", t);
  }
  
  public PotentiallySecondaryRuntimeException(String msg)
  {
    this(msg, null);
  }
  
  public PotentiallySecondaryRuntimeException()
  {
    this("", null);
  }
  
  public Throwable getNestedThrowable()
  {
    return nested;
  }
  
  public void printStackTrace(PrintWriter pw)
  {
    super.printStackTrace(pw);
    if (nested != null)
    {
      pw.println(">>>>>>>>>> NESTED EXCEPTION >>>>>>>>");
      nested.printStackTrace(pw);
    }
  }
  
  public void printStackTrace(PrintStream ps)
  {
    super.printStackTrace(ps);
    if (nested != null)
    {
      ps.println("NESTED_MSG");
      nested.printStackTrace(ps);
    }
  }
  
  public void printStackTrace()
  {
    printStackTrace(System.err);
  }
}

/* Location:
 * Qualified Name:     com.mchange.lang.PotentiallySecondaryRuntimeException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.lang;

import java.io.PrintWriter;
import java.io.StringWriter;

public final class ThrowableUtils
{
  public static String extractStackTrace(Throwable t)
  {
    StringWriter me = new StringWriter();
    PrintWriter pw = new PrintWriter(me);
    t.printStackTrace(pw);
    pw.flush();
    return me.toString();
  }
  
  public static boolean isChecked(Throwable t)
  {
    return ((t instanceof Exception)) && (!(t instanceof RuntimeException));
  }
  
  public static boolean isUnchecked(Throwable t)
  {
    return !isChecked(t);
  }
}

/* Location:
 * Qualified Name:     com.mchange.lang.ThrowableUtils
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.util;

public class AssertException
  extends RuntimeException
{
  public AssertException(String message)
  {
    super(message);
  }
  
  public AssertException() {}
}

/* Location:
 * Qualified Name:     com.mchange.util.AssertException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.util;

import com.mchange.v2.debug.DebugConstants;

final class Debug
  implements DebugConstants
{
  static final boolean DEBUG = true;
  static final int TRACE = 10;
}

/* Location:
 * Qualified Name:     com.mchange.util.Debug
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1;

import com.mchange.v2.debug.DebugConstants;

final class Debug
  implements DebugConstants
{
  static final boolean DEBUG = true;
  static final int TRACE = 10;
}

/* Location:
 * Qualified Name:     com.mchange.v1.Debug
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.db;

import com.mchange.v2.debug.DebugConstants;

final class Debug
  implements DebugConstants
{
  static final boolean DEBUG = true;
  static final int TRACE = 10;
}

/* Location:
 * Qualified Name:     com.mchange.v1.db.Debug
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.db.sql;

import com.mchange.v2.log.MLevel;
import com.mchange.v2.log.MLog;
import com.mchange.v2.log.MLogger;
import java.sql.Connection;
import java.sql.SQLException;

public final class ConnectionUtils
{
  private static final MLogger logger = MLog.getLogger(ConnectionUtils.class);
  
  public static boolean attemptClose(Connection con)
  {
    try
    {
      if (con != null) {
        con.close();
      }
      return true;
    }
    catch (SQLException e)
    {
      if (logger.isLoggable(MLevel.WARNING)) {
        logger.log(MLevel.WARNING, "Connection close FAILED.", e);
      }
    }
    return false;
  }
  
  public static boolean attemptRollback(Connection con)
  {
    try
    {
      if (con != null) {
        con.rollback();
      }
      return true;
    }
    catch (SQLException e)
    {
      if (logger.isLoggable(MLevel.WARNING)) {
        logger.log(MLevel.WARNING, "Rollback FAILED.", e);
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.db.sql.ConnectionUtils
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.db.sql;

import com.mchange.v2.debug.DebugConstants;

final class Debug
  implements DebugConstants
{
  static final boolean DEBUG = true;
  static final int TRACE = 10;
}

/* Location:
 * Qualified Name:     com.mchange.v1.db.sql.Debug
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.db.sql;

import com.mchange.v2.log.MLevel;
import com.mchange.v2.log.MLog;
import com.mchange.v2.log.MLogger;
import java.sql.ResultSet;
import java.sql.SQLException;

public final class ResultSetUtils
{
  private static final MLogger logger = MLog.getLogger(ResultSetUtils.class);
  
  public static boolean attemptClose(ResultSet rs)
  {
    try
    {
      if (rs != null) {
        rs.close();
      }
      return true;
    }
    catch (SQLException e)
    {
      if (logger.isLoggable(MLevel.WARNING)) {
        logger.log(MLevel.WARNING, "ResultSet close FAILED.", e);
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.db.sql.ResultSetUtils
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.db.sql;

import com.mchange.v2.log.MLevel;
import com.mchange.v2.log.MLog;
import com.mchange.v2.log.MLogger;
import java.sql.SQLException;
import java.sql.Statement;

public final class StatementUtils
{
  private static final MLogger logger = MLog.getLogger(StatementUtils.class);
  
  public static boolean attemptClose(Statement stmt)
  {
    try
    {
      if (stmt != null) {
        stmt.close();
      }
      return true;
    }
    catch (SQLException e)
    {
      if (logger.isLoggable(MLevel.WARNING)) {
        logger.log(MLevel.WARNING, "Statement close FAILED.", e);
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.db.sql.StatementUtils
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import com.mchange.v2.debug.DebugConstants;

final class Debug
  implements DebugConstants
{
  static final boolean DEBUG = true;
  static final int TRACE = 10;
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.Debug
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

abstract class IdHashKey
{
  Identicator id;
  
  public IdHashKey(Identicator id)
  {
    this.id = id;
  }
  
  public abstract Object getKeyObj();
  
  public Identicator getIdenticator()
  {
    return id;
  }
  
  public abstract boolean equals(Object paramObject);
  
  public abstract int hashCode();
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdHashKey
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import java.util.HashMap;
import java.util.Map;

public final class IdHashMap
  extends IdMap
  implements Map
{
  public IdHashMap(Identicator id)
  {
    super(new HashMap(), id);
  }
  
  protected IdHashKey createIdKey(Object o)
  {
    return new StrongIdHashKey(o, id);
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdHashMap
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import com.mchange.v1.util.WrapperIterator;
import java.util.Iterator;
import java.util.Map.Entry;

class IdMap$1
  extends WrapperIterator
{
  private final IdMap.UserEntrySet this$1;
  
  IdMap$1(IdMap.UserEntrySet this$1, Iterator x0, boolean x1)
  {
    super(x0, x1);this.this$1 = this$1;
  }
  
  protected Object transformObject(Object o)
  {
    return new IdMap.UserEntry((Map.Entry)o);
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdMap.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import com.mchange.v1.util.AbstractMapEntry;
import java.util.Map.Entry;

public class IdMap$UserEntry
  extends AbstractMapEntry
{
  private Map.Entry innerEntry;
  
  IdMap$UserEntry(Map.Entry innerEntry)
  {
    this.innerEntry = innerEntry;
  }
  
  public final Object getKey()
  {
    return ((IdHashKey)innerEntry.getKey()).getKeyObj();
  }
  
  public final Object getValue()
  {
    return innerEntry.getValue();
  }
  
  public final Object setValue(Object value)
  {
    return innerEntry.setValue(value);
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdMap.UserEntry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

final class IdMap$UserEntrySet
  extends AbstractSet
{
  Set innerEntries;
  private final IdMap this$0;
  
  IdMap$UserEntrySet(IdMap x0, IdMap.1 x1)
  {
    this(x0);
  }
  
  private IdMap$UserEntrySet(IdMap this$0)
  {
    this.this$0 = this$0;
    
    innerEntries = this$0inner.entrySet();
  }
  
  public Iterator iterator()
  {
    return new IdMap.1(this, innerEntries.iterator(), true);
  }
  
  public int size()
  {
    return innerEntries.size();
  }
  
  public boolean contains(Object o)
  {
    if ((o instanceof Map.Entry))
    {
      Map.Entry entry = (Map.Entry)o;
      return innerEntries.contains(this$0.createIdEntry(entry));
    }
    return false;
  }
  
  public boolean remove(Object o)
  {
    if ((o instanceof Map.Entry))
    {
      Map.Entry entry = (Map.Entry)o;
      return innerEntries.remove(this$0.createIdEntry(entry));
    }
    return false;
  }
  
  public void clear()
  {
    this$0.inner.clear();
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdMap.UserEntrySet
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import com.mchange.v1.util.AbstractMapEntry;
import com.mchange.v1.util.SimpleMapEntry;
import com.mchange.v1.util.WrapperIterator;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

abstract class IdMap
  extends AbstractMap
  implements Map
{
  Map inner;
  Identicator id;
  
  protected IdMap(Map inner, Identicator id)
  {
    this.inner = inner;
    this.id = id;
  }
  
  public Object put(Object key, Object value)
  {
    return inner.put(createIdKey(key), value);
  }
  
  public boolean containsKey(Object key)
  {
    return inner.containsKey(createIdKey(key));
  }
  
  public Object get(Object key)
  {
    return inner.get(createIdKey(key));
  }
  
  public Object remove(Object key)
  {
    return inner.remove(createIdKey(key));
  }
  
  protected Object removeIdHashKey(IdHashKey idhk)
  {
    return inner.remove(idhk);
  }
  
  public Set entrySet()
  {
    return new UserEntrySet(null);
  }
  
  protected final Set internalEntrySet()
  {
    return inner.entrySet();
  }
  
  protected abstract IdHashKey createIdKey(Object paramObject);
  
  protected final Map.Entry createIdEntry(Object key, Object val)
  {
    return new SimpleMapEntry(createIdKey(key), val);
  }
  
  protected final Map.Entry createIdEntry(Map.Entry entry)
  {
    return createIdEntry(entry.getKey(), entry.getValue());
  }
  
  private final class UserEntrySet
    extends AbstractSet
  {
    UserEntrySet(IdMap.1 x1)
    {
      this();
    }
    
    Set innerEntries = inner.entrySet();
    
    public Iterator iterator()
    {
      return new IdMap.1(this, innerEntries.iterator(), true);
    }
    
    public int size()
    {
      return innerEntries.size();
    }
    
    public boolean contains(Object o)
    {
      if ((o instanceof Map.Entry))
      {
        Map.Entry entry = (Map.Entry)o;
        return innerEntries.contains(createIdEntry(entry));
      }
      return false;
    }
    
    public boolean remove(Object o)
    {
      if ((o instanceof Map.Entry))
      {
        Map.Entry entry = (Map.Entry)o;
        return innerEntries.remove(createIdEntry(entry));
      }
      return false;
    }
    
    public void clear()
    {
      inner.clear();
    }
    
    private UserEntrySet() {}
  }
  
  protected static class UserEntry
    extends AbstractMapEntry
  {
    private Map.Entry innerEntry;
    
    UserEntry(Map.Entry innerEntry)
    {
      this.innerEntry = innerEntry;
    }
    
    public final Object getKey()
    {
      return ((IdHashKey)innerEntry.getKey()).getKeyObj();
    }
    
    public final Object getValue()
    {
      return innerEntry.getValue();
    }
    
    public final Object setValue(Object value)
    {
      return innerEntry.setValue(value);
    }
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdMap
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import com.mchange.v1.util.WrapperIterator;
import java.util.Iterator;
import java.util.Map.Entry;

class IdWeakHashMap$1
  extends WrapperIterator
{
  private final IdWeakHashMap.WeakUserEntrySet this$1;
  
  IdWeakHashMap$1(IdWeakHashMap.WeakUserEntrySet this$1, Iterator x0, boolean x1)
  {
    super(x0, x1);this.this$1 = this$1;
  }
  
  protected Object transformObject(Object o)
  {
    Map.Entry innerEntry = (Map.Entry)o;
    Object userKey = ((IdHashKey)innerEntry.getKey()).getKeyObj();
    if (userKey == null) {
      return WrapperIterator.SKIP_TOKEN;
    }
    return new IdWeakHashMap.2(this, innerEntry, userKey);
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdWeakHashMap.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import java.util.Map.Entry;

class IdWeakHashMap$2
  extends IdMap.UserEntry
{
  Object preventRefClear;
  private final Object val$userKey;
  private final IdWeakHashMap.1 this$2;
  
  IdWeakHashMap$2(IdWeakHashMap.1 this$2, Map.Entry x0, Object val$userKey)
  {
    super(x0);this.this$2 = this$2;this.val$userKey = val$userKey;preventRefClear = this.val$userKey;
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdWeakHashMap.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

final class IdWeakHashMap$WeakUserEntrySet
  extends AbstractSet
{
  Set innerEntries;
  private final IdWeakHashMap this$0;
  
  IdWeakHashMap$WeakUserEntrySet(IdWeakHashMap x0, IdWeakHashMap.1 x1)
  {
    this(x0);
  }
  
  private IdWeakHashMap$WeakUserEntrySet(IdWeakHashMap this$0)
  {
    this.this$0 = this$0;
    
    innerEntries = this.this$0.internalEntrySet();
  }
  
  public Iterator iterator()
  {
    try
    {
      return new IdWeakHashMap.1(this, innerEntries.iterator(), true);
    }
    finally
    {
      IdWeakHashMap.access$100(this$0);
    }
  }
  
  public int size()
  {
    IdWeakHashMap.access$100(this$0);
    return innerEntries.size();
  }
  
  public boolean contains(Object o)
  {
    try
    {
      Map.Entry entry;
      if ((o instanceof Map.Entry))
      {
        entry = (Map.Entry)o;
        return innerEntries.contains(this$0.createIdEntry(entry));
      }
      return 0;
    }
    finally
    {
      IdWeakHashMap.access$100(this$0);
    }
  }
  
  public boolean remove(Object o)
  {
    try
    {
      Map.Entry entry;
      if ((o instanceof Map.Entry))
      {
        entry = (Map.Entry)o;
        return innerEntries.remove(this$0.createIdEntry(entry));
      }
      return 0;
    }
    finally
    {
      IdWeakHashMap.access$100(this$0);
    }
  }
  
  public void clear()
  {
    try
    {
      this$0.inner.clear();
    }
    finally
    {
      IdWeakHashMap.access$100(this$0);
    }
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdWeakHashMap.WeakUserEntrySet
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import com.mchange.v1.util.WrapperIterator;
import java.lang.ref.ReferenceQueue;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public final class IdWeakHashMap
  extends IdMap
  implements Map
{
  ReferenceQueue rq;
  
  public IdWeakHashMap(Identicator id)
  {
    super(new HashMap(), id);
    rq = new ReferenceQueue();
  }
  
  public int size()
  {
    cleanCleared();
    return super.size();
  }
  
  public boolean isEmpty()
  {
    try
    {
      return super.isEmpty();
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public boolean containsKey(Object o)
  {
    try
    {
      return super.containsKey(o);
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public boolean containsValue(Object o)
  {
    try
    {
      return super.containsValue(o);
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public Object get(Object o)
  {
    try
    {
      return super.get(o);
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public Object put(Object k, Object v)
  {
    try
    {
      return super.put(k, v);
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public Object remove(Object o)
  {
    try
    {
      return super.remove(o);
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public void putAll(Map m)
  {
    try
    {
      super.putAll(m);
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public void clear()
  {
    try
    {
      super.clear();
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public Set keySet()
  {
    try
    {
      return super.keySet();
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public Collection values()
  {
    try
    {
      return super.values();
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public Set entrySet()
  {
    try
    {
      return new WeakUserEntrySet(null);
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public boolean equals(Object o)
  {
    try
    {
      return super.equals(o);
    }
    finally
    {
      cleanCleared();
    }
  }
  
  public int hashCode()
  {
    try
    {
      return super.hashCode();
    }
    finally
    {
      cleanCleared();
    }
  }
  
  protected IdHashKey createIdKey(Object o)
  {
    return new WeakIdHashKey(o, id, rq);
  }
  
  private void cleanCleared()
  {
    WeakIdHashKey.Ref ref;
    while ((ref = (WeakIdHashKey.Ref)rq.poll()) != null) {
      removeIdHashKey(ref.getKey());
    }
  }
  
  private final class WeakUserEntrySet
    extends AbstractSet
  {
    WeakUserEntrySet(IdWeakHashMap.1 x1)
    {
      this();
    }
    
    Set innerEntries = internalEntrySet();
    
    public Iterator iterator()
    {
      try
      {
        return new IdWeakHashMap.1(this, innerEntries.iterator(), true);
      }
      finally
      {
        IdWeakHashMap.this.cleanCleared();
      }
    }
    
    public int size()
    {
      IdWeakHashMap.this.cleanCleared();
      return innerEntries.size();
    }
    
    public boolean contains(Object o)
    {
      try
      {
        Map.Entry entry;
        if ((o instanceof Map.Entry))
        {
          entry = (Map.Entry)o;
          return innerEntries.contains(createIdEntry(entry));
        }
        return 0;
      }
      finally
      {
        IdWeakHashMap.this.cleanCleared();
      }
    }
    
    public boolean remove(Object o)
    {
      try
      {
        Map.Entry entry;
        if ((o instanceof Map.Entry))
        {
          entry = (Map.Entry)o;
          return innerEntries.remove(createIdEntry(entry));
        }
        return 0;
      }
      finally
      {
        IdWeakHashMap.this.cleanCleared();
      }
    }
    
    public void clear()
    {
      try
      {
        inner.clear();
      }
      finally
      {
        IdWeakHashMap.this.cleanCleared();
      }
    }
    
    private WeakUserEntrySet() {}
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.IdWeakHashMap
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

public abstract interface Identicator
{
  public abstract boolean identical(Object paramObject1, Object paramObject2);
  
  public abstract int hash(Object paramObject);
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.Identicator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

final class StrongIdHashKey
  extends IdHashKey
{
  Object keyObj;
  
  public StrongIdHashKey(Object keyObj, Identicator id)
  {
    super(id);
    this.keyObj = keyObj;
  }
  
  public Object getKeyObj()
  {
    return keyObj;
  }
  
  public boolean equals(Object o)
  {
    if ((o instanceof StrongIdHashKey)) {
      return id.identical(keyObj, keyObj);
    }
    return false;
  }
  
  public int hashCode()
  {
    return id.hash(keyObj);
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.StrongIdHashKey
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;

class WeakIdHashKey$Ref
  extends WeakReference
{
  private final WeakIdHashKey this$0;
  
  public WeakIdHashKey$Ref(WeakIdHashKey this$0, Object referant, ReferenceQueue rq)
  {
    super(referant, rq);this.this$0 = this$0;
  }
  
  WeakIdHashKey getKey()
  {
    return this$0;
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.WeakIdHashKey.Ref
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.identicator;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;

final class WeakIdHashKey
  extends IdHashKey
{
  Ref keyRef;
  int hash;
  
  public WeakIdHashKey(Object keyObj, Identicator id, ReferenceQueue rq)
  {
    super(id);
    if (keyObj == null) {
      throw new UnsupportedOperationException("Collection does not accept nulls!");
    }
    keyRef = new Ref(keyObj, rq);
    hash = id.hash(keyObj);
  }
  
  public Ref getInternalRef()
  {
    return keyRef;
  }
  
  public Object getKeyObj()
  {
    return keyRef.get();
  }
  
  public boolean equals(Object o)
  {
    if ((o instanceof WeakIdHashKey))
    {
      WeakIdHashKey other = (WeakIdHashKey)o;
      if (keyRef == keyRef) {
        return true;
      }
      Object myKeyObj = keyRef.get();
      Object oKeyObj = keyRef.get();
      if ((myKeyObj == null) || (oKeyObj == null)) {
        return false;
      }
      return id.identical(myKeyObj, oKeyObj);
    }
    return false;
  }
  
  public int hashCode()
  {
    return hash;
  }
  
  class Ref
    extends WeakReference
  {
    public Ref(Object referant, ReferenceQueue rq)
    {
      super(rq);
    }
    
    WeakIdHashKey getKey()
    {
      return WeakIdHashKey.this;
    }
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.identicator.WeakIdHashKey
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.io;

import com.mchange.v2.debug.DebugConstants;

final class Debug
  implements DebugConstants
{
  static final boolean DEBUG = true;
  static final int TRACE = 10;
}

/* Location:
 * Qualified Name:     com.mchange.v1.io.Debug
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.io;

import com.mchange.v2.log.MLevel;
import com.mchange.v2.log.MLog;
import com.mchange.v2.log.MLogger;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;

public final class InputStreamUtils
{
  private static final MLogger logger = MLog.getLogger(InputStreamUtils.class);
  
  public static boolean compare(InputStream is1, InputStream is2, long num_bytes)
    throws IOException
  {
    for (long num_read = 0L; num_read < num_bytes; num_read += 1L)
    {
      int b;
      if ((b = is1.read()) != is2.read()) {
        return false;
      }
      if (b < 0) {
        break;
      }
    }
    return true;
  }
  
  public static boolean compare(InputStream is1, InputStream is2)
    throws IOException
  {
    int b = 0;
    while (b >= 0) {
      if ((b = is1.read()) != is2.read()) {
        return false;
      }
    }
    return true;
  }
  
  public static byte[] getBytes(InputStream is, int max_len)
    throws IOException
  {
    ByteArrayOutputStream baos = new ByteArrayOutputStream(max_len);
    int i = 0;
    for (int b = is.read(); (b >= 0) && (i < max_len); i++)
    {
      baos.write(b);b = is.read();
    }
    return baos.toByteArray();
  }
  
  public static byte[] getBytes(InputStream is)
    throws IOException
  {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    for (int b = is.read(); b >= 0; b = is.read()) {
      baos.write(b);
    }
    return baos.toByteArray();
  }
  
  public static String getContentsAsString(InputStream is, String enc)
    throws IOException, UnsupportedEncodingException
  {
    return new String(getBytes(is), enc);
  }
  
  public static String getContentsAsString(InputStream is)
    throws IOException
  {
    try
    {
      return getContentsAsString(is, System.getProperty("file.encoding", "8859_1"));
    }
    catch (UnsupportedEncodingException e)
    {
      throw new InternalError("You have no default character encoding, and iso-8859-1 is unsupported?!?!");
    }
  }
  
  public static String getContentsAsString(InputStream is, int max_len, String enc)
    throws IOException, UnsupportedEncodingException
  {
    return new String(getBytes(is, max_len), enc);
  }
  
  public static String getContentsAsString(InputStream is, int max_len)
    throws IOException
  {
    try
    {
      return getContentsAsString(is, max_len, System.getProperty("file.encoding", "8859_1"));
    }
    catch (UnsupportedEncodingException e)
    {
      throw new InternalError("You have no default character encoding, and iso-8859-1 is unsupported?!?!");
    }
  }
  
  public static InputStream getEmptyInputStream()
  {
    return EMPTY_ISTREAM;
  }
  
  public static void attemptClose(InputStream is)
  {
    try
    {
      if (is != null) {
        is.close();
      }
    }
    catch (IOException e)
    {
      if (logger.isLoggable(MLevel.WARNING)) {
        logger.log(MLevel.WARNING, "InputStream close FAILED.", e);
      }
    }
  }
  
  public static void skipFully(InputStream is, long num_bytes)
    throws EOFException, IOException
  {
    long num_skipped = 0L;
    while (num_skipped < num_bytes)
    {
      long just_skipped = is.skip(num_bytes - num_skipped);
      if (just_skipped > 0L)
      {
        num_skipped += just_skipped;
      }
      else
      {
        int test_byte = is.read();
        if (is.read() < 0) {
          throw new EOFException("Skipped only " + num_skipped + " bytes to end of file.");
        }
        num_skipped += 1L;
      }
    }
  }
  
  private static InputStream EMPTY_ISTREAM = new ByteArrayInputStream(new byte[0]);
}

/* Location:
 * Qualified Name:     com.mchange.v1.io.InputStreamUtils
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.io;

import com.mchange.v2.log.MLevel;
import com.mchange.v2.log.MLog;
import com.mchange.v2.log.MLogger;
import java.io.IOException;
import java.io.OutputStream;

public final class OutputStreamUtils
{
  private static final MLogger logger = MLog.getLogger(OutputStreamUtils.class);
  
  public static void attemptClose(OutputStream os)
  {
    try
    {
      if (os != null) {
        os.close();
      }
    }
    catch (IOException e)
    {
      if (logger.isLoggable(MLevel.WARNING)) {
        logger.log(MLevel.WARNING, "OutputStream close FAILED.", e);
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.io.OutputStreamUtils
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.lang;

public class AmbiguousClassNameException
  extends Exception
{
  AmbiguousClassNameException(String simpleName, Class c1, Class c2)
  {
    super(simpleName + " could refer either to " + c1.getName() + " or " + c2.getName());
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.lang.AmbiguousClassNameException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.lang;

public final class BooleanUtils
{
  public static boolean parseBoolean(String str)
    throws IllegalArgumentException
  {
    if (str.equals("true")) {
      return true;
    }
    if (str.equals("false")) {
      return false;
    }
    throw new IllegalArgumentException("\"str\" is neither \"true\" nor \"false\".");
  }
}

/* Location:
 * Qualified Name:     com.mchange.v1.lang.BooleanUtils
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.mchange.v1.lang;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public final class ClassUtils
{
  static final String[] EMPTY_SA = new String[0];
  static Map primitivesToClasses;
  
  static
  {
    HashMap tmp = new HashMap();
    tmp.put("boolean", Boolean.TYPE);
    tmp.put("int", Integer.TYPE);
    tmp.put("char", Character.TYPE);
    tmp.put("short", Short.TYPE);
    tmp.put("int", Integer.TYPE);
    tmp.put("long", Long.TYPE);
    tmp.put("float", Float.TYPE);
    tmp.put("double", Double.TYPE);
    tmp.put("void", Void.TYPE);
    
    primitivesToClasses = Collections.unmodifiableMap(tmp);
  }
  
  public static Set allAssignableFrom(Class type)
  {
    Set out = new HashSet();
    for (Class cl = type; cl != null; cl = cl.getSuperclass()) {
      out.add(cl);
    }
    addSuperInterfacesToSet(type, out);
    return out;
  }
  
  public static String simpleClassName(Class cl)
  {
    int array_level = 0;
    while (cl.isArray())
    {
      array_level++;
      cl = cl.getComponentType();
    }
    String scn = simpleClassName(cl.getName());
    if (array_level > 0)
    {
      StringBuffer sb = new StringBuffer(16);
      sb.append(scn);
      for (int i = 0; i < array_level; i++) {
        sb.append("[]");
      }
      return sb.toString();
    }
    return scn;
  }
  
  private static String simpleClassName(String fqcn)
  {
    int pkgdot = fqcn.lastIndexOf('.');
    if (pkgdot < 0) {
      return fqcn;
    }
    String scn = fqcn.substring(pkgdot + 1);
    if (scn.indexOf('$') >= 0)
    {
      StringBuffer sb = new StringBuffer(scn);
      int i = 0;
      for (int len = sb.length(); i < len; i++) {
        if (sb.charAt(i) == '$') {
          sb.setCharAt(i, '.');
        }
      }
      return sb.toString();
    }
    return scn;
  }
  
  public static boolean isPrimitive(String typeStr)
  {
    return primitivesToClasses.get(typeStr) != null;
  }
  
  public static Class classForPrimitive(String typeStr)
  {
    return (Class)primitivesToClasses.get(typeStr);
  }
  
  public static Class forName(String fqOrSimple, String[] importPkgs, String[] importClasses)
    throws AmbiguousClassNameException, ClassNotFoundException
  {
    try
    {
      return Class.forName(fqOrSimple);
    }
    catch (ClassNotFoundException e) {}
    return classForSimpleName(fqOrSimple, importPkgs, importClasses);
  }
  
  public static Class classForSimpleName(String simpleName, String[] importPkgs, String[] importClasses)
    throws AmbiguousClassNameException, ClassNotFoundException
  {
    Set checkSet = new HashSet();
    Class out = classForPrimitive(simpleName);
    if (out == null)
    {
      if (importPkgs == null) {
        importPkgs = EMPTY_SA;
      }
      if (importClasses == null) {
        importClasses = EMPTY_SA;
      }
      int i = 0;
      for (int len = importClasses.length; i < len; i++)
      {
        String importSimpleName = fqcnLastElement(importClasses[i]);
        if (!checkSet.add(importSimpleName)) {
          throw new IllegalArgumentException("Duplicate imported classes: " + importSimpleName);
        }
        if (simpleName.equals(importSimpleName)) {
          out = Class.forName(importClasses[i]);
        }
      }
      if (out == null)
      {
        try
        {
          out = Class.forName("java.lang." + simpleName);
        }
        catch (ClassNotFoundException e) {}
        int i = 0;
        for (int len = importPkgs.length; i < len; i++) {
          try
          {
            String tryClass = importPkgs[i] + '.' + simpleName;
            Class test = Class.forName(tryClass);
            if (out == null) {
              out = test;
            } else {
              throw new AmbiguousClassNameException(simpleName, out, test);
            }
          }
          catch (ClassNotFoundException e) {}
        }
      }
    }
    if (out == null) {
      throw new ClassNotFoundException("Could not find a class whose unqualified name is \"" + simpleName + "\" with the imports supplied. Import packages are " + Arrays.asList(importPkgs) + "; class imports are " + Arrays.asList(importClasses));
    }
    return out;
  }
  
  public static String resolvableTypeName(Class type, String[] importPkgs, String[] importClasses)
    throws ClassNotFoundException
  {
    String simpleN
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

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