Program: 166452
Project: 166452
Buggy source:
public static List<String> getHiveResources(String serviceName,String serviceType,Map<String,String> configs,ResourceLookupContext context) throws Exception {
  String userInput=context.getUserInput();
  String resource=context.getResourceName();
  Map<String,List<String>> resourceMap=context.getResources();
  List<String> resultList=null;
  List<String> databaseList=null;
  List<String> tableList=null;
  List<String> udfList=null;
  List<String> columnList=null;
  String databaseName=null;
  String tableName=null;
  String udfName=null;
  String columnName=null;
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + userInput + "String_Node_Str"+ resource+ "String_Node_Str"+ resourceMap);
  }
  if (userInput != null && resource != null) {
    if (resourceMap != null && !resourceMap.isEmpty()) {
      databaseList=resourceMap.get(DATABASE);
      tableList=resourceMap.get(TABLE);
      udfList=resourceMap.get(UDF);
      columnList=resourceMap.get(COLUMN);
    }
switch (resource.trim().toLowerCase()) {
case DATABASE:
      databaseName=userInput;
    break;
case TABLE:
  tableName=userInput;
break;
case UDF:
udfName=userInput;
break;
case COLUMN:
columnName=userInput;
break;
default :
break;
}
}
if (serviceName != null && userInput != null) {
try {
if (LOG.isDebugEnabled()) {
LOG.debug("String_Node_Str" + userInput + "String_Node_Str"+ configs+ "String_Node_Str"+ databaseList+ "String_Node_Str"+ tableList+ "String_Node_Str"+ columnList);
}
final HiveClient hiveClient=new HiveConnectionMgr().getHiveConnection(serviceName,serviceType,configs);
Callable<List<String>> callableObj=null;
final String finalDbName;
final String finalColName;
final String finalTableName;
final List<String> finaldatabaseList=databaseList;
final List<String> finaltableList=tableList;
final List<String> finaludfList=udfList;
final List<String> finalcolumnList=columnList;
if (hiveClient != null) {
if (databaseName != null && !databaseName.isEmpty()) {
databaseName+="String_Node_Str";
finalDbName=databaseName;
callableObj=new Callable<List<String>>(){
@Override public List<String> call(){
return hiveClient.getDatabaseList(finalDbName,finaldatabaseList);
}
}
;
}
 else if (tableName != null && !tableName.isEmpty()) {
tableName+="String_Node_Str";
finalTableName=tableName;
callableObj=new Callable<List<String>>(){
@Override public List<String> call(){
return hiveClient.getTableList(finalTableName,finaldatabaseList,finaltableList);
}
}
;
}
 else if (columnName != null && !columnName.isEmpty()) {
columnName+="String_Node_Str";
finalColName=columnName;
finalDbName=databaseName;
finalTableName=tableName;
callableObj=new Callable<List<String>>(){
@Override public List<String> call(){
return hiveClient.getColumnList(finalColName,finaldatabaseList,finaltableList,finalcolumnList);
}
}
;
}
synchronized (hiveClient) {
resultList=TimedEventUtil.timedTask(callableObj,5,TimeUnit.SECONDS);
}
}
}
 catch (Exception e) {
LOG.error("String_Node_Str",e);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("String_Node_Str" + userInput + "String_Node_Str"+ configs+ "String_Node_Str"+ databaseList+ "String_Node_Str"+ tableList+ "String_Node_Str"+ columnList+ "String_Node_Str"+ resultList);
}
return resultList;
}

Fixed version (ground truth):
public static List<String> getHiveResources(String serviceName,String serviceType,Map<String,String> configs,ResourceLookupContext context) throws Exception {
  String userInput=context.getUserInput();
  String resource=context.getResourceName();
  Map<String,List<String>> resourceMap=context.getResources();
  List<String> resultList=null;
  List<String> databaseList=null;
  List<String> tableList=null;
  List<String> udfList=null;
  List<String> columnList=null;
  String databaseName=null;
  String tableName=null;
  String udfName=null;
  String columnName=null;
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + userInput + "String_Node_Str"+ resource+ "String_Node_Str"+ resourceMap);
  }
  if (userInput != null && resource != null) {
    if (resourceMap != null && !resourceMap.isEmpty()) {
      databaseList=resourceMap.get(DATABASE);
      tableList=resourceMap.get(TABLE);
      udfList=resourceMap.get(UDF);
      columnList=resourceMap.get(COLUMN);
    }
switch (resource.trim().toLowerCase()) {
case DATABASE:
      databaseName=userInput;
    break;
case TABLE:
  tableName=userInput;
break;
case UDF:
udfName=userInput;
break;
case COLUMN:
columnName=userInput;
break;
default :
break;
}
}
if (serviceName != null && userInput != null) {
try {
if (LOG.isDebugEnabled()) {
LOG.debug("String_Node_Str" + userInput + "String_Node_Str"+ configs+ "String_Node_Str"+ databaseList+ "String_Node_Str"+ tableList+ "String_Node_Str"+ columnList);
}
final HiveClient hiveClient=new HiveConnectionMgr().getHiveConnection(serviceName,serviceType,configs);
Callable<List<String>> callableObj=null;
final String finalDbName;
final String finalColName;
final String finalTableName;
final List<String> finaldatabaseList=databaseList;
final List<String> finaltableList=tableList;
final List<String> finaludfList=udfList;
final List<String> finalcolumnList=columnList;
if (hiveClient != null) {
if (databaseName != null && !databaseName.isEmpty()) {
databaseName+="String_Node_Str";
finalDbName=databaseName;
callableObj=new Callable<List<String>>(){
@Override public List<String> call(){
return hiveClient.getDatabaseList(finalDbName,finaldatabaseList);
}
}
;
}
 else if (tableName != null && !tableName.isEmpty()) {
tableName+="String_Node_Str";
finalTableName=tableName;
callableObj=new Callable<List<String>>(){
@Override public List<String> call(){
return hiveClient.getTableList(finalTableName,finaldatabaseList,finaltableList);
}
}
;
}
 else if (columnName != null && !columnName.isEmpty()) {
columnName+="String_Node_Str";
finalColName=columnName;
finalDbName=databaseName;
finalTableName=tableName;
callableObj=new Callable<List<String>>(){
@Override public List<String> call(){
return hiveClient.getColumnList(finalColName,finaldatabaseList,finaltableList,finalcolumnList);
}
}
;
}
if (callableObj != null) {
synchronized (hiveClient) {
resultList=TimedEventUtil.timedTask(callableObj,5,TimeUnit.SECONDS);
}
}
 else {
LOG.error("String_Node_Str");
}
}
}
 catch (Exception e) {
LOG.error("String_Node_Str",e);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("String_Node_Str" + userInput + "String_Node_Str"+ configs+ "String_Node_Str"+ databaseList+ "String_Node_Str"+ tableList+ "String_Node_Str"+ columnList+ "String_Node_Str"+ resultList);
}
return resultList;
}