Program: 125437
Project: 125437
Buggy source:
private static void collectConnVariablesOfAdditionalTable(Set<String> varList,ConnectionItem connectionItem){
  Connection currentConnection=connectionItem.getConnection();
  if (currentConnection instanceof SAPConnection) {
    SAPConnection sapConn=(SAPConnection)currentConnection;
    for (    AdditionalConnectionProperty sapProperty : sapConn.getAdditionalProperties()) {
      varList.add(sapProperty.getPropertyName());
    }
  }
 else   if (currentConnection instanceof DatabaseConnection) {
    DatabaseConnection dbConn=(DatabaseConnection)currentConnection;
    List<Map<String,Object>> hadoopPropertiesList=DBConnectionContextUtils.getHiveOrHbaseHadoopProperties(dbConn);
    if (!hadoopPropertiesList.isEmpty()) {
      for (      Map<String,Object> propertyMap : hadoopPropertiesList) {
        varList.add((String)propertyMap.get("String_Node_Str"));
      }
    }
    List<Map<String,Object>> hiveJdbcPropertiesList=DBConnectionContextUtils.getHiveJdbcProperties(dbConn);
    if (!hiveJdbcPropertiesList.isEmpty()) {
      for (      Map<String,Object> propertyMap : hiveJdbcPropertiesList) {
        varList.add((String)propertyMap.get("String_Node_Str"));
      }
    }
  }
 else {
    Set<String> additionPropertyList=ExtendedNodeConnectionContextUtils.getAdditionalPropertiesVariablesForExistContext(currentConnection);
    Iterator<String> it=additionPropertyList.iterator();
    while (it.hasNext()) {
      String additionalConProperty=it.next();
      varList.add(additionalConProperty);
    }
  }
}

Fixed version (ground truth):
private static void collectConnVariablesOfAdditionalTable(Set<String> varList,ConnectionItem connectionItem){
  Connection currentConnection=connectionItem.getConnection();
  INOSQLService service=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(INOSQLService.class)) {
    service=(INOSQLService)GlobalServiceRegister.getDefault().getService(INOSQLService.class);
  }
  if (service.isUseReplicaSet(currentConnection)) {
    String replicaSets=service.getMongoDBReplicaSets(currentConnection);
    try {
      JSONArray jsa=new JSONArray(replicaSets);
      for (int i=0; i < jsa.length(); i++) {
        int paramNum=i + 1;
        String hostParamName=ExtendedNodeConnectionContextUtils.getReplicaParamName(EHadoopParamName.ReplicaHost,paramNum);
        String portParamName=ExtendedNodeConnectionContextUtils.getReplicaParamName(EHadoopParamName.ReplicaPort,paramNum);
        varList.add(hostParamName);
        varList.add(portParamName);
      }
      if (varList.contains(EHadoopParamName.ReplicaSets.name())) {
        varList.remove(EHadoopParamName.ReplicaSets.name());
      }
    }
 catch (    JSONException e) {
      ExceptionHandler.process(e);
    }
  }
 else   if (currentConnection instanceof SAPConnection) {
    SAPConnection sapConn=(SAPConnection)currentConnection;
    for (    AdditionalConnectionProperty sapProperty : sapConn.getAdditionalProperties()) {
      varList.add(sapProperty.getPropertyName());
    }
  }
 else   if (currentConnection instanceof DatabaseConnection) {
    DatabaseConnection dbConn=(DatabaseConnection)currentConnection;
    List<Map<String,Object>> hadoopPropertiesList=DBConnectionContextUtils.getHiveOrHbaseHadoopProperties(dbConn);
    if (!hadoopPropertiesList.isEmpty()) {
      for (      Map<String,Object> propertyMap : hadoopPropertiesList) {
        varList.add((String)propertyMap.get("String_Node_Str"));
      }
    }
    List<Map<String,Object>> hiveJdbcPropertiesList=DBConnectionContextUtils.getHiveJdbcProperties(dbConn);
    if (!hiveJdbcPropertiesList.isEmpty()) {
      for (      Map<String,Object> propertyMap : hiveJdbcPropertiesList) {
        varList.add((String)propertyMap.get("String_Node_Str"));
      }
    }
  }
 else {
    Set<String> additionPropertyList=ExtendedNodeConnectionContextUtils.getAdditionalPropertiesVariablesForExistContext(currentConnection);
    Iterator<String> it=additionPropertyList.iterator();
    while (it.hasNext()) {
      String additionalConProperty=it.next();
      varList.add(additionalConProperty);
    }
  }
}