nus-yam/ex-repair huggingface dataset:
Program: 128539
Project: 128539
Buggy source:
/** 
 * judge whether SID is null or empty string whatever context mode or nor
 * @param dbConn
 * @return
 */
private boolean isNullSID(Connection dbConn){
  if (dbConn instanceof DatabaseConnection) {
    String databaseOnConnWizard=((DatabaseConnection)dbConn).getSID();
    String readableName=TalendCWMService.getReadableName(dbConn,databaseOnConnWizard);
    if (isEmptyString(databaseOnConnWizard) && isEmptyString(readableName)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * judge whether SID is null or empty string whatever context mode or nor
 * @param dbConn
 * @return
 */
private boolean isNullSID(Connection dbConn){
  if (dbConn instanceof DatabaseConnection) {
    String databaseOnConnWizard=((DatabaseConnection)dbConn).getSID();
    String readableName=TalendCWMService.getReadableName(dbConn,databaseOnConnWizard);
    if (isEmptyString(databaseOnConnWizard) || isEmptyString(readableName)) {
      return true;
    }
  }
  return false;
}
Program: 128540
Project: 128540
Buggy source:
private List<String> postFillCatalog(List<Catalog> catalogList,List<String> filterList,String catalogName,Connection dbConn){
  Catalog catalog=CatalogHelper.createCatalog(catalogName);
  catalogList.add(catalog);
  DatabaseConnection dbConnection=(DatabaseConnection)dbConn;
  if (dbConnection.getDatabaseType() != null && dbConnection.getDatabaseType().equals(EDatabaseTypeName.AS400.getDisplayName())) {
    IMetadataConnection iMetadataCon=ConvertionHelper.convert(dbConnection);
    if (iMetadataCon != null) {
      if (!StringUtils.isEmpty(iMetadataCon.getDatabase()) && !filterList.contains(iMetadataCon.getDatabase())) {
        filterList.add(iMetadataCon.getDatabase());
      }
      String pattern=ExtractMetaDataUtils.retrieveSchemaPatternForAS400(iMetadataCon.getAdditionalParams());
      if (pattern != null && !"String_Node_Str".equals(pattern)) {
        String[] multiSchems=ExtractMetaDataUtils.getMultiSchems(pattern);
        if (multiSchems != null) {
          for (          String s : multiSchems) {
            if (!StringUtils.isEmpty(s) && !filterList.contains(s)) {
              filterList.add(s);
            }
          }
        }
      }
    }
  }
 else {
    String uiSchema=dbConnection.getUiSchema();
    if (!StringUtils.isBlank(uiSchema) && !filterList.contains(uiSchema)) {
      filterList.add(uiSchema);
    }
  }
  return filterList;
}

Fixed version (ground truth):
private List<String> postFillCatalog(List<Catalog> catalogList,List<String> filterList,String catalogName,Connection dbConn){
  Catalog catalog=CatalogHelper.createCatalog(catalogName);
  catalogList.add(catalog);
  DatabaseConnection dbConnection=(DatabaseConnection)dbConn;
  if (dbConnection.getDatabaseType() != null && dbConnection.getDatabaseType().equals(EDatabaseTypeName.AS400.getDisplayName())) {
    IMetadataConnection iMetadataCon=ConvertionHelper.convert(dbConnection);
    if (iMetadataCon != null) {
      if (!StringUtils.isEmpty(iMetadataCon.getDatabase()) && !filterList.contains(iMetadataCon.getDatabase())) {
        filterList.add(iMetadataCon.getDatabase());
      }
      String pattern=ExtractMetaDataUtils.retrieveSchemaPatternForAS400(iMetadataCon.getAdditionalParams());
      if (pattern != null && !"String_Node_Str".equals(pattern)) {
        String[] multiSchems=ExtractMetaDataUtils.getMultiSchems(pattern);
        if (multiSchems != null) {
          for (          String s : multiSchems) {
            if (!StringUtils.isEmpty(s) && !filterList.contains(s)) {
              filterList.add(s);
            }
          }
        }
      }
    }
  }
 else {
    String uiSchema=dbConnection.getUiSchema();
    if (uiSchema != null) {
      uiSchema=TalendCWMService.getReadableName(dbConn,uiSchema);
    }
    if (!StringUtils.isBlank(uiSchema) && !filterList.contains(uiSchema)) {
      filterList.add(uiSchema);
    }
  }
  return filterList;
}
Program: 128541
Project: 128541
Buggy source:
/** 
 * DOC xqliu Comment method "fillDbConnectionInformation".
 * @param dbConn
 * @return
 */
public static DatabaseConnection fillDbConnectionInformation(DatabaseConnection dbConn){
  boolean noStructureExists=ConnectionHelper.getAllCatalogs(dbConn).isEmpty() && ConnectionHelper.getAllSchemas(dbConn).isEmpty();
  java.sql.Connection sqlConn=null;
  try {
    if (noStructureExists) {
      IMetadataConnection metaConnection=ConvertionHelper.convert(dbConn);
      dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
      sqlConn=MetadataConnectionUtils.checkConnection(metaConnection).getObject();
      DatabaseMetaData databaseMetaData=ExtractMetaDataUtils.getDatabaseMetaData(sqlConn,dbConn,false);
      if (sqlConn != null) {
        MetadataFillFactory.getDBInstance().fillCatalogs(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,true));
        MetadataFillFactory.getDBInstance().fillSchemas(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,false));
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (derbyDriver != null) {
      try {
        derbyDriver.connect("String_Node_Str",null);
      }
 catch (      SQLException e) {
      }
    }
  }
  return dbConn;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "fillDbConnectionInformation".
 * @param dbConn
 * @return
 */
public static DatabaseConnection fillDbConnectionInformation(DatabaseConnection dbConn){
  boolean noStructureExists=ConnectionHelper.getAllCatalogs(dbConn).isEmpty() && ConnectionHelper.getAllSchemas(dbConn).isEmpty();
  java.sql.Connection sqlConn=null;
  try {
    if (noStructureExists) {
      IMetadataConnection metaConnection=ConvertionHelper.convert(dbConn);
      dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
      sqlConn=MetadataConnectionUtils.checkConnection(metaConnection).getObject();
      DatabaseMetaData databaseMetaData=ExtractMetaDataUtils.getDatabaseMetaData(sqlConn,dbConn,false);
      if (sqlConn != null) {
        MetadataFillFactory.getDBInstance().fillCatalogs(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,true));
        if (!ConnectionUtils.isSybase(databaseMetaData)) {
          MetadataFillFactory.getDBInstance().fillSchemas(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,false));
        }
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (derbyDriver != null) {
      try {
        derbyDriver.connect("String_Node_Str",null);
      }
 catch (      SQLException e) {
      }
    }
  }
  return dbConn;
}
Program: 128542
Project: 128542
Buggy source:
/** 
 * DOC zshen Comment method "isSybase".
 * @param connection
 * @return decide to whether is sybase connection
 * @throws SQLException
 */
public static boolean isSybase(java.sql.Connection connection) throws SQLException {
  DatabaseMetaData connectionMetadata=connection.getMetaData();
  if (connectionMetadata.getDriverName() != null && connectionMetadata.getDatabaseProductName() != null) {
    for (    String keyString : getSybaseDBProductsName()) {
      if (keyString.equals(connectionMetadata.getDatabaseProductName().trim())) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isSybase(DatabaseMetaData metadata){
  boolean result=false;
  if (metadata != null && "String_Node_Str".equals(metadata.getClass().getName())) {
    result=true;
  }
  return result;
}
Program: 128543
Project: 128543
Buggy source:
public synchronized void updateStatOnConnection(String connectionId,int mode,String exec){
  StatBean bean;
  StringBuffer key=new StringBuffer();
  key.append(connectionId + "String_Node_Str" + mode);
  if (connectionId.startsWith("String_Node_Str")) {
    key.delete(0,key.length());
    key.append(connectionId + "String_Node_Str" + mode+ "String_Node_Str"+ exec);
  }
 else {
    if (connectionId.contains("String_Node_Str")) {
      String firstKey=null;
      String connectionName=connectionId.split("String_Node_Str")[0];
      int nbKeys=0;
      for (      String myKey : keysList) {
        if (myKey.startsWith(connectionName + "String_Node_Str")) {
          if (firstKey == null) {
            firstKey=myKey;
          }
          nbKeys++;
          if (nbKeys == 4) {
            break;
          }
        }
      }
      if (nbKeys == 4) {
        keysList.remove(firstKey);
      }
    }
  }
  if (keysList.contains(key)) {
    keysList.remove(key);
  }
  keysList.add(key.toString());
  if (processStats.containsKey(key)) {
    bean=processStats.get(key);
  }
 else {
    bean=new StatBean(connectionId);
  }
  bean.setState(mode);
  bean.setExec(exec);
  processStats.put(key.toString(),bean);
  long newStatsUpdate=System.currentTimeMillis();
  if (lastStatsUpdate == 0 || lastStatsUpdate + 250 < newStatsUpdate) {
    sendMessages();
    lastStatsUpdate=newStatsUpdate;
  }
}

Fixed version (ground truth):
public synchronized void updateStatOnConnection(String connectionId,int mode,String exec){
  StatBean bean;
  String key=connectionId + "String_Node_Str" + mode;
  if (connectionId.startsWith("String_Node_Str")) {
    key=connectionId + "String_Node_Str" + mode+ "String_Node_Str"+ exec;
  }
 else {
    if (connectionId.contains("String_Node_Str")) {
      String firstKey=null;
      String connectionName=connectionId.split("String_Node_Str")[0];
      int nbKeys=0;
      for (      String myKey : keysList) {
        if (myKey.startsWith(connectionName + "String_Node_Str")) {
          if (firstKey == null) {
            firstKey=myKey;
          }
          nbKeys++;
          if (nbKeys == 4) {
            break;
          }
        }
      }
      if (nbKeys == 4) {
        keysList.remove(firstKey);
      }
    }
  }
  if (keysList.contains(key)) {
    keysList.remove(key);
  }
  keysList.add(key);
  if (processStats.containsKey(key)) {
    bean=processStats.get(key);
  }
 else {
    bean=new StatBean(connectionId);
  }
  bean.setState(mode);
  bean.setExec(exec);
  processStats.put(key,bean);
  long newStatsUpdate=System.currentTimeMillis();
  if (lastStatsUpdate == 0 || lastStatsUpdate + 250 < newStatsUpdate) {
    sendMessages();
    lastStatsUpdate=newStatsUpdate;
  }
}
Program: 128546
Project: 128546
Buggy source:
public static void clearCache(){
}

Fixed version (ground truth):
@Deprecated public static void clearCache(){
}
Program: 128547
Project: 128547
Buggy source:
/** 
 * DOC sgandon Comment method "refreshTopLevelNodes".
 */
protected void refreshTopLevelNodes(){
  for (  RepositoryNode topLevelNode : getTopLevelNodes()) {
    refreshTopLevelNode(topLevelNode);
  }
}

Fixed version (ground truth):
/** 
 * DOC sgandon Comment method "refreshTopLevelNodes".
 */
protected void refreshTopLevelNodes(){
  Set<RepositoryNode> topLevelNodes=getTopLevelNodes();
  if (topLevelNodes == null) {
    return;
  }
  for (  RepositoryNode topLevelNode : getTopLevelNodes()) {
    refreshTopLevelNode(topLevelNode);
  }
}
Program: 128550
Project: 128550
Buggy source:
public Map<String,List<String>> getRoutineAndJars();

Fixed version (ground truth):
public Map<String,List<LibraryInfo>> getRoutineAndJars();
Program: 128551
Project: 128551
Buggy source:
/** 
 * FIX(double) expression Rounds given double numbers to the closest long. {talendTypes} long | Long {Category} DataOperation {param} double (0.0) d:double number {example} FIX(3.14)
 */
public static long FIX(double d){
  return Math.round(d);
}

Fixed version (ground truth):
/** 
 * FIX(double) Rounds a number of type Double to a number of type Long with the precision specified in the PRECISION statement. {talendTypes} long | Long {Category} DataOperation {param} double (0.0) d:double number {example} FIX(3.14)
 */
public static long FIX(double d){
  return Math.round(d);
}
Program: 128552
Project: 128552
Buggy source:
/** 
 * DOC xqliu Comment method "fillDbConnectionInformation".
 * @param dbConn
 * @return
 */
public static DatabaseConnection fillDbConnectionInformation(DatabaseConnection dbConn){
  boolean noStructureExists=ConnectionHelper.getAllCatalogs(dbConn).isEmpty() && ConnectionHelper.getAllSchemas(dbConn).isEmpty();
  java.sql.Connection sqlConn=null;
  try {
    if (noStructureExists) {
      IMetadataConnection metaConnection=MetadataFillFactory.getDBInstance().fillUIParams(dbConn);
      String databaseType=metaConnection.getDbType();
      dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
      sqlConn=MetadataConnectionUtils.checkConnection(metaConnection).getObject();
      DatabaseMetaData databaseMetaData=ExtractMetaDataUtils.getDatabaseMetaData(sqlConn,dbConn,false);
      if (sqlConn != null) {
        MetadataFillFactory.getDBInstance().fillCatalogs(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,true));
        MetadataFillFactory.getDBInstance().fillSchemas(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,false));
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (derbyDriver != null) {
      try {
        derbyDriver.connect("String_Node_Str",null);
      }
 catch (      SQLException e) {
      }
    }
  }
  return dbConn;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "fillDbConnectionInformation".
 * @param dbConn
 * @return
 */
public static DatabaseConnection fillDbConnectionInformation(DatabaseConnection dbConn){
  boolean noStructureExists=ConnectionHelper.getAllCatalogs(dbConn).isEmpty() && ConnectionHelper.getAllSchemas(dbConn).isEmpty();
  java.sql.Connection sqlConn=null;
  try {
    if (noStructureExists) {
      IMetadataConnection metaConnection=MetadataFillFactory.getDBInstance().fillUIParams(dbConn);
      String databaseType=metaConnection.getDbType();
      dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
      sqlConn=MetadataConnectionUtils.checkConnection(metaConnection).getObject();
      DatabaseMetaData databaseMetaData=ExtractMetaDataUtils.getDatabaseMetaData(sqlConn,dbConn,false);
      if (sqlConn != null) {
        MetadataFillFactory.getDBInstance().fillCatalogs(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,true));
        if (!ConnectionUtils.isSybase(databaseMetaData)) {
          MetadataFillFactory.getDBInstance().fillSchemas(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,false));
        }
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (derbyDriver != null) {
      try {
        derbyDriver.connect("String_Node_Str",null);
      }
 catch (      SQLException e) {
      }
    }
  }
  return dbConn;
}
Program: 128553
Project: 128553
Buggy source:
/** 
 * DOC zshen Comment method "isSybase".
 * @param connection
 * @return decide to whether is sybase connection
 * @throws SQLException
 */
public static boolean isSybase(java.sql.Connection connection) throws SQLException {
  DatabaseMetaData connectionMetadata=connection.getMetaData();
  if (connectionMetadata.getDriverName() != null && connectionMetadata.getDatabaseProductName() != null) {
    for (    String keyString : getSybaseDBProductsName()) {
      if (keyString.equals(connectionMetadata.getDatabaseProductName().trim())) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isSybase(DatabaseMetaData metadata){
  boolean result=false;
  if (metadata != null && "String_Node_Str".equals(metadata.getClass().getName())) {
    result=true;
  }
  return result;
}
Program: 128554
Project: 128554
Buggy source:
public synchronized void updateStatOnConnection(String connectionId,int mode,String exec){
  StatBean bean;
  String key=connectionId + "String_Node_Str" + mode;
  if (connectionId.startsWith("String_Node_Str")) {
    key=connectionId + "String_Node_Str" + mode+ "String_Node_Str"+ exec;
  }
 else {
    if (connectionId.contains("String_Node_Str")) {
      String firstKey=null;
      String connectionName=connectionId.split("String_Node_Str")[0];
      int nbKeys=0;
      for (      String myKey : keysList) {
        if (myKey.startsWith(connectionName + "String_Node_Str")) {
          if (firstKey == null) {
            firstKey=myKey;
          }
          nbKeys++;
          if (nbKeys == 4) {
            break;
          }
        }
      }
      if (nbKeys == 4) {
        keysList.remove(firstKey);
      }
    }
  }
  if (keysList.contains(key)) {
    keysList.remove(key);
  }
  keysList.add(key);
  if (processStats.containsKey(key)) {
    bean=processStats.get(key);
  }
 else {
    bean=new StatBean(connectionId);
  }
  bean.setState(mode);
  bean.setExec(exec);
  processStats.put(key,bean);
  long newStatsUpdate=System.currentTimeMillis();
  if (lastStatsUpdate == 0 || lastStatsUpdate + 250 < newStatsUpdate) {
    sendMessages();
    lastStatsUpdate=newStatsUpdate;
  }
}

Fixed version (ground truth):
public synchronized void updateStatOnConnection(String connectionId,int mode,String exec){
  StatBean bean;
  StringBuffer key=new StringBuffer();
  key.append(connectionId + "String_Node_Str" + mode);
  if (connectionId.startsWith("String_Node_Str")) {
    key.delete(0,key.length());
    key.append(connectionId + "String_Node_Str" + mode+ "String_Node_Str"+ exec);
  }
 else {
    if (connectionId.contains("String_Node_Str")) {
      String firstKey=null;
      String connectionName=connectionId.split("String_Node_Str")[0];
      int nbKeys=0;
      for (      String myKey : keysList) {
        if (myKey.startsWith(connectionName + "String_Node_Str")) {
          if (firstKey == null) {
            firstKey=myKey;
          }
          nbKeys++;
          if (nbKeys == 4) {
            break;
          }
        }
      }
      if (nbKeys == 4) {
        keysList.remove(firstKey);
      }
    }
  }
  if (keysList.contains(key)) {
    keysList.remove(key);
  }
  keysList.add(key.toString());
  if (processStats.containsKey(key)) {
    bean=processStats.get(key);
  }
 else {
    bean=new StatBean(connectionId);
  }
  bean.setState(mode);
  bean.setExec(exec);
  processStats.put(key.toString(),bean);
  long newStatsUpdate=System.currentTimeMillis();
  if (lastStatsUpdate == 0 || lastStatsUpdate + 250 < newStatsUpdate) {
    sendMessages();
    lastStatsUpdate=newStatsUpdate;
  }
}
Program: 128558
Project: 128558
Buggy source:
/** 
 * FIX( ) Rounds an expression to a decimal number having the accuracy specified by the PRECISION statement. {talendTypes} long | Long {Category} DataOperation {param} double (0.0) d:decimal number {example} FIX(3.14)
 */
public static long FIX(double d){
  return Math.round(d);
}

Fixed version (ground truth):
/** 
 * FIX(double) expression Rounds given double numbers to the closest long. {talendTypes} long | Long {Category} DataOperation {param} double (0.0) d:double number {example} FIX(3.14)
 */
public static long FIX(double d){
  return Math.round(d);
}
Program: 128559
Project: 128559
Buggy source:
@Override public boolean performDrop(final Object data){
  int operation=getCurrentOperation();
  final RepositoryNode targetNode=(RepositoryNode)getCurrentTarget();
  boolean toReturn=true;
  try {
switch (operation) {
case DND.DROP_COPY:
      RunnableWithReturnValue runnable=new CopyRunnable(Messages.getString("String_Node_Str"),data,targetNode);
    runInProgressDialog(runnable);
  toReturn=(Boolean)runnable.getReturnValue();
break;
case DND.DROP_MOVE:
runnable=new MoveRunnable(Messages.getString("String_Node_Str"),data,targetNode);
runInProgressDialog(runnable);
toReturn=(Boolean)runnable.getReturnValue();
break;
case DND.DROP_DEFAULT:
if (event.detail == DND.DROP_COPY) {
runnable=new CopyRunnable(Messages.getString("String_Node_Str"),data,targetNode);
runInProgressDialog(runnable);
toReturn=(Boolean)runnable.getReturnValue();
break;
}
if (event.detail == DND.DROP_MOVE) {
runnable=new MoveRunnable(Messages.getString("String_Node_Str"),data,targetNode);
runInProgressDialog(runnable);
toReturn=(Boolean)runnable.getReturnValue();
break;
}
default :
}
}
 catch (Exception e) {
ExceptionHandler.process(e);
}
return toReturn;
}

Fixed version (ground truth):
@Override public boolean performDrop(final Object data){
  int operation=getCurrentOperation();
  final RepositoryNode targetNode=(RepositoryNode)getCurrentTarget();
  boolean toReturn=true;
  try {
switch (operation) {
case DND.DROP_COPY:
      RunnableWithReturnValue runnable=new CopyRunnable(Messages.getString("String_Node_Str"),data,targetNode);
    runCopy(data,targetNode);
  break;
case DND.DROP_MOVE:
runnable=new MoveRunnable(Messages.getString("String_Node_Str"),data,targetNode);
runInProgressDialog(runnable);
toReturn=(Boolean)runnable.getReturnValue();
break;
case DND.DROP_DEFAULT:
if (event.detail == DND.DROP_COPY) {
runnable=new CopyRunnable(Messages.getString("String_Node_Str"),data,targetNode);
runInProgressDialog(runnable);
toReturn=(Boolean)runnable.getReturnValue();
break;
}
if (event.detail == DND.DROP_MOVE) {
runnable=new MoveRunnable(Messages.getString("String_Node_Str"),data,targetNode);
runInProgressDialog(runnable);
toReturn=(Boolean)runnable.getReturnValue();
break;
}
default :
}
}
 catch (Exception e) {
ExceptionHandler.process(e);
}
return toReturn;
}
Program: 128560
Project: 128560
Buggy source:
@Override public void fillActionBars(IActionBars actionBars){
  super.fillActionBars(actionBars);
  actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),CopyAction.getInstance());
  actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),PasteAction.getInstance());
  actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),DeleteAction.getInstance());
  TextActionHandler textActionHandler=new TextActionHandler(actionBars);
  textActionHandler.setCopyAction(CopyAction.getInstance());
  textActionHandler.setPasteAction(PasteAction.getInstance());
  textActionHandler.setDeleteAction(DeleteAction.getInstance());
}

Fixed version (ground truth):
@Override public void fillActionBars(IActionBars actionBars){
  super.fillActionBars(actionBars);
  CopyAction copyActionInstance=CopyAction.getInstance();
  PasteAction pasteActionInstance=PasteAction.getInstance();
  actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),copyActionInstance);
  actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),pasteActionInstance);
  actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),DeleteAction.getInstance());
  if (copyActionInstance != null && pasteActionInstance != null && getContext() != null && getContext().getSelection() instanceof IStructuredSelection) {
    IStructuredSelection sel=(IStructuredSelection)getContext().getSelection();
    if (sel != null) {
      copyActionInstance.init(null,sel);
      pasteActionInstance.init(null,sel);
    }
  }
  TextActionHandler textActionHandler=new TextActionHandler(actionBars);
  textActionHandler.setCopyAction(copyActionInstance);
  textActionHandler.setPasteAction(pasteActionInstance);
  textActionHandler.setDeleteAction(DeleteAction.getInstance());
}
Program: 128561
Project: 128561
Buggy source:
/** 
 * DOC sgandon Comment method "refreshTopLevelNodes".
 */
