Program: 129915
Project: 129915
Buggy source:
public static synchronized List<TdColumn> returnColumns(IMetadataConnection iMetadataConnection,TableNode tableNode,boolean... dontCreateClose){
  List<TdColumn> metadataColumns=new ArrayList<TdColumn>();
  boolean needCreateAndClose=dontCreateClose.length == 0 || !dontCreateClose[0];
  if (tableNode.getType() != TableNode.TABLE) {
    return metadataColumns;
  }
  NamedColumnSet table=tableNode.getTable();
  if (table == null) {
    table=tableNode.getView();
  }
  if (table == null) {
    return metadataColumns;
  }
  DriverShim wapperDriver=null;
  String dbType="String_Node_Str";
  try {
    if (needCreateAndClose || ExtractMetaDataUtils.conn == null || ExtractMetaDataUtils.conn.isClosed()) {
      List list=ExtractMetaDataUtils.getConnection(iMetadataConnection.getDbType(),iMetadataConnection.getUrl(),iMetadataConnection.getUsername(),iMetadataConnection.getPassword(),iMetadataConnection.getDatabase(),iMetadataConnection.getSchema(),iMetadataConnection.getDriverClass(),iMetadataConnection.getDriverJarPath(),iMetadataConnection.getDbVersionString(),iMetadataConnection.getAdditionalParams());
      if (list != null && list.size() > 0) {
        for (int i=0; i < list.size(); i++) {
          if (list.get(i) instanceof DriverShim) {
            wapperDriver=(DriverShim)list.get(i);
          }
        }
      }
    }
    dbType=iMetadataConnection.getDbType();
    DatabaseMetaData dbMetaData=ExtractMetaDataUtils.getDatabaseMetaData(ExtractMetaDataUtils.conn,dbType);
    String tableLabel=tableNode.getValue();
    TableNode newNode=tableNode;
    String name=newNode.getItemType();
    if (name != null && StringUtils.trimToEmpty(name).equals(ETableTypes.TABLETYPE_SYNONYM.getName())) {
      String tableName=getTableNameBySynonym(ExtractMetaDataUtils.conn,newNode.getValue());
      if (tableName.contains("String_Node_Str")) {
        tableName=tableName.replace("String_Node_Str","String_Node_Str");
      }
      newNode.setValue(tableName);
      fillSynonmsForOracle(iMetadataConnection,metadataColumns,table,tableName);
    }
 else {
      if (tableLabel.contains("String_Node_Str")) {
        tableLabel=tableLabel.replace("String_Node_Str","String_Node_Str");
      }
      newNode.setValue(tableLabel);
      metadataColumns=MetadataFillFactory.getDBInstance().fillColumns(table,iMetadataConnection,dbMetaData,null);
    }
    ColumnSetHelper.addColumns(table,metadataColumns);
    if (needCreateAndClose) {
      ExtractMetaDataUtils.closeConnection();
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    log.error(e);
  }
 finally {
    if (dbType != null && (dbType.equals(EDatabaseTypeName.HSQLDB.getDisplayName()) || dbType.equals(EDatabaseTypeName.HSQLDB_SERVER.getDisplayName()) || dbType.equals(EDatabaseTypeName.HSQLDB_WEBSERVER.getDisplayName())|| dbType.equals(EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName()))) {
      ExtractMetaDataUtils.closeConnection();
    }
    if (wapperDriver != null && (iMetadataConnection.getDriverClass().equals(EDatabase4DriverClassName.JAVADB_EMBEDED.getDriverClass()) || dbType.equals(EDatabaseTypeName.JAVADB_EMBEDED.getDisplayName()) || dbType.equals(EDatabaseTypeName.JAVADB_DERBYCLIENT.getDisplayName())|| dbType.equals(EDatabaseTypeName.JAVADB_JCCJDBC.getDisplayName())|| dbType.equals(EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName()))) {
      try {
        wapperDriver.connect("String_Node_Str",null);
      }
 catch (      SQLException e) {
      }
    }
  }
  return metadataColumns;
}

Fixed version (ground truth):
public static synchronized List<TdColumn> returnColumns(IMetadataConnection iMetadataConnection,TableNode tableNode,boolean... dontCreateClose){
  List<TdColumn> metadataColumns=new ArrayList<TdColumn>();
  boolean needCreateAndClose=dontCreateClose.length == 0 || !dontCreateClose[0];
  if (tableNode.getType() != TableNode.TABLE) {
    return metadataColumns;
  }
  NamedColumnSet table=tableNode.getTable();
  if (table == null) {
    table=tableNode.getView();
  }
  if (table == null) {
    return metadataColumns;
  }
  DriverShim wapperDriver=null;
  String dbType="String_Node_Str";
  try {
    if (needCreateAndClose || ExtractMetaDataUtils.conn == null || ExtractMetaDataUtils.conn.isClosed()) {
      List list=ExtractMetaDataUtils.getConnection(iMetadataConnection.getDbType(),iMetadataConnection.getUrl(),iMetadataConnection.getUsername(),iMetadataConnection.getPassword(),iMetadataConnection.getDatabase(),iMetadataConnection.getSchema(),iMetadataConnection.getDriverClass(),iMetadataConnection.getDriverJarPath(),iMetadataConnection.getDbVersionString(),iMetadataConnection.getAdditionalParams());
      if (list != null && list.size() > 0) {
        for (int i=0; i < list.size(); i++) {
          if (list.get(i) instanceof DriverShim) {
            wapperDriver=(DriverShim)list.get(i);
          }
        }
      }
    }
    dbType=iMetadataConnection.getDbType();
    DatabaseMetaData dbMetaData=ExtractMetaDataUtils.getDatabaseMetaData(ExtractMetaDataUtils.conn,dbType);
    String tableLabel=tableNode.getValue();
    TableNode newNode=tableNode;
    String name=newNode.getItemType();
    if (name != null && StringUtils.trimToEmpty(name).equals(ETableTypes.TABLETYPE_SYNONYM.getName())) {
      String tableName=getTableNameBySynonym(ExtractMetaDataUtils.conn,newNode.getValue());
      if (iMetadataConnection.getDbType().equalsIgnoreCase("String_Node_Str") || iMetadataConnection.getDbType().equalsIgnoreCase("String_Node_Str") || iMetadataConnection.getDbType().equalsIgnoreCase("String_Node_Str")|| iMetadataConnection.getDbType().equalsIgnoreCase("String_Node_Str")) {
        tableName=newNode.getValue();
      }
      newNode.setValue(tableName);
      fillSynonmsForOracle(iMetadataConnection,metadataColumns,table,tableName);
    }
 else {
      if (tableLabel.contains("String_Node_Str")) {
        tableLabel=tableLabel.replace("String_Node_Str","String_Node_Str");
      }
      newNode.setValue(tableLabel);
      metadataColumns=MetadataFillFactory.getDBInstance().fillColumns(table,iMetadataConnection,dbMetaData,null);
    }
    ColumnSetHelper.addColumns(table,metadataColumns);
    if (needCreateAndClose) {
      ExtractMetaDataUtils.closeConnection();
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    log.error(e);
  }
 finally {
    if (dbType != null && (dbType.equals(EDatabaseTypeName.HSQLDB.getDisplayName()) || dbType.equals(EDatabaseTypeName.HSQLDB_SERVER.getDisplayName()) || dbType.equals(EDatabaseTypeName.HSQLDB_WEBSERVER.getDisplayName())|| dbType.equals(EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName()))) {
      ExtractMetaDataUtils.closeConnection();
    }
    if (wapperDriver != null && (iMetadataConnection.getDriverClass().equals(EDatabase4DriverClassName.JAVADB_EMBEDED.getDriverClass()) || dbType.equals(EDatabaseTypeName.JAVADB_EMBEDED.getDisplayName()) || dbType.equals(EDatabaseTypeName.JAVADB_DERBYCLIENT.getDisplayName())|| dbType.equals(EDatabaseTypeName.JAVADB_JCCJDBC.getDisplayName())|| dbType.equals(EDatabaseTypeName.HSQLDB_IN_PROGRESS.getDisplayName()))) {
      try {
        wapperDriver.connect("String_Node_Str",null);
      }
 catch (      SQLException e) {
      }
    }
  }
  return metadataColumns;
}