Program: 127159
Project: 127159
Buggy source:
static void setPropertiesForContextMode(String prefixName,DatabaseConnection conn,Set<IConnParamName> paramSet,Map<String,String> map){
  if (conn == null || prefixName == null || paramSet == null || paramSet.isEmpty()) {
    return;
  }
  prefixName=prefixName + ConnectionContextHelper.LINE;
  String originalVariableName=null;
  for (  IConnParamName param : paramSet) {
    if (param instanceof EDBParamName) {
      EDBParamName dbParam=(EDBParamName)param;
      originalVariableName=prefixName + dbParam;
      if (map != null && map.size() > 0) {
        for (        Map.Entry<String,String> entry : map.entrySet()) {
          if (originalVariableName.equals(entry.getValue())) {
            originalVariableName=entry.getKey();
            break;
          }
        }
      }
switch (dbParam) {
case AdditionalParams:
        conn.setAdditionalParams(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
      break;
case Datasource:
    conn.setDatasourceName(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
  break;
case DBRootPath:
conn.setDBRootPath(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case File:
conn.setFileFieldName(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Password:
conn.setPassword(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case JdbcUrl:
conn.setURL(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case DriverJar:
conn.setDriverJarPath(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case MappingFile:
conn.setDbmsId(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case ClassName:
conn.setDriverClass(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Port:
conn.setPort(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Schema:
conn.setUiSchema(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Server:
conn.setServerName(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Sid:
case Database:
case ServiceName:
conn.setSID(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Login:
conn.setUsername(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case JobTracker:
conn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL,ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case NameNode:
conn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL,ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
default :
}
}
}
}

Fixed version (ground truth):
static void setPropertiesForContextMode(String prefixName,DatabaseConnection conn,ContextItem contextItem,Set<IConnParamName> paramSet,Map<String,String> map){
  if (conn == null || contextItem == null || prefixName == null || paramSet == null || paramSet.isEmpty()) {
    return;
  }
  prefixName=prefixName + ConnectionContextHelper.LINE;
  String originalVariableName=null;
  for (  IConnParamName param : paramSet) {
    if (param instanceof EDBParamName) {
      EDBParamName dbParam=(EDBParamName)param;
      originalVariableName=prefixName + dbParam;
      if (map != null && map.size() > 0) {
        for (        Map.Entry<String,String> entry : map.entrySet()) {
          if (originalVariableName.equals(entry.getValue())) {
            originalVariableName=entry.getKey();
            break;
          }
        }
      }
      originalVariableName=getCorrectVariableName(contextItem,originalVariableName,dbParam);
switch (dbParam) {
case AdditionalParams:
        conn.setAdditionalParams(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
      break;
case Datasource:
    conn.setDatasourceName(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
  break;
case DBRootPath:
conn.setDBRootPath(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case File:
conn.setFileFieldName(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Password:
conn.setPassword(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case JdbcUrl:
conn.setURL(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case DriverJar:
conn.setDriverJarPath(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case MappingFile:
conn.setDbmsId(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case ClassName:
conn.setDriverClass(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Port:
conn.setPort(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Schema:
conn.setUiSchema(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Server:
conn.setServerName(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Sid:
case Database:
case ServiceName:
conn.setSID(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case Login:
conn.setUsername(ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case JobTracker:
conn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL,ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
case NameNode:
conn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL,ContextParameterUtils.getNewScriptCode(originalVariableName,LANGUAGE));
break;
default :
}
}
}
}