protected void refreshTopLevelNodes(){
  for (  RepositoryNode topLevelNode : getTopLevelNodes()) {
    refreshTopLevelNode(topLevelNode);
  }
}

Fixed version (ground truth):
/** 
 * DOC sgandon Comment method "refreshTopLevelNodes".
 */
protected void refreshTopLevelNodes(){
  Set<RepositoryNode> topLevelNodes=getTopLevelNodes();
  if (topLevelNodes == null) {
    return;
  }
  for (  RepositoryNode topLevelNode : topLevelNodes) {
    refreshTopLevelNode(topLevelNode);
  }
}
Program: 128562
Project: 128562
Buggy source:
public static Object invokeStaticMethod(String className,String methodName,Object[] args){
  return invokeStaticMethod(className,null,methodName,args);
}

Fixed version (ground truth):
public static Object invokeStaticMethod(String className,String methodName,Object[] args) throws SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
  return invokeStaticMethod(className,null,methodName,args);
}
Program: 128563
Project: 128563
Buggy source:
/** 
 * DOC ycbai Comment method "getPrivateField". Returns the value of a private field.
 * @param owner
 * @param fieldName
 * @return
 */
public static Object getPrivateField(Object owner,String fieldName){
  Object fieldValue=null;
  Class ownerClass=owner.getClass();
  try {
    Field f=ownerClass.getDeclaredField(fieldName);
    f.setAccessible(true);
    fieldValue=f.get(owner);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
  return fieldValue;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getPrivateField". Returns the value of a private field.
 * @param owner
 * @param fieldName
 * @return
 * @throws NoSuchFieldException
 * @throws SecurityException
 * @throws IllegalAccessException
 * @throws IllegalArgumentException
 */
public static Object getPrivateField(Object owner,String fieldName) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
  Object fieldValue=null;
  Class ownerClass=owner.getClass();
  Field f=ownerClass.getDeclaredField(fieldName);
  f.setAccessible(true);
  fieldValue=f.get(owner);
  return fieldValue;
}
Program: 128564
Project: 128564
Buggy source:
public static Object newInstance(String className,Object[] args){
  return newInstance(className,null,args);
}

Fixed version (ground truth):
public static Object newInstance(String className,Object[] args) throws SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
  return newInstance(className,null,args);
}
Program: 128565
Project: 128565
Buggy source:
/** 
 * DOC ycbai Comment method "getPublicField". Returns the value of a public field.
 * @param owner
 * @param fieldName
 * @return
 * @throws Exception
 */
public static Object getPublicField(Object owner,String fieldName){
  Object fieldValue=null;
  Class ownerClass=owner.getClass();
  try {
    Field field=ownerClass.getField(fieldName);
    fieldValue=field.get(owner);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
  return fieldValue;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getPublicField". Returns the value of a public field.
 * @param owner
 * @param fieldName
 * @return
 * @throws NoSuchFieldException
 * @throws SecurityException
 * @throws IllegalAccessException
 * @throws IllegalArgumentException
 * @throws Exception
 */
public static Object getPublicField(Object owner,String fieldName) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
  Object fieldValue=null;
  Class ownerClass=owner.getClass();
  Field field=ownerClass.getField(fieldName);
  fieldValue=field.get(owner);
  return fieldValue;
}
Program: 128566
Project: 128566
Buggy source:
/** 
 * DOC ycbai Comment method "invokeMethod". Returns the value of a method.
 * @param owner
 * @param methodName
 * @param args
 * @return
 */
public static Object invokeMethod(Object owner,String methodName,Object[] args){
  Object returnValue=null;
  Class ownerClass=owner.getClass();
  Class[] argsClass=new Class[args.length];
  for (int i=0, j=args.length; i < j; i++) {
    argsClass[i]=args[i].getClass();
  }
  try {
    Method method=ownerClass.getMethod(methodName,argsClass);
    returnValue=method.invoke(owner,args);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
  return returnValue;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "invokeMethod". Returns the value of a method.
 * @param owner
 * @param methodName
 * @param args
 * @return
 * @throws NoSuchMethodException
 * @throws SecurityException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 * @throws IllegalArgumentException
 */
public static Object invokeMethod(Object owner,String methodName,Object[] args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
  Object returnValue=null;
  Class ownerClass=owner.getClass();
  Class[] argsClass=new Class[args.length];
  for (int i=0, j=args.length; i < j; i++) {
    argsClass[i]=args[i].getClass();
  }
  Method method=ownerClass.getMethod(methodName,argsClass);
  returnValue=method.invoke(owner,args);
  return returnValue;
}
Program: 128567
Project: 128567
Buggy source:
public static Object getStaticField(String className,String fieldName){
  return getStaticField(className,null,fieldName);
}

Fixed version (ground truth):
public static Object getStaticField(String className,String fieldName) throws SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
  return getStaticField(className,null,fieldName);
}
Program: 128568
Project: 128568
Buggy source:
/** 
 * DOC cantoine. Method to return DatabaseMetaData of a DB connection.
 * @param Connection conn
 * @param isSqlMode whether is sqlMode
 * @param String dbType
 * @return DatabaseMetaData
 */
public static DatabaseMetaData getDatabaseMetaData(Connection conn,String dbType,boolean isSqlMode,String database){
  DatabaseMetaData dbMetaData=null;
  if (conn != null) {
    try {
      if (MSSQL_CONN_CLASS.equals(conn.getClass().getName())) {
        dbMetaData=createJtdsDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.IBMDB2ZOS.getXmlName().equals(dbType)) {
        dbMetaData=createDB2ForZosFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.TERADATA.getXmlName().equals(dbType) && isSqlMode) {
        dbMetaData=createTeradataFakeDatabaseMetaData(conn);
        TeradataDataBaseMetadata teraDbmeta=(TeradataDataBaseMetadata)dbMetaData;
        teraDbmeta.setDatabaseName(database);
      }
 else       if (EDatabaseTypeName.SAS.getXmlName().equals(dbType)) {
        dbMetaData=createSASFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.SYBASEASE.getDisplayName().equals(dbType)) {
        dbMetaData=createSybaseFakeDatabaseMetaData(conn);
      }
 else {
        dbMetaData=conn.getMetaData();
      }
    }
 catch (    SQLException e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
catch (    Exception e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
  }
  return dbMetaData;
}

Fixed version (ground truth):
/** 
 * DOC cantoine. Method to return DatabaseMetaData of a DB connection.
 * @param Connection conn
 * @param isSqlMode whether is sqlMode
 * @param String dbType
 * @return DatabaseMetaData
 */
public static DatabaseMetaData getDatabaseMetaData(Connection conn,String dbType,boolean isSqlMode,String database){
  DatabaseMetaData dbMetaData=null;
  if (conn != null) {
    try {
      if (MSSQL_CONN_CLASS.equals(conn.getClass().getName())) {
        dbMetaData=createJtdsDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.IBMDB2ZOS.getXmlName().equals(dbType)) {
        dbMetaData=createDB2ForZosFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.TERADATA.getXmlName().equals(dbType) && isSqlMode) {
        dbMetaData=createTeradataFakeDatabaseMetaData(conn);
        TeradataDataBaseMetadata teraDbmeta=(TeradataDataBaseMetadata)dbMetaData;
        teraDbmeta.setDatabaseName(database);
      }
 else       if (EDatabaseTypeName.SAS.getXmlName().equals(dbType)) {
        dbMetaData=createSASFakeDatabaseMetaData(conn);
      }
 else       if (EDatabaseTypeName.SYBASEASE.getDisplayName().equals(dbType) || SYBASE_DATABASE_PRODUCT_NAME.equals(dbType)) {
        dbMetaData=createSybaseFakeDatabaseMetaData(conn);
      }
 else {
        dbMetaData=conn.getMetaData();
      }
    }
 catch (    SQLException e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
catch (    Exception e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
  }
  return dbMetaData;
}
Program: 128569
Project: 128569
Buggy source:
/** 
 * DOC xqliu Comment method "fillDbConnectionInformation".
 * @param dbConn
 * @return
 */
public static DatabaseConnection fillDbConnectionInformation(DatabaseConnection dbConn){
  boolean noStructureExists=ConnectionHelper.getAllCatalogs(dbConn).isEmpty() && ConnectionHelper.getAllSchemas(dbConn).isEmpty();
  java.sql.Connection sqlConn=null;
  try {
    if (noStructureExists) {
      IMetadataConnection metaConnection=ConvertionHelper.convert(dbConn);
      dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
      sqlConn=MetadataConnectionUtils.checkConnection(metaConnection).getObject();
      DatabaseMetaData databaseMetaData=ExtractMetaDataUtils.getDatabaseMetaData(sqlConn,dbConn,false);
      if (sqlConn != null) {
        MetadataFillFactory.getDBInstance().fillCatalogs(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,true));
        MetadataFillFactory.getDBInstance().fillSchemas(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,false));
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (derbyDriver != null) {
      try {
        derbyDriver.connect("String_Node_Str",null);
      }
 catch (      SQLException e) {
      }
    }
  }
  return dbConn;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "fillDbConnectionInformation".
 * @param dbConn
 * @return
 */
public static DatabaseConnection fillDbConnectionInformation(DatabaseConnection dbConn){
  boolean noStructureExists=ConnectionHelper.getAllCatalogs(dbConn).isEmpty() && ConnectionHelper.getAllSchemas(dbConn).isEmpty();
  java.sql.Connection sqlConn=null;
  try {
    if (noStructureExists) {
      IMetadataConnection metaConnection=ConvertionHelper.convert(dbConn);
      dbConn=(DatabaseConnection)MetadataFillFactory.getDBInstance().fillUIConnParams(metaConnection,dbConn);
      sqlConn=MetadataConnectionUtils.checkConnection(metaConnection).getObject();
      DatabaseMetaData databaseMetaData=ExtractMetaDataUtils.getDatabaseMetaData(sqlConn,dbConn,false);
      if (sqlConn != null) {
        MetadataFillFactory.getDBInstance().fillCatalogs(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,true));
        if (!ConnectionUtils.isSybase(databaseMetaData)) {
          MetadataFillFactory.getDBInstance().fillSchemas(dbConn,databaseMetaData,MetadataConnectionUtils.getPackageFilter(dbConn,databaseMetaData,false));
        }
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
 finally {
    if (derbyDriver != null) {
      try {
        derbyDriver.connect("String_Node_Str",null);
      }
 catch (      SQLException e) {
      }
    }
  }
  return dbConn;
}
Program: 128570
Project: 128570
Buggy source:
/** 
 * DOC zshen Comment method "isSybase".
 * @param connection
 * @return decide to whether is sybase connection
 * @throws SQLException
 */
public static boolean isSybase(java.sql.Connection connection) throws SQLException {
  DatabaseMetaData connectionMetadata=connection.getMetaData();
  if (connectionMetadata.getDriverName() != null && connectionMetadata.getDatabaseProductName() != null) {
    for (    String keyString : getSybaseDBProductsName()) {
      if (keyString.equals(connectionMetadata.getDatabaseProductName().trim())) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isSybase(DatabaseMetaData metadata){
  boolean result=false;
  if (metadata != null && "String_Node_Str".equals(metadata.getClass().getName())) {
    result=true;
  }
  return result;
}
Program: 128571
Project: 128571
Buggy source:
@Override protected void doRun(){
  IStructuredSelection selection=(IStructuredSelection)getSelection();
  promptForSavingIfNecessary((RepositoryNode)selection.getFirstElement());
  LocalSelectionTransfer.getTransfer().setSelection(selection);
  LocalSelectionTransfer.getTransfer().setSelectionSetTime(System.currentTimeMillis());
}

Fixed version (ground truth):
@Override protected void doRun(){
  IStructuredSelection selection=(IStructuredSelection)getSelection();
  promptForSavingIfNecessary((RepositoryNode)selection.getFirstElement());
  LocalSelectionTransfer.getTransfer().setSelection(selection);
  LocalSelectionTransfer.getTransfer().setSelectionSetTime(System.currentTimeMillis());
  PasteAction pasteActionInstance=PasteAction.getInstance();
  if (pasteActionInstance != null) {
    pasteActionInstance.init(null,selection);
  }
}
Program: 128573
Project: 128573
Buggy source:
@Override public void fillActionBars(IActionBars actionBars){
  super.fillActionBars(actionBars);
  CopyAction copyActionInstance=CopyAction.getInstance();
  PasteAction pasteActionInstance=PasteAction.getInstance();
  actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),copyActionInstance);
  actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),pasteActionInstance);
  actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),DeleteAction.getInstance());
  if (copyActionInstance != null && pasteActionInstance != null && getContext() != null && getContext().getSelection() instanceof IStructuredSelection) {
    IStructuredSelection sel=(IStructuredSelection)getContext().getSelection();
    if (sel != null) {
      copyActionInstance.init(null,sel);
      pasteActionInstance.init(null,sel);
    }
  }
  TextActionHandler textActionHandler=new TextActionHandler(actionBars);
  textActionHandler.setCopyAction(copyActionInstance);
  textActionHandler.setPasteAction(pasteActionInstance);
  textActionHandler.setDeleteAction(DeleteAction.getInstance());
}

Fixed version (ground truth):
@Override public void fillActionBars(IActionBars actionBars){
  super.fillActionBars(actionBars);
  CopyAction copyActionInstance=CopyAction.getInstance();
  PasteAction pasteActionInstance=PasteAction.getInstance();
  actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),copyActionInstance);
  actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),pasteActionInstance);
  actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),DeleteAction.getInstance());
  if (copyActionInstance != null && pasteActionInstance != null && getContext() != null && getContext().getSelection() instanceof IStructuredSelection) {
    IStructuredSelection sel=(IStructuredSelection)getContext().getSelection();
    if (sel != null) {
      copyActionInstance.init(null,sel);
    }
  }
  TextActionHandler textActionHandler=new TextActionHandler(actionBars);
  textActionHandler.setCopyAction(copyActionInstance);
  textActionHandler.setPasteAction(pasteActionInstance);
  textActionHandler.setDeleteAction(DeleteAction.getInstance());
}
Program: 128575
Project: 128575
Buggy source:
public ResultSet getSchemas() throws SQLException {
  java.sql.Statement statement=connection.createStatement();
  String sql;
  if (connection.getDatabaseMajorVersion() >= 9) {
    sql=Driver.JDBC3 ? "String_Node_Str" + connection.getCatalog() + "String_Node_Str" : "String_Node_Str" + connection.getCatalog() + "String_Node_Str";
  }
 else {
    sql=Driver.JDBC3 ? "String_Node_Str" : "String_Node_Str";
  }
  sql+="String_Node_Str";
  return statement.executeQuery(sql);
}

Fixed version (ground truth):
@Override public ResultSet getSchemas() throws SQLException {
  java.sql.Statement statement=connection.createStatement();
  String sql;
  if (connection.getDatabaseMajorVersion() >= 9) {
    sql=Driver.JDBC3 ? "String_Node_Str" + connection.getCatalog() + "String_Node_Str" : "String_Node_Str" + connection.getCatalog() + "String_Node_Str";
  }
 else {
    sql=Driver.JDBC3 ? "String_Node_Str" : "String_Node_Str";
  }
  sql+="String_Node_Str";
  return statement.executeQuery(sql);
}
Program: 128576
Project: 128576
Buggy source:
public static DatabaseMetaData getConnectionMetadata(java.sql.Connection conn) throws SQLException {
  DatabaseMetaData dbMetaData=conn.getMetaData();
  if (dbMetaData != null && dbMetaData.getDatabaseProductName() != null) {
    if ("String_Node_Str".equals(conn.getClass().getName())) {
      dbMetaData=createJtdsDatabaseMetaData(conn);
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.IBMDB2ZOS.getXmlName())) {
      getDatabaseMetaData(conn,EDatabaseTypeName.IBMDB2ZOS.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.TERADATA.getXmlName())) {
      getDatabaseMetaData(conn,EDatabaseTypeName.TERADATA.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.SAS.getXmlName())) {
      getDatabaseMetaData(conn,EDatabaseTypeName.SAS.getXmlName());
    }
  }
  return dbMetaData;
}

Fixed version (ground truth):
public static DatabaseMetaData getConnectionMetadata(java.sql.Connection conn) throws SQLException {
  DatabaseMetaData dbMetaData=conn.getMetaData();
  if (dbMetaData != null && dbMetaData.getDatabaseProductName() != null) {
    if ("String_Node_Str".equals(conn.getClass().getName())) {
      dbMetaData=createJtdsDatabaseMetaData(conn);
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.IBMDB2ZOS.getXmlName())) {
      dbMetaData=getDatabaseMetaData(conn,EDatabaseTypeName.IBMDB2ZOS.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.TERADATA.getXmlName())) {
      dbMetaData=getDatabaseMetaData(conn,EDatabaseTypeName.TERADATA.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.SAS.getXmlName())) {
      dbMetaData=getDatabaseMetaData(conn,EDatabaseTypeName.SAS.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(SYBASE_DATABASE_PRODUCT_NAME)) {
      dbMetaData=getDatabaseMetaData(conn,SYBASE_DATABASE_PRODUCT_NAME);
    }
  }
  return dbMetaData;
}
Program: 128577
Project: 128577
Buggy source:
/** 
 * DOC cantoine. Method to return DatabaseMetaData of a DB connection.
 * @param Connection conn
 * @param isSqlMode
 * @param DatabaseConnection dbConn
 * @return DatabaseMetaData
 */
public static DatabaseMetaData getDatabaseMetaData(Connection conn,DatabaseConnection dbConn,boolean isSqlMode){
  DatabaseMetaData dbMetaData=null;
  try {
    String dbType=dbConn.getDatabaseType();
    if ("String_Node_Str".equals(conn.getClass().getName())) {
      dbMetaData=createJtdsDatabaseMetaData(conn);
    }
 else     if (dbType.equals(EDatabaseTypeName.IBMDB2ZOS.getXmlName())) {
      dbMetaData=createFakeDatabaseMetaData(conn);
    }
 else     if (dbType.equals(EDatabaseTypeName.TERADATA.getXmlName()) && isSqlMode) {
      String database=dbConn.getSID();
      dbMetaData=createTeradataFakeDatabaseMetaData(conn);
      TeradataDataBaseMetadata teraDbmeta=(TeradataDataBaseMetadata)dbMetaData;
      teraDbmeta.setDatabaseName(database);
    }
 else     if (dbType.equals(EDatabaseTypeName.SAS.getXmlName())) {
      dbMetaData=createSASFakeDatabaseMetaData(conn);
    }
 else     if (EDatabaseTypeName.SYBASEASE.getDisplayName().equals(dbType)) {
      dbMetaData=createSybaseFakeDatabaseMetaData(conn);
    }
 else {
      dbMetaData=conn.getMetaData();
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  return dbMetaData;
}

Fixed version (ground truth):
/** 
 * DOC cantoine. Method to return DatabaseMetaData of a DB connection.
 * @param Connection conn
 * @param isSqlMode
 * @param DatabaseConnection dbConn
 * @return DatabaseMetaData
 */
public static DatabaseMetaData getDatabaseMetaData(Connection conn,DatabaseConnection dbConn,boolean isSqlMode){
  DatabaseMetaData dbMetaData=null;
  try {
    String dbType=dbConn.getDatabaseType();
    if ("String_Node_Str".equals(conn.getClass().getName())) {
      dbMetaData=createJtdsDatabaseMetaData(conn);
    }
 else     if (dbType.equals(EDatabaseTypeName.IBMDB2ZOS.getXmlName())) {
      dbMetaData=createFakeDatabaseMetaData(conn);
    }
 else     if (dbType.equals(EDatabaseTypeName.TERADATA.getXmlName()) && isSqlMode) {
      String database=dbConn.getSID();
      dbMetaData=createTeradataFakeDatabaseMetaData(conn);
      TeradataDataBaseMetadata teraDbmeta=(TeradataDataBaseMetadata)dbMetaData;
      teraDbmeta.setDatabaseName(database);
    }
 else     if (dbType.equals(EDatabaseTypeName.SAS.getXmlName())) {
      dbMetaData=createSASFakeDatabaseMetaData(conn);
    }
 else     if (EDatabaseTypeName.SYBASEASE.getDisplayName().equals(dbType) || SYBASE_DATABASE_PRODUCT_NAME.equals(dbType)) {
      dbMetaData=createSybaseFakeDatabaseMetaData(conn);
    }
 else {
      dbMetaData=conn.getMetaData();
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  return dbMetaData;
}
Program: 128578
Project: 128578
Buggy source:
public static DatabaseMetaData getConnectionMetadata(java.sql.Connection conn) throws SQLException {
  DatabaseMetaData dbMetaData=conn.getMetaData();
  if (dbMetaData != null && dbMetaData.getDatabaseProductName() != null) {
    if ("String_Node_Str".equals(conn.getClass().getName())) {
      dbMetaData=createJtdsDatabaseMetaData(conn);
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.IBMDB2ZOS.getXmlName())) {
      getDatabaseMetaData(conn,EDatabaseTypeName.IBMDB2ZOS.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.TERADATA.getXmlName())) {
      getDatabaseMetaData(conn,EDatabaseTypeName.TERADATA.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.SAS.getXmlName())) {
      getDatabaseMetaData(conn,EDatabaseTypeName.SAS.getXmlName());
    }
  }
  return dbMetaData;
}

Fixed version (ground truth):
public static DatabaseMetaData getConnectionMetadata(java.sql.Connection conn) throws SQLException {
  DatabaseMetaData dbMetaData=conn.getMetaData();
  if (dbMetaData != null && dbMetaData.getDatabaseProductName() != null) {
    if ("String_Node_Str".equals(conn.getClass().getName())) {
      dbMetaData=createJtdsDatabaseMetaData(conn);
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.IBMDB2ZOS.getXmlName())) {
      dbMetaData=getDatabaseMetaData(conn,EDatabaseTypeName.IBMDB2ZOS.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.TERADATA.getXmlName())) {
      dbMetaData=getDatabaseMetaData(conn,EDatabaseTypeName.TERADATA.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(EDatabaseTypeName.SAS.getXmlName())) {
      dbMetaData=getDatabaseMetaData(conn,EDatabaseTypeName.SAS.getXmlName());
    }
 else     if (dbMetaData.getDatabaseProductName().equals(SYBASE_DATABASE_PRODUCT_NAME)) {
      dbMetaData=getDatabaseMetaData(conn,SYBASE_DATABASE_PRODUCT_NAME);
    }
  }
  return dbMetaData;
}