nus-yam/ex-repair huggingface dataset:
Program: 48419
Project: 48419
Buggy source:
public static String generateHostname(NetworkEntity networkEntity,BaseNode vNode) throws BddException {
  String vNodeName=vNode.getVmName();
  Map<NetTrafficType,List<String>> networkConfig=vNode.getCluster().getNetworkConfig();
  String hostname="String_Node_Str";
  for (  Map.Entry<NetTrafficType,List<String>> networkConfigEntry : networkConfig.entrySet()) {
    if (networkConfigEntry.getValue().contains(networkEntity.getName()) && networkEntity.getIsGenerateHostname()) {
      hostname=generateHostnameWithTrafficType(networkConfigEntry.getKey(),vNodeName);
      break;
    }
  }
  return hostname;
}

Fixed version (ground truth):
public static String generateHostname(NetworkEntity networkEntity,BaseNode vNode) throws BddException {
  String vNodeName=vNode.getVmName();
  Map<NetTrafficType,List<String>> networkConfig=vNode.getCluster().getNetworkConfig();
  String hostname="String_Node_Str";
  for (  Map.Entry<NetTrafficType,List<String>> networkConfigEntry : networkConfig.entrySet()) {
    if (networkConfigEntry.getValue().contains(networkEntity.getName()) && networkEntity.getIsGenerateHostname()) {
      hostname=generateHostnameWithTrafficType(networkConfigEntry.getKey(),vNodeName,vNode.getCluster().getHostnamePrefix());
      break;
    }
  }
  return hostname;
}
Program: 48420
Project: 48420
Buggy source:
public static void prettyOutputClusterIp2FqdnMapping(ClusterRead cluster,String filename,String delimeter) throws Exception {
  List<Object> list=new ArrayList<Object>();
  for (  NodeGroupRead nodegroup : cluster.getNodeGroups()) {
    List<NodeRead> nodes=nodegroup.getInstances();
    if (nodes != null && !nodes.isEmpty()) {
      for (      NodeRead node : nodes) {
        if (node.getIpConfigs() != null) {
          for (          NetTrafficType trafficType : node.getIpConfigs().keySet()) {
            list.add(String.format("String_Node_Str",node.fetchIpOf(trafficType)) + "String_Node_Str" + node.fetchFqdnOf(trafficType));
          }
        }
      }
    }
  }
  CommandsUtils.prettyOutputStrings(list,filename,delimeter);
}

Fixed version (ground truth):
public static void prettyOutputClusterIp2FqdnMapping(ClusterRead cluster,String filename,String delimeter) throws Exception {
  List<Object> list=new ArrayList<Object>();
  for (  NodeGroupRead nodegroup : cluster.getNodeGroups()) {
    List<NodeRead> nodes=nodegroup.getInstances();
    if (nodes != null && !nodes.isEmpty()) {
      for (      NodeRead node : nodes) {
        if (node.getIpConfigs() != null) {
          for (          NetTrafficType trafficType : node.getIpConfigs().keySet()) {
            String ip2Fqdn=String.format("String_Node_Str",node.fetchIpOf(trafficType)) + "String_Node_Str" + node.fetchFqdnOf(trafficType);
            if (!list.contains(ip2Fqdn)) {
              list.add(ip2Fqdn);
            }
          }
        }
      }
    }
  }
  CommandsUtils.prettyOutputStrings(list,filename,delimeter);
}
Program: 48421
Project: 48421
Buggy source:
public void modify(UserMgmtServer userMgtServer,boolean testOnly,boolean forceTrustCert){
  serverEao.checkServerChanged(userMgtServer);
  serverValidService.validateServerInfo(userMgtServer,forceTrustCert);
  if (!testOnly) {
    serverEao.modify(userMgtServer);
    modificationHandler.onModification(userMgtServer);
  }
}

Fixed version (ground truth):
public void modify(UserMgmtServer userMgtServer,boolean testOnly,boolean forceTrustCert){
  serverEao.checkServerChanged(userMgtServer);
  serverValidService.validateServerInfo(userMgtServer,forceTrustCert);
  if (!testOnly) {
    modificationHandler.onModification(userMgtServer);
    serverEao.modify(userMgtServer);
  }
}
Program: 48422
Project: 48422
Buggy source:
/** 
 * Gets a property of type double. <br>
 * @param defaultValue The default value.
 * @param key The key of property.
 * @return The property value.
 */
public static Double getDouble(String key,Double defaultValue){
  return config.getDouble(key,defaultValue);
}

Fixed version (ground truth):
/** 
 * Gets a property of type double. <br>
 * @param defaultValue The default value.
 * @param key The key of property.
 * @return The property value.
 */
public static Double getDouble(String key,Double defaultValue){
  try {
    return config.getDouble(key,defaultValue);
  }
 catch (  ConversionException ce) {
    logger.error(key + "String_Node_Str");
  }
  return defaultValue;
}
Program: 48423
Project: 48423
Buggy source:
/** 
 * Gets a property of type Long. <br>
 * @param key The key of property.
 * @param defaultValue The default value.
 * @return The property value.
 */
public static long getLong(String key,long defaultValue){
  return config.getLong(key,defaultValue);
}

Fixed version (ground truth):
/** 
 * Gets a property of type Long. <br>
 * @param key The key of property.
 * @param defaultValue The default value.
 * @return The property value.
 */
public static long getLong(String key,long defaultValue){
  try {
    return config.getLong(key,defaultValue);
  }
 catch (  ConversionException ce) {
    logger.error(key + "String_Node_Str");
  }
  return defaultValue;
}
Program: 48424
Project: 48424
Buggy source:
/** 
 * Gets a property of type int. <br>
 * @param defaultValue The default value.
 * @param key The key of property.
 * @return The property value.
 */
public static int getInt(String key,int defaultValue){
  return config.getInt(key,defaultValue);
}

Fixed version (ground truth):
/** 
 * Gets a property of type int. <br>
 * @param defaultValue The default value.
 * @param key The key of property.
 * @return The property value.
 */
public static int getInt(String key,int defaultValue){
  try {
    return config.getInt(key,defaultValue);
  }
 catch (  ConversionException ce) {
    logger.error(key + "String_Node_Str");
  }
  return defaultValue;
}
Program: 48425
Project: 48425
Buggy source:
/** 
 * Gets a property of type bool. <br>
 * @param defaultValue The default value.
 * @param key The key of property.
 * @return The property value.
 */
public static Boolean getBoolean(String key,Boolean defaultValue){
  return config.getBoolean(key,defaultValue);
}

Fixed version (ground truth):
/** 
 * Gets a property of type bool. <br>
 * @param defaultValue The default value.
 * @param key The key of property.
 * @return The property value.
 */
public static Boolean getBoolean(String key,Boolean defaultValue){
  try {
    return config.getBoolean(key,defaultValue);
  }
 catch (  ConversionException ce) {
    logger.error(key + "String_Node_Str");
  }
  return defaultValue;
}
Program: 48427
Project: 48427
Buggy source:
/** 
 * @param clusterName
 * @param vcRPName
 * @param networkName
 * @param dsNames
 */
@Override @Transactional @RetryTransaction(2) public void addResourceIntoDB(String clusterName,String vcRPName,String networkName,Map<DatastoreType,List<String>> dsNames){
  rpSvc.addResourcePool(DEFAULT_RP,clusterName,vcRPName);
  logger.info("String_Node_Str" + vcRPName);
  if (!dsNames.get(DatastoreType.SHARED).isEmpty()) {
    dsSvc.addDatastores(DEFAULT_DS_SHARED,DatastoreType.SHARED,dsNames.get(DatastoreType.SHARED),false);
  }
 else   if (!dsNames.get(DatastoreType.LOCAL).isEmpty()) {
    dsSvc.addDatastores(DEFAULT_DS_LOCAL,DatastoreType.LOCAL,dsNames.get(DatastoreType.LOCAL),false);
  }
  logger.info("String_Node_Str" + dsNames);
  if (networkName != null) {
    networkSvc.addDhcpNetwork(DEFAULT_NETWORK,networkName,null,false);
    logger.info("String_Node_Str" + networkName);
  }
}

Fixed version (ground truth):
/** 
 * @param clusterName
 * @param vcRPName
 * @param networkName
 * @param dsNames
 */
@Override @Transactional @RetryTransaction(2) public void addResourceIntoDB(String clusterName,String vcRPName,String networkName,Map<DatastoreType,List<String>> dsNames){
  rpSvc.addResourcePool(DEFAULT_RP,clusterName,vcRPName);
  logger.info("String_Node_Str" + vcRPName);
  if (!dsNames.get(DatastoreType.SHARED).isEmpty()) {
    dsSvc.addDatastores(DEFAULT_DS_SHARED,DatastoreType.SHARED,dsNames.get(DatastoreType.SHARED),false);
  }
 else   if (!dsNames.get(DatastoreType.LOCAL).isEmpty()) {
    dsSvc.addDatastores(DEFAULT_DS_LOCAL,DatastoreType.LOCAL,dsNames.get(DatastoreType.LOCAL),false);
  }
  logger.info("String_Node_Str" + dsNames);
  if (networkName != null) {
    networkSvc.addDhcpNetwork(DEFAULT_NETWORK,networkName,NetworkDnsType.NORMAL,false);
    logger.info("String_Node_Str" + networkName);
  }
}
Program: 48428
Project: 48428
Buggy source:
/** 
 * Add an appmanager to BDE
 * @param appManagerAdd
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,consumes="String_Node_Str") @ResponseStatus(HttpStatus.OK) public void addAppManager(@RequestBody final AppManagerAdd appManagerAdd){
  if (appManagerAdd == null) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",null);
  }
  if (CommonUtil.isBlank(appManagerAdd.getName())) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",appManagerAdd.getName());
  }
  softwareManagerCollector.createSoftwareManager(appManagerAdd);
}

Fixed version (ground truth):
/** 
 * Add an appmanager to BDE
 * @param appManagerAdd
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,consumes="String_Node_Str") @ResponseStatus(HttpStatus.OK) public void addAppManager(@RequestBody final AppManagerAdd appManagerAdd){
  if (appManagerAdd == null) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",null);
  }
  if (CommonUtil.isBlank(appManagerAdd.getName()) || !CommonUtil.validateResourceName(appManagerAdd.getName())) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",appManagerAdd.getName());
  }
  softwareManagerCollector.createSoftwareManager(appManagerAdd);
}
Program: 48429
Project: 48429
Buggy source:
public String getBanner(){
  StringBuffer buf=new StringBuffer();
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + this.getVersion());
  return buf.toString();
}

Fixed version (ground truth):
public String getBanner(){
  StringBuilder buf=new StringBuilder();
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + OsUtils.LINE_SEPARATOR);
  buf.append("String_Node_Str" + this.getVersion());
  return buf.toString();
}
Program: 48432
Project: 48432
Buggy source:
public static void gracefulRackTopologyOutput(Map<String,String> racksTopology,String filename,String delimeter) throws Exception {
  List<Object> list=new ArrayList<Object>();
  if (racksTopology != null && racksTopology.size() > 0) {
    Iterator<Entry<String,String>> it=racksTopology.entrySet().iterator();
    Map.Entry<String,String> entry=null;
    String vmIP="String_Node_Str";
    String rackPath="String_Node_Str";
    while (it.hasNext()) {
      entry=(Map.Entry<String,String>)it.next();
      vmIP=entry.getKey();
      rackPath=entry.getValue();
      StringBuffer buff=new StringBuffer();
      list.add(buff.append(vmIP).append("String_Node_Str").append(rackPath).toString());
    }
  }
  prettyOutputStrings(list,filename,delimeter);
}

Fixed version (ground truth):
public static void gracefulRackTopologyOutput(Map<String,String> racksTopology,String filename,String delimeter) throws Exception {
  List<Object> list=new ArrayList<Object>();
  if (racksTopology != null && racksTopology.size() > 0) {
    Iterator<Entry<String,String>> it=racksTopology.entrySet().iterator();
    Map.Entry<String,String> entry=null;
    String vmIP="String_Node_Str";
    String rackPath="String_Node_Str";
    while (it.hasNext()) {
      entry=(Map.Entry<String,String>)it.next();
      vmIP=entry.getKey();
      rackPath=entry.getValue();
      StringBuilder buff=new StringBuilder();
      list.add(buff.append(vmIP).append("String_Node_Str").append(rackPath).toString());
    }
  }
  prettyOutputStrings(list,filename,delimeter);
}
Program: 48433
Project: 48433
Buggy source:
private static boolean isContinue(final String name,final String targetObject,final String operateType,final String promptMsg,final boolean alwaysAnswerYes){
  if (alwaysAnswerYes) {
    return true;
  }
  boolean continueCreate=true;
  boolean continueLoop=true;
  String readMsg="String_Node_Str";
  try {
    ConsoleReader reader=new ConsoleReader();
    reader.setPrompt(promptMsg);
    int k=0;
    while (continueLoop) {
      if (k >= 3) {
        continueCreate=false;
        break;
      }
      readMsg=reader.readLine();
      if (readMsg.trim().equalsIgnoreCase("String_Node_Str") || readMsg.trim().equalsIgnoreCase("String_Node_Str")) {
        continueLoop=false;
      }
 else       if (readMsg.trim().equalsIgnoreCase("String_Node_Str") || readMsg.trim().equalsIgnoreCase("String_Node_Str")) {
        continueLoop=false;
        continueCreate=false;
      }
 else {
        k++;
      }
    }
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(targetObject,name,operateType,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    continueCreate=false;
  }
  return continueCreate;
}

Fixed version (ground truth):
private static boolean isContinue(final String name,final String targetObject,final String operateType,final String promptMsg,final boolean alwaysAnswerYes){
  if (alwaysAnswerYes) {
    return true;
  }
  boolean continueCreate=true;
  boolean continueLoop=true;
  String readMsg="String_Node_Str";
  try {
    ConsoleReader reader=new ConsoleReader();
    reader.setPrompt(promptMsg);
    int k=0;
    while (continueLoop) {
      if (k >= 3) {
        continueCreate=false;
        break;
      }
      readMsg=reader.readLine();
      if ("String_Node_Str".equalsIgnoreCase(readMsg.trim()) || "String_Node_Str".equalsIgnoreCase(readMsg.trim())) {
        continueLoop=false;
      }
 else       if ("String_Node_Str".equalsIgnoreCase(readMsg.trim()) || "String_Node_Str".equalsIgnoreCase(readMsg.trim())) {
        continueLoop=false;
        continueCreate=false;
      }
 else {
        k++;
      }
    }
  }
 catch (  Exception e) {
    CommandsUtils.printCmdFailure(targetObject,name,operateType,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    continueCreate=false;
  }
  return continueCreate;
}
Program: 48434
Project: 48434
Buggy source:
public static void prettyOutputStrings(List<Object> objs,String fileName,String delimeter) throws Exception {
  StringBuffer buff=new StringBuffer();
  if (CommonUtil.isBlank(delimeter)) {
    delimeter="String_Node_Str";
  }
  for (  Object obj : objs) {
    if (obj != null) {
      String str=obj.toString();
      if (!CommandsUtils.isBlank(str)) {
        buff.append(str).append(delimeter);
      }
    }
  }
  if (buff.length() > 0) {
    buff.delete(buff.length() - delimeter.length(),buff.length());
  }
  OutputStream out=null;
  BufferedWriter bw=null;
  try {
    if (!isBlank(fileName)) {
      out=new FileOutputStream(fileName);
    }
 else {
      out=System.out;
    }
    bw=new BufferedWriter(new OutputStreamWriter(out,"String_Node_Str"));
    bw.write(buff.toString());
    bw.flush();
    writeEndingMsgToScreen(fileName);
  }
  finally {
    if (bw != null && out != null && !(out instanceof PrintStream)) {
      bw.close();
      out.close();
    }
  }
}

Fixed version (ground truth):
public static void prettyOutputStrings(List<Object> objs,String fileName,String delimeter) throws Exception {
  StringBuilder buff=new StringBuilder();
  if (CommonUtil.isBlank(delimeter)) {
    delimeter="String_Node_Str";
  }
  for (  Object obj : objs) {
    if (obj != null) {
      String str=obj.toString();
      if (!CommandsUtils.isBlank(str)) {
        buff.append(str).append(delimeter);
      }
    }
  }
  if (buff.length() > 0) {
    buff.delete(buff.length() - delimeter.length(),buff.length());
  }
  OutputStream out=null;
  BufferedWriter bw=null;
  try {
    if (!isBlank(fileName)) {
      out=new FileOutputStream(fileName);
    }
 else {
      out=System.out;
    }
    bw=new BufferedWriter(new OutputStreamWriter(out,"String_Node_Str"));
    bw.write(buff.toString());
    bw.flush();
    writeEndingMsgToScreen(fileName);
  }
  finally {
    if (bw != null && out != null && !(out instanceof PrintStream)) {
      bw.close();
      out.close();
    }
  }
}
Program: 48435
Project: 48435
Buggy source:
public static String dataFromFile(String filePath) throws IOException, FileNotFoundException {
  StringBuffer dataStringBuffer=new StringBuffer();
  FileInputStream fis=null;
  InputStreamReader inputStreamReader=null;
  BufferedReader bufferedReader=null;
  try {
    fis=new FileInputStream(filePath);
    inputStreamReader=new InputStreamReader(fis,"String_Node_Str");
    bufferedReader=new BufferedReader(inputStreamReader);
    String line="String_Node_Str";
    while ((line=bufferedReader.readLine()) != null) {
      dataStringBuffer.append(line);
      dataStringBuffer.append("String_Node_Str");
    }
  }
  finally {
    if (fis != null) {
      fis.close();
    }
    if (inputStreamReader != null) {
      inputStreamReader.close();
    }
    if (bufferedReader != null) {
      bufferedReader.close();
    }
  }
  return dataStringBuffer.toString();
}

Fixed version (ground truth):
public static String dataFromFile(String filePath) throws IOException, FileNotFoundException {
  StringBuilder dataStringBuffer=new StringBuilder();
  FileInputStream fis=null;
  InputStreamReader inputStreamReader=null;
  BufferedReader bufferedReader=null;
  try {
    fis=new FileInputStream(filePath);
    inputStreamReader=new InputStreamReader(fis,"String_Node_Str");
    bufferedReader=new BufferedReader(inputStreamReader);
    String line="String_Node_Str";
    while ((line=bufferedReader.readLine()) != null) {
      dataStringBuffer.append(line);
      dataStringBuffer.append("String_Node_Str");
    }
  }
  finally {
    if (fis != null) {
      fis.close();
    }
    if (inputStreamReader != null) {
      inputStreamReader.close();
    }
    if (bufferedReader != null) {
      bufferedReader.close();
    }
  }
  return dataStringBuffer.toString();
}
Program: 48437
Project: 48437
Buggy source:
private String getVCConnectErrorMsg(InputStream is){
  StringBuffer buffer=new StringBuffer();
  InputStreamReader inputStreamReader=null;
  BufferedReader bufferedReader=null;
  try {
    inputStreamReader=new InputStreamReader(is);
    bufferedReader=new BufferedReader(inputStreamReader);
    String line="String_Node_Str";
    while ((line=bufferedReader.readLine()) != null) {
      buffer.append(line);
      buffer.append("String_Node_Str");
    }
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + e.getMessage());
  }
 finally {
    if (is != null) {
      try {
        is.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + e.getMessage());
      }
    }
    if (inputStreamReader != null) {
      try {
        inputStreamReader.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + e.getMessage());
      }
    }
    if (bufferedReader != null) {
      try {
        bufferedReader.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + e.getMessage());
      }
    }
  }
  return findErrorMsg(buffer.toString(),"String_Node_Str");
}

Fixed version (ground truth):
private String getVCConnectErrorMsg(InputStream is){
  StringBuilder buffer=new StringBuilder();
  InputStreamReader inputStreamReader=null;
  BufferedReader bufferedReader=null;
  try {
    inputStreamReader=new InputStreamReader(is);
    bufferedReader=new BufferedReader(inputStreamReader);
    String line="String_Node_Str";
    while ((line=bufferedReader.readLine()) != null) {
      buffer.append(line);
      buffer.append("String_Node_Str");
    }
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + e.getMessage());
  }
 finally {
    if (is != null) {
      try {
        is.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + e.getMessage());
      }
    }
    if (inputStreamReader != null) {
      try {
        inputStreamReader.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + e.getMessage());
      }
    }
    if (bufferedReader != null) {
      try {
        bufferedReader.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + e.getMessage());
      }
    }
  }
  return findErrorMsg(buffer.toString(),"String_Node_Str");
}
Program: 48438
Project: 48438
Buggy source:
public void setPassword(String password){
  if (password == "String_Node_Str") {
    this.password="String_Node_Str";
    return;
  }
  try {
    this.password=EncryptionGuard.encode(password);
  }
 catch (  UnsupportedEncodingException e) {
    logger.warn("String_Node_Str",e);
  }
catch (  GeneralSecurityException e) {
    logger.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void setPassword(String password){
  if ("String_Node_Str".equals(password)) {
    this.password="String_Node_Str";
    return;
  }
  try {
    this.password=EncryptionGuard.encode(password);
  }
 catch (  UnsupportedEncodingException e) {
    logger.warn("String_Node_Str",e);
  }
catch (  GeneralSecurityException e) {
    logger.warn("String_Node_Str",e);
  }
}
Program: 48439
Project: 48439
Buggy source:
public boolean isReady(){
  return (connected && ipv4Address != null && !ipv4Address.equals(Constants.NULL_IPV4_ADDRESS));
}

Fixed version (ground truth):
public boolean isReady(){
  return (connected && ipv4Address != null && !Constants.NULL_IPV4_ADDRESS.equals(ipv4Address));
}
Program: 48440
Project: 48440
Buggy source:
public void setAction(String action){
  if (this.action != action) {
    logger.debug("String_Node_Str" + getVmName() + "String_Node_Str"+ action);
    this.action=action;
  }
}

Fixed version (ground truth):
public void setAction(String action){
  if ((this.action == null && action != null) || !this.action.equals(action)) {
    logger.debug("String_Node_Str" + getVmName() + "String_Node_Str"+ action);
    this.action=action;
  }
}
Program: 48442
Project: 48442
Buggy source:
public static File getConfigFile(final String filename,final String typeName){
  File specFile=new File(filename);
  if (specFile.exists()) {
    return specFile;
  }
  String homeDir=System.getProperties().getProperty("String_Node_Str");
  if (homeDir != null && !homeDir.trim().isEmpty()) {
    StringBuilder builder=new StringBuilder();
    builder.append(homeDir).append(File.separator).append("String_Node_Str").append(File.separator).append(filename);
    specFile=new File(builder.toString());
    if (!specFile.exists()) {
      logger.warn(typeName + "String_Node_Str" + builder);
    }
 else {
      return specFile;
    }
  }
  URL filePath=ConfigurationUtils.locate(filename);
  if (filePath != null) {
    specFile=ConfigurationUtils.fileFromURL(filePath);
  }
  if (!specFile.exists()) {
    String errorMsg="String_Node_Str" + filename;
    logger.fatal(errorMsg);
    new RuntimeException(errorMsg);
  }
  return specFile;
}

Fixed version (ground truth):
public static File getConfigFile(final String filename,final String typeName){
  File specFile=new File(filename);
  if (specFile.exists()) {
    return specFile;
  }
  String homeDir=System.getProperties().getProperty("String_Node_Str");
  if (homeDir != null && !homeDir.trim().isEmpty()) {
    StringBuilder builder=new StringBuilder();
    builder.append(homeDir).append(File.separator).append("String_Node_Str").append(File.separator).append(filename);
    specFile=new File(builder.toString());
    if (!specFile.exists()) {
      logger.warn(typeName + "String_Node_Str" + builder);
    }
 else {
      return specFile;
    }
  }
  URL filePath=ConfigurationUtils.locate(filename);
  if (filePath != null) {
    specFile=ConfigurationUtils.fileFromURL(filePath);
  }
  if (!specFile.exists()) {
    String errorMsg="String_Node_Str" + filename;
    logger.fatal(errorMsg);
    throw new RuntimeException(errorMsg);
  }
  return specFile;
}
Program: 48444
Project: 48444
Buggy source:
@Test public void testAuthenticate() throws Exception {
  Authentication authentication=new MockUp<Authentication>(){
    @Mock Object getPrincipal(){
      return "String_Node_Str";
    }
    @Mock Object getCredentials(){
      return "String_Node_Str";
    }
    @Mock public String getName(){
      return "String_Node_Str";
    }
  }
.getMockInstance();
  new NonStrictExpectations(){
    @SuppressWarnings("String_Node_Str") Configuration configuration;
{
      Configuration.getString("String_Node_Str");
      returns("String_Node_Str");
    }
{
      Configuration.getString("String_Node_Str");
      returns("String_Node_Str");
    }
{
      Configuration.getInt("String_Node_Str",110);
      returns(110);
    }
  }
;
  new MockUp<AuthenticateVcUser>(){
    @Mock public void authenticateUser(    String name,    String password) throws Exception {
      return;
    }
  }
;
  Users users=new Users();
  User user=new User();
  user.setName("String_Node_Str");
  users.setUsers(Arrays.asList(user));
  TestFileUtils.createXMLFile(users,FileUtils.getConfigFile(UsersFile,"String_Node_Str"));
  UserAuthenticationProvider provider=new UserAuthenticationProvider();
  provider.setUserService(new UserService());
  provider.authenticate(authentication);
  TestFileUtils.deleteXMLFile(FileUtils.getConfigFile(UsersFile,"String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testAuthenticate() throws Exception {
  Authentication authentication=new MockUp<Authentication>(){
    @Mock Object getPrincipal(){
      return "String_Node_Str";
    }
    @Mock Object getCredentials(){
      return "String_Node_Str";
    }
    @Mock public String getName(){
      return "String_Node_Str";
    }
  }
.getMockInstance();
  new NonStrictExpectations(){
    @SuppressWarnings("String_Node_Str") Configuration configuration;
{
      Configuration.getString("String_Node_Str");
      returns("String_Node_Str");
    }
{
      Configuration.getString("String_Node_Str");
      returns("String_Node_Str");
    }
{
      Configuration.getInt("String_Node_Str",110);
      returns(110);
    }
  }
;
  new MockUp<AuthenticateVcUser>(){
    @Mock public void authenticateUser(    String name,    String password) throws Exception {
      return;
    }
  }
;
  Users users=new Users();
  User user=new User();
  user.setName("String_Node_Str");
  users.setUsers(Arrays.asList(user));
  String confPath=System.getProperties().get("String_Node_Str") + File.separator + "String_Node_Str";
  new File(confPath).mkdir();
  String userXmlPath=confPath + File.separator + UsersFile;
  File usrXmlFile=new File(userXmlPath);
  TestFileUtils.createXMLFile(users,usrXmlFile);
  UserAuthenticationProvider provider=new UserAuthenticationProvider();
  provider.setUserService(new UserService());
  provider.authenticate(authentication);
  TestFileUtils.deleteXMLFile(usrXmlFile);
}
Program: 48445
Project: 48445
Buggy source:
private boolean validateLocalRepoURL(String localRepoURL){
  boolean succ=true;
  HttpClientBuilder builder=HttpClientBuilder.create();
  CloseableHttpClient httpClient=builder.build();
  HttpGet httpGet=new HttpGet(localRepoURL);
  try {
    HttpResponse resp=httpClient.execute(httpGet);
    StatusLine status=resp.getStatusLine();
    if (status.getStatusCode() >= 400) {
      succ=false;
    }
  }
 catch (  Exception e) {
    succ=false;
    logger.error(e.getMessage());
  }
 finally {
    if (null != httpClient) {
      try {
        httpClient.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str");
      }
    }
  }
  return succ;
}

Fixed version (ground truth):
private boolean validateLocalRepoURL(String localRepoURL){
  boolean succ=true;
  HttpClientBuilder builder=HttpClientBuilder.create();
  CloseableHttpClient httpClient=builder.build();
  try {
    HttpGet httpGet=new HttpGet(localRepoURL);
    HttpResponse resp=httpClient.execute(httpGet);
    StatusLine status=resp.getStatusLine();
    if (status.getStatusCode() >= 400) {
      succ=false;
    }
  }
 catch (  Exception e) {
    succ=false;
    logger.error(e.getMessage());
  }
 finally {
    if (null != httpClient) {
      try {
        httpClient.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str");
      }
    }
  }
  return succ;
}
Program: 48446
Project: 48446
Buggy source:
/** 
 * Get software manager instance
 * @param name
 * @return null if the name does not exist
 */
public SoftwareManager getSoftwareManager(String name){
  if (CommonUtil.isBlank(name)) {
    return cache.get(Constants.IRONFAN);
  }
  AppManagerEntity appManagerEntity=appManagerService.findAppManagerByName(name);
  if (appManagerEntity == null) {
    logger.error("String_Node_Str" + name);
    throw SoftwareManagerCollectorException.APPMANAGER_NOT_FOUND(name);
  }
 else {
    String appMgrType=appManagerEntity.getType();
    if (!appMgrType.equals(Constants.IRONFAN)) {
      checkServerConnection(name,appManagerEntity.getUrl());
    }
    if (cache.containsKey(name)) {
      return cache.get(name);
    }
    return loadSoftwareManager(appManagerEntity);
  }
}

Fixed version (ground truth):
/** 
 * Get software manager instance
 * @param name
 * @return null if the name does not exist
 */
public SoftwareManager getSoftwareManager(String name){
  if (CommonUtil.isBlank(name) || Constants.IRONFAN.equals(name)) {
    return cache.get(Constants.IRONFAN);
  }
  AppManagerEntity appManagerEntity=appManagerService.findAppManagerByName(name);
  if (appManagerEntity == null) {
    logger.error("String_Node_Str" + name);
    throw SoftwareManagerCollectorException.APPMANAGER_NOT_FOUND(name);
  }
 else {
    if (cache.containsKey(name)) {
      String appMgrType=appManagerEntity.getType();
      if (!appMgrType.equals(Constants.IRONFAN)) {
        checkServerConnection(name,appManagerEntity.getUrl());
      }
      return cache.get(name);
    }
    return loadSoftwareManager(appManagerEntity);
  }
}
Program: 48447
Project: 48447
Buggy source:
@BeforeMethod public void setUp(){
  softwareManagerCollector=new SoftwareManagerCollector();
  appManagerService=Mockito.mock(IAppManagerService.class);
  clusterEntityManager=Mockito.mock(IClusterEntityManager.class);
  softwareManagerCollector.setAppManagerService(appManagerService);
  softwareManagerCollector.setClusterEntityManager(clusterEntityManager);
  Configuration.setString(SoftwareManagerCollector.configurationPrefix + Constants.IRONFAN,"String_Node_Str");
  Configuration.setString(SoftwareManagerCollector.configurationPrefix + FooSWMgrFactory.FOO_APP_MGR,"String_Node_Str");
}

Fixed version (ground truth):
@BeforeMethod public void setUp(){
  softwareManagerCollector=new SoftwareManagerCollector();
  appManagerService=Mockito.mock(IAppManagerService.class);
  clusterEntityManager=Mockito.mock(IClusterEntityManager.class);
  softwareManagerCollector.setAppManagerService(appManagerService);
  softwareManagerCollector.setClusterEntityManager(clusterEntityManager);
  Configuration.setString(SoftwareManagerCollector.configurationPrefix + Constants.IRONFAN,"String_Node_Str");
  Configuration.setString(SoftwareManagerCollector.configurationPrefix + FooSWMgrFactory.FOO_APP_MGR,"String_Node_Str");
  Mockit.setUpMock(MockCommonUtil.class);
}
Program: 48448
Project: 48448
Buggy source:
@Test public void testCreateAppManager_Success(){
  Mockito.when(appManagerService.findAll()).thenReturn(new ArrayList<AppManagerEntity>());
  Configuration.setString(SoftwareManagerCollector.configurationPrefix + defaultAppManagerAdd.getType(),"String_Node_Str");
  softwareManagerCollector.setPrivateKey("String_Node_Str");
  softwareManagerCollector.createSoftwareManager(defaultAppManagerAdd);
  TestSWMgrCollector_LoadAppManager.assertSoftwareManagers(softwareManagerCollector.getSoftwareManager(Constants.IRONFAN),defaultAppManagerAdd);
}

Fixed version (ground truth):
@Test public void testCreateAppManager_Success(){
  Mockito.when(appManagerService.findAll()).thenReturn(new ArrayList<AppManagerEntity>());
  Configuration.setString(SoftwareManagerCollector.configurationPrefix + defaultAppManagerAdd.getType(),"String_Node_Str");
  softwareManagerCollector.setPrivateKey("String_Node_Str");
  softwareManagerCollector.createSoftwareManager(defaultAppManagerAdd);
  Mockito.when(appManagerService.findAppManagerByName(Matchers.anyString())).thenReturn(defaultAppManagerEntity);
  TestSWMgrCollector_LoadAppManager.assertSoftwareManagers(softwareManagerCollector.getSoftwareManager(Constants.IRONFAN),defaultAppManagerAdd);
}
Program: 48449
Project: 48449
Buggy source:
@Test public void testGetAppMgrRead_Success(){
  Mockito.when(appManagerService.findAll()).thenReturn(Arrays.asList(defaultAppManagerEntity));
  softwareManagerCollector.loadSoftwareManagers();
  Mockito.when(appManagerService.getAppManagerRead(Matchers.anyString())).thenReturn(defaultAppManagerRead);
  AppManagerRead appManagerRead=softwareManagerCollector.getAppManagerRead(defaultAppManagerAdd.getName());
  Assert.assertEquals(defaultAppManagerRead.getName(),appManagerRead.getName());
  Assert.assertEquals(defaultAppManagerRead.getType(),appManagerRead.getType());
}

Fixed version (ground truth):
@Test public void testGetAppMgrRead_Success(){
  Mockito.when(appManagerService.findAll()).thenReturn(Arrays.asList(defaultAppManagerEntity));
  Mockito.when(appManagerService.findAppManagerByName(Matchers.anyString())).thenReturn(defaultAppManagerEntity);
  softwareManagerCollector.loadSoftwareManagers();
  Mockito.when(appManagerService.getAppManagerRead(Matchers.anyString())).thenReturn(defaultAppManagerRead);
  AppManagerRead appManagerRead=softwareManagerCollector.getAppManagerRead(defaultAppManagerAdd.getName());
  Assert.assertEquals(defaultAppManagerRead.getName(),appManagerRead.getName());
  Assert.assertEquals(defaultAppManagerRead.getType(),appManagerRead.getType());
}
Program: 48450
Project: 48450
Buggy source:
@Test public void testLoadAppManagers_Default(){
  Mockito.when(appManagerService.findAll()).thenReturn(Arrays.asList(defaultAppManagerEntity));
  softwareManagerCollector.loadSoftwareManagers();
  assertSoftwareManagers(softwareManagerCollector.getSoftwareManager(Constants.IRONFAN),defaultAppManagerAdd);
}

Fixed version (ground truth):
@Test public void testLoadAppManagers_Default(){
  Mockito.when(appManagerService.findAll()).thenReturn(Arrays.asList(defaultAppManagerEntity));
  Mockito.when(appManagerService.findAppManagerByName(Matchers.anyString())).thenReturn(defaultAppManagerEntity);
  softwareManagerCollector.loadSoftwareManagers();
  assertSoftwareManagers(softwareManagerCollector.getSoftwareManager(Constants.IRONFAN),defaultAppManagerAdd);
}
Program: 48451
Project: 48451
Buggy source:
@Test public void testLoadAppManager_Success(){
  Mockito.when(appManagerService.findAll()).thenReturn(new ArrayList<AppManagerEntity>());
  Configuration.setString(SoftwareManagerCollector.configurationPrefix + defaultAppManagerAdd.getType(),"String_Node_Str");
  softwareManagerCollector.setPrivateKey("String_Node_Str");
  softwareManagerCollector.loadSoftwareManager(defaultAppManagerAdd);
  assertSoftwareManagers(softwareManagerCollector.getSoftwareManager(Constants.IRONFAN),defaultAppManagerAdd);
}

Fixed version (ground truth):
@Test public void testLoadAppManager_Success(){
  Mockito.when(appManagerService.findAll()).thenReturn(new ArrayList<AppManagerEntity>());
  Mockito.when(appManagerService.findAppManagerByName(Matchers.anyString())).thenReturn(defaultAppManagerEntity);
  Configuration.setString(SoftwareManagerCollector.configurationPrefix + defaultAppManagerAdd.getType(),"String_Node_Str");
  softwareManagerCollector.setPrivateKey("String_Node_Str");
  softwareManagerCollector.loadSoftwareManager(defaultAppManagerAdd);
  assertSoftwareManagers(softwareManagerCollector.getSoftwareManager(Constants.IRONFAN),defaultAppManagerAdd);
}
Program: 48452
Project: 48452
Buggy source:
@Test public void testLoadAppManagers_Upgrade(){
  Mockito.when(appManagerService.findAll()).thenReturn(new ArrayList<AppManagerEntity>());
  softwareManagerCollector.loadSoftwareManagers();
  assertSoftwareManagers(softwareManagerCollector.getSoftwareManager(Constants.IRONFAN),defaultAppManagerAdd);
}

Fixed version (ground truth):
@Test public void testLoadAppManagers_Upgrade(){
  Mockito.when(appManagerService.findAll()).thenReturn(new ArrayList<AppManagerEntity>());
  Mockito.when(appManagerService.findAppManagerByName(Matchers.anyString())).thenReturn(defaultAppManagerEntity);
  softwareManagerCollector.loadSoftwareManagers();
  assertSoftwareManagers(softwareManagerCollector.getSoftwareManager(Constants.IRONFAN),defaultAppManagerAdd);
}
Program: 48453
Project: 48453
Buggy source:
public static boolean validateUrl(String url,List<String> errorMsgs){
  if (errorMsgs == null) {
    errorMsgs=new ArrayList<String>();
  }
  boolean result=true;
  try {
    URI uri=new URI(url);
    String schema=uri.getScheme();
    if (!"String_Node_Str".equalsIgnoreCase(schema) && !"String_Node_Str".equalsIgnoreCase(schema)) {
      errorMsgs.add("String_Node_Str");
      result=false;
    }
  }
 catch (  URISyntaxException e) {
    logger.error("String_Node_Str",e);
    errorMsgs.add("String_Node_Str");
    return false;
  }
  return result;
}

Fixed version (ground truth):
public static boolean validateUrl(String url,List<String> errorMsgs){
  if (errorMsgs == null) {
    errorMsgs=new ArrayList<String>();
  }
  boolean result=true;
  try {
    URI uri=new URI(url);
    String schema=uri.getScheme();
    if (!"String_Node_Str".equalsIgnoreCase(schema) && !"String_Node_Str".equalsIgnoreCase(schema)) {
      errorMsgs.add("String_Node_Str");
      result=false;
    }
    if ("String_Node_Str".equalsIgnoreCase(schema) && uri.getHost().matches(Constants.IP_PATTERN)) {
      errorMsgs.add("String_Node_Str");
      result=false;
    }
  }
 catch (  URISyntaxException e) {
    logger.error("String_Node_Str",e);
    errorMsgs.add("String_Node_Str");
    return false;
  }
  return result;
}
Program: 48454
Project: 48454
Buggy source:
@Override public List<String> validateScaling(NodeGroupInfo group){
  return new ArrayList<String>();
}

Fixed version (ground truth):
@Override public List<String> validateScaling(NodeGroupInfo group){
  List<String> roles=group.getRoles();
  List<String> unsupportedRoles=new ArrayList<String>();
  if (roles.isEmpty()) {
    return new ArrayList<String>();
  }
  if (roles.contains(HadoopRole.HADOOP_NAMENODE_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_NAMENODE_ROLE.toString());
  }
  if (roles.contains(HadoopRole.HADOOP_SECONDARY_NAMENODE_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_SECONDARY_NAMENODE_ROLE.toString());
  }
  if (roles.contains(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString());
  }
  if (roles.contains(HadoopRole.HADOOP_RESOURCEMANAGER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_RESOURCEMANAGER_ROLE.toString());
  }
  if (roles.contains(HadoopRole.ZOOKEEPER_SERVER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.ZOOKEEPER_SERVER_ROLE.toString());
  }
  return unsupportedRoles;
}
Program: 48455
Project: 48455
Buggy source:
@Override public List<String> validateScaling(NodeGroupInfo group){
  return new ArrayList<String>();
}

Fixed version (ground truth):
@Override public List<String> validateScaling(NodeGroupInfo group){
  List<String> roles=group.getRoles();
  List<String> unsupportedRoles=new ArrayList<String>();
  if (roles.isEmpty()) {
    return new ArrayList<String>();
  }
  if (roles.contains(HadoopRole.HADOOP_NAMENODE_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_NAMENODE_ROLE.toString());
  }
  if (roles.contains(HadoopRole.HADOOP_SECONDARY_NAMENODE_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_SECONDARY_NAMENODE_ROLE.toString());
  }
  if (roles.contains(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString());
  }
  if (roles.contains(HadoopRole.HADOOP_RESOURCEMANAGER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_RESOURCEMANAGER_ROLE.toString());
  }
  if (roles.contains(HadoopRole.ZOOKEEPER_SERVER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.ZOOKEEPER_SERVER_ROLE.toString());
  }
  return unsupportedRoles;
}
Program: 48456
Project: 48456
Buggy source:
@Override public List<String> validateScaling(NodeGroupInfo group) throws SoftwareManagementPluginException {
  List<String> roles=group.getRoles();
  List<String> unsupportedRoles=new ArrayList<String>();
  if (roles.isEmpty()) {
    return new ArrayList<String>();
  }
  if (roles.contains(HadoopRole.HADOOP_NAMENODE_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_NAMENODE_ROLE.toString());
  }
  if (roles.contains(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString());
  }
  if (roles.contains(HadoopRole.ZOOKEEPER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.ZOOKEEPER_ROLE.toString());
  }
  return unsupportedRoles;
}

Fixed version (ground truth):
@Override public List<String> validateScaling(NodeGroupInfo group) throws SoftwareManagementPluginException {
  List<String> roles=group.getRoles();
  List<String> unsupportedRoles=new ArrayList<String>();
  if (roles.isEmpty()) {
    return new ArrayList<String>();
  }
  if (roles.contains(HadoopRole.HADOOP_NAMENODE_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_NAMENODE_ROLE.toString());
  }
  if (roles.contains(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString());
  }
  if (roles.contains(HadoopRole.HADOOP_RESOURCEMANAGER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.HADOOP_RESOURCEMANAGER_ROLE.toString());
  }
  if (roles.contains(HadoopRole.ZOOKEEPER_ROLE.toString())) {
    unsupportedRoles.add(HadoopRole.ZOOKEEPER_ROLE.toString());
  }
  return unsupportedRoles;
}
Program: 48457
Project: 48457
Buggy source:
public static BddException EXTRA_PACKAGES_NOT_FOUND(){
  return new BddException(null,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public static BddException EXTRA_PACKAGES_NOT_FOUND(String extraPackages){
  return new BddException(null,"String_Node_Str","String_Node_Str",extraPackages);
}
Program: 48458
Project: 48458
Buggy source:
private void writeJsonFile(Map<String,Object> clusterConfig,File file){
  Gson gson=new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().create();
  String jsonStr=gson.toJson(clusterConfig);
  AuAssert.check(jsonStr != null);
  logger.info("String_Node_Str" + jsonStr + "String_Node_Str"+ file);
  BufferedWriter out=null;
  try {
    out=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),"String_Node_Str"));
    out.write(jsonStr);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage() + "String_Node_Str" + file);
    throw BddException.INTERNAL(ex,"String_Node_Str");
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + out,e);
      }
    }
  }
}

Fixed version (ground truth):
private void writeJsonFile(Map<String,Object> clusterConfig,File file){
  Gson gson=new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setPrettyPrinting().create();
  String jsonStr=gson.toJson(clusterConfig);
  AuAssert.check(jsonStr != null);
  logger.debug("String_Node_Str" + jsonStr + "String_Node_Str"+ file);
  BufferedWriter out=null;
  try {
    out=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),"String_Node_Str"));
    out.write(jsonStr);
  }
 catch (  IOException ex) {
    logger.error(ex.getMessage() + "String_Node_Str" + file);
    throw BddException.INTERNAL(ex,"String_Node_Str");
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str" + out,e);
      }
    }
  }
}
Program: 48459
Project: 48459
Buggy source:
private void updateVersion(AppManagerRead appManagerRead){
  String softMgrVersion="String_Node_Str";
  final SoftwareManager softwareManager=this.getSoftwareManager(appManagerRead.getName());
  ExecutorService exec=Executors.newFixedThreadPool(1);
  Future<String> futureResult=exec.submit(new Callable<String>(){
    @Override public String call() throws Exception {
      return softwareManager.getVersion();
    }
  }
);
  String result=(String)waitForThreadResult(futureResult);
  if (null != result) {
    softMgrVersion=result;
  }
  exec.shutdown();
  appManagerRead.setVersion(softMgrVersion);
}

Fixed version (ground truth):
private void updateVersion(AppManagerRead appManagerRead){
  String softMgrVersion="String_Node_Str";
  final SoftwareManager softwareManager=this.getSoftwareManager(appManagerRead.getName());
  ExecutorService exec=Executors.newFixedThreadPool(1);
  Future<String> futureResult=exec.submit(new Callable<String>(){
    @Override public String call() throws Exception {
      return softwareManager.getVersion();
    }
  }
);
  String result=(String)CommonUtil.waitForThreadResult(futureResult,waitTimeForAppMgrConn);
  if (null != result) {
    softMgrVersion=result;
  }
  exec.shutdown();
  appManagerRead.setVersion(softMgrVersion);
}
Program: 48460
Project: 48460
Buggy source:
/** 
 * Get software manager instance
 * @param name
 * @return null if the name does not exist
 */
public SoftwareManager getSoftwareManager(String name){
  if (CommonUtil.isBlank(name)) {
    return cache.get(Constants.IRONFAN);
  }
  if (cache.containsKey(name)) {
    return cache.get(name);
  }
  AppManagerEntity appManagerEntity=appManagerService.findAppManagerByName(name);
  if (appManagerEntity == null) {
    logger.error("String_Node_Str" + name);
    throw SoftwareManagerCollectorException.APPMANAGER_NOT_FOUND(name);
  }
 else {
    return loadSoftwareManager(appManagerEntity);
  }
}

Fixed version (ground truth):
/** 
 * Get software manager instance
 * @param name
 * @return null if the name does not exist
 */
public SoftwareManager getSoftwareManager(String name){
  if (CommonUtil.isBlank(name)) {
    return cache.get(Constants.IRONFAN);
  }
  AppManagerEntity appManagerEntity=appManagerService.findAppManagerByName(name);
  if (appManagerEntity == null) {
    logger.error("String_Node_Str" + name);
    throw SoftwareManagerCollectorException.APPMANAGER_NOT_FOUND(name);
  }
 else {
    String appMgrType=appManagerEntity.getType();
    if (!appMgrType.equals(Constants.IRONFAN)) {
      checkServerConnection(name,appManagerEntity.getUrl());
    }
    if (cache.containsKey(name)) {
      return cache.get(name);
    }
    return loadSoftwareManager(appManagerEntity);
  }
}
Program: 48462
Project: 48462
Buggy source:
@Override public Boolean call() throws Exception {
  try {
    new Socket(host,port);
    return true;
  }
 catch (  UnknownHostException e) {
    throw e;
  }
catch (  IOException e) {
    throw e;
  }
}

Fixed version (ground truth):
@Override public String call() throws Exception {
  return softwareManager.getVersion();
}