Program: 25026
Project: 25026
Buggy source:
@Override public synchronized TableIterator executeQuery(final ADQLQuery adqlQuery) throws DBException {
  resetCancel();
  String sql=null;
  ResultSet result=null;
  try {
    if (logger != null)     logger.logDB(LogLevel.INFO,this,"String_Node_Str","String_Node_Str" + adqlQuery.toADQL().replaceAll("String_Node_Str","String_Node_Str"),null);
    sql=translator.translate(adqlQuery);
    if (supportsFetchSize && fetchSize > 0) {
      try {
        connection.setAutoCommit(false);
      }
 catch (      SQLException se) {
        if (!isCancelled()) {
          supportsFetchSize=false;
          if (logger != null)           logger.logDB(LogLevel.WARNING,this,"String_Node_Str","String_Node_Str",null);
        }
      }
    }
    getStatement();
    if (supportsFetchSize) {
      try {
        stmt.setFetchSize(fetchSize);
      }
 catch (      SQLException se) {
        if (!isCancelled()) {
          supportsFetchSize=false;
          if (logger != null)           logger.logDB(LogLevel.WARNING,this,"String_Node_Str","String_Node_Str",null);
        }
      }
    }
    if (logger != null)     logger.logDB(LogLevel.INFO,this,"String_Node_Str","String_Node_Str" + sql.replaceAll("String_Node_Str","String_Node_Str"),null);
    result=stmt.executeQuery(sql);
    if (logger != null)     logger.logDB(LogLevel.INFO,this,"String_Node_Str","String_Node_Str" + (supportsFetchSize ? "String_Node_Str" + fetchSize : "String_Node_Str") + "String_Node_Str",null);
    return createTableIterator(result,adqlQuery.getResultingColumns());
  }
 catch (  SQLException se) {
    close(result);
    closeStatement();
    if (!isCancelled() && logger != null)     logger.logDB(LogLevel.ERROR,this,"String_Node_Str","String_Node_Str",null);
    throw new DBException("String_Node_Str" + se.getMessage(),se);
  }
catch (  TranslationException te) {
    close(result);
    closeStatement();
    if (logger != null)     logger.logDB(LogLevel.ERROR,this,"String_Node_Str","String_Node_Str",null);
    throw new DBException("String_Node_Str" + te.getMessage(),te);
  }
catch (  DataReadException dre) {
    close(result);
    closeStatement();
    if (logger != null)     logger.logDB(LogLevel.ERROR,this,"String_Node_Str","String_Node_Str",null);
    throw new DBException("String_Node_Str" + dre.getMessage(),dre);
  }
}

Fixed version (ground truth):
@Override public synchronized TableIterator executeQuery(final ADQLQuery adqlQuery) throws DBException {
  resetCancel();
  String sql=null;
  ResultSet result=null;
  try {
    if (logger != null)     logger.logDB(LogLevel.INFO,this,"String_Node_Str","String_Node_Str" + adqlQuery.toADQL().replaceAll("String_Node_Str","String_Node_Str"),null);
    sql=translator.translate(adqlQuery);
    if (supportsTransaction && supportsFetchSize && fetchSize > 0) {
      try {
        connection.setAutoCommit(false);
      }
 catch (      SQLException se) {
        if (!isCancelled()) {
          supportsFetchSize=false;
          if (logger != null)           logger.logDB(LogLevel.WARNING,this,"String_Node_Str","String_Node_Str",null);
        }
      }
    }
    getStatement();
    if (supportsFetchSize) {
      try {
        stmt.setFetchSize(fetchSize);
      }
 catch (      SQLException se) {
        if (!isCancelled()) {
          supportsFetchSize=false;
          if (logger != null)           logger.logDB(LogLevel.WARNING,this,"String_Node_Str","String_Node_Str",null);
        }
      }
    }
    if (logger != null)     logger.logDB(LogLevel.INFO,this,"String_Node_Str","String_Node_Str" + sql.replaceAll("String_Node_Str","String_Node_Str"),null);
    result=stmt.executeQuery(sql);
    if (logger != null)     logger.logDB(LogLevel.INFO,this,"String_Node_Str","String_Node_Str" + (supportsFetchSize ? "String_Node_Str" + fetchSize : "String_Node_Str") + "String_Node_Str",null);
    return createTableIterator(result,adqlQuery.getResultingColumns());
  }
 catch (  SQLException se) {
    close(result);
    closeStatement();
    if (!isCancelled() && logger != null)     logger.logDB(LogLevel.ERROR,this,"String_Node_Str","String_Node_Str",null);
    throw new DBException("String_Node_Str" + se.getMessage(),se);
  }
catch (  TranslationException te) {
    close(result);
    closeStatement();
    if (logger != null)     logger.logDB(LogLevel.ERROR,this,"String_Node_Str","String_Node_Str",null);
    throw new DBException("String_Node_Str" + te.getMessage(),te);
  }
catch (  DataReadException dre) {
    close(result);
    closeStatement();
    if (logger != null)     logger.logDB(LogLevel.ERROR,this,"String_Node_Str","String_Node_Str",null);
    throw new DBException("String_Node_Str" + dre.getMessage(),dre);
  }
 finally {
    if (supportsFetchSize && fetchSize > 0) {
      rollback();
      endTransaction();
    }
  }
}