Program: 152099
Project: 152099
Buggy source:
/** 
 * Get set of gateways from set of gateway URLs
 * @param gatewayURLs set of gateway URLs (file or jar URLs)
 * @return set of gateways
 * @throws java.beans.IntrospectionException When current JRE does not support JavaScript execution
 */
private static TreeSet<Gateway> importGateways(Set<URL> gatewayURLs) throws IntrospectionException {
  logger.finer("String_Node_Str" + gatewayURLs.size() + "String_Node_Str");
  TreeSet<Gateway> gateways=new TreeSet<Gateway>();
  for (  URL gatewayURL : gatewayURLs) {
    try {
      Gateway gateway=new Gateway(gatewayURL);
      if (Config.compareProgramVersions(Config.getLatestVersion(),gateway.getMinProgramVersion()) < 0) {
        logger.info("String_Node_Str" + gateway.getName() + "String_Node_Str"+ gateway.getMinProgramVersion()+ "String_Node_Str");
        continue;
      }
      if (gateways.contains(gateway)) {
        for (Iterator<Gateway> it=gateways.iterator(); it.hasNext(); ) {
          Gateway op=it.next();
          if (op.equals(gateway) && op.getVersion().compareTo(gateway.getVersion()) < 0) {
            it.remove();
          }
        }
      }
      gateways.add(gateway);
    }
 catch (    IOException ex) {
      logger.log(Level.WARNING,"String_Node_Str" + gatewayURL.toExternalForm(),ex);
    }
catch (    IntrospectionException ex) {
      throw ex;
    }
catch (    Exception ex) {
      logger.log(Level.WARNING,"String_Node_Str" + gatewayURL.toExternalForm(),ex);
    }
  }
  logger.finer("String_Node_Str" + gateways.size() + "String_Node_Str");
  return gateways;
}

Fixed version (ground truth):
/** 
 * Get set of gateways from set of gateway URLs
 * @param gatewayURLs set of gateway URLs (file or jar URLs)
 * @param deleteOnFail whether to delete gateway files that fail to be loaded
 * @return set of gateways
 * @throws java.beans.IntrospectionException When current JRE does not support JavaScript execution
 */
private static TreeSet<Gateway> importGateways(Set<URL> gatewayURLs,boolean deleteOnFail) throws IntrospectionException {
  logger.log(Level.FINER,"String_Node_Str",gatewayURLs.size());
  TreeSet<Gateway> gateways=new TreeSet<Gateway>();
  for (  URL gatewayURL : gatewayURLs) {
    try {
      Gateway gateway=new Gateway(gatewayURL);
      if (Config.compareProgramVersions(Config.getLatestVersion(),gateway.getMinProgramVersion()) < 0) {
        logger.log(Level.INFO,"String_Node_Str",new Object[]{gateway.getName(),gateway.getMinProgramVersion()});
        continue;
      }
      if (gateways.contains(gateway)) {
        for (Iterator<Gateway> it=gateways.iterator(); it.hasNext(); ) {
          Gateway op=it.next();
          if (op.equals(gateway) && op.getVersion().compareTo(gateway.getVersion()) < 0) {
            it.remove();
          }
        }
      }
      gateways.add(gateway);
    }
 catch (    IOException ex) {
      logger.log(Level.WARNING,"String_Node_Str" + gatewayURL.toExternalForm(),ex);
    }
catch (    IntrospectionException ex) {
      throw ex;
    }
catch (    Exception ex) {
      logger.log(Level.WARNING,"String_Node_Str" + gatewayURL.toExternalForm(),ex);
      if (deleteOnFail) {
        try {
          logger.log(Level.FINE,"String_Node_Str",gatewayURL);
          File gwFile=new File(gatewayURL.toURI());
          gwFile.delete();
        }
 catch (        Exception exc) {
          logger.log(Level.WARNING,"String_Node_Str" + gatewayURL,exc);
        }
      }
    }
  }
  logger.log(Level.FINER,"String_Node_Str",gateways.size());
  return gateways;
}