Program: 80528
Project: 80528
Buggy source:
public void run(DataSource dataSource,ConnCallback callback){
  Transaction t=Trans.get();
  if (null != t) {
    Connection conn=null;
    Savepoint sp=null;
    try {
      conn=t.getConnection(dataSource);
      sp=conn.setSavepoint();
      callback.invoke(conn);
    }
 catch (    Exception e) {
      if (e instanceof DaoException)       if (null != conn && null != e.getCause() && e.getCause() instanceof SQLException) {
        try {
          if (null == sp)           conn.rollback();
 else           conn.rollback(sp);
        }
 catch (        SQLException e1) {
          if (log.isErrorEnabled())           log.error(e1);
        }
      }
      throw new DaoException(e);
    }
  }
 else {
    Connection conn=null;
    boolean old=false;
    try {
      conn=dataSource.getConnection();
      old=conn.getAutoCommit();
      conn.setAutoCommit(false);
      callback.invoke(conn);
      if (!conn.getAutoCommit())       conn.commit();
    }
 catch (    Exception e) {
      try {
        conn.rollback();
      }
 catch (      SQLException e1) {
      }
      throw new DaoException(e);
    }
 finally {
      if (null != conn) {
        try {
          if (old != conn.getAutoCommit())           conn.setAutoCommit(old);
        }
 catch (        SQLException autoE) {
          if (log.isWarnEnabled())           log.warn("String_Node_Str" + old + "String_Node_Str",autoE);
        }
        try {
          conn.close();
        }
 catch (        SQLException closeE) {
          if (log.isWarnEnabled())           log.warn("String_Node_Str",closeE);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void run(DataSource dataSource,ConnCallback callback){
  Transaction t=Trans.get();
  if (null != t) {
    Connection conn=null;
    Savepoint sp=null;
    try {
      conn=t.getConnection(dataSource);
      sp=conn.setSavepoint();
      callback.invoke(conn);
    }
 catch (    Exception e) {
      if (e instanceof DaoException)       if (null != conn && null != e.getCause() && e.getCause() instanceof SQLException) {
        try {
          if (null == sp)           conn.rollback();
 else           conn.rollback(sp);
        }
 catch (        SQLException e1) {
          if (log.isErrorEnabled())           log.error(e1);
        }
      }
      throw new DaoException(e);
    }
  }
 else {
    Connection conn=null;
    boolean old=false;
    try {
      conn=dataSource.getConnection();
      old=conn.getAutoCommit();
      conn.setAutoCommit(false);
      callback.invoke(conn);
      if (!conn.getAutoCommit())       conn.commit();
    }
 catch (    Exception e) {
      try {
        if (conn != null)         conn.rollback();
      }
 catch (      SQLException e1) {
      }
      throw new DaoException(e);
    }
 finally {
      if (null != conn) {
        try {
          if (old != conn.getAutoCommit())           conn.setAutoCommit(old);
        }
 catch (        SQLException autoE) {
          if (log.isWarnEnabled())           log.warn("String_Node_Str" + old + "String_Node_Str",autoE);
        }
        try {
          conn.close();
        }
 catch (        SQLException closeE) {
          if (log.isWarnEnabled())           log.warn("String_Node_Str",closeE);
        }
      }
    }
  }
}