Program: 113827
Project: 113827
Buggy source:
public static void main(String[] args) throws Exception {
  Logging.start(Logging.LEVEL_WARN);
  Map<String,CliOption> options=new HashMap<String,CliOption>();
  List<String> arguments=new ArrayList<String>(1);
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.SWITCH));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.URL));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.SWITCH));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.NUMBER));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.NUMBER));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.STRING));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.STRING));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.STRING));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.STRING));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.SWITCH));
  CLIParser.parseCLI(args,options,arguments);
  if (arguments.size() != 1 || options.get("String_Node_Str").switchValue != null) {
    usage();
    return;
  }
  InetSocketAddress dirAddr=null;
  boolean useSSL=false;
  String serviceCredsFile=null;
  String serviceCredsPass=null;
  String trustedCAsFile=null;
  String trustedCAsPass=null;
  URL dirURL=options.get("String_Node_Str").urlValue;
  if (dirURL != null && "String_Node_Str".equals(dirURL.getProtocol())) {
    useSSL=true;
    serviceCredsFile=options.get("String_Node_Str").stringValue;
    serviceCredsPass=options.get("String_Node_Str").stringValue;
    trustedCAsFile=options.get("String_Node_Str").stringValue;
    trustedCAsPass=options.get("String_Node_Str").stringValue;
  }
  if (dirURL == null) {
    DefaultDirConfig cfg=new DefaultDirConfig(DEFAULT_DIR_CONFIG);
    cfg.read();
    dirAddr=cfg.getDirectoryService();
    useSSL=cfg.isSslEnabled();
    serviceCredsFile=cfg.getServiceCredsFile();
    serviceCredsPass=cfg.getServiceCredsPassphrase();
    trustedCAsFile=cfg.getTrustedCertsFile();
    trustedCAsPass=cfg.getTrustedCertsPassphrase();
  }
 else   dirAddr=new InetSocketAddress(dirURL.getHost(),dirURL.getPort());
  boolean checkOnly=options.get("String_Node_Str").switchValue != null;
  int noConnectionsPerOSD=DEFAULT_NUM_CONS;
  if (options.get("String_Node_Str").numValue != null)   noConnectionsPerOSD=options.get("String_Node_Str").numValue.intValue();
  int noFilesToFetch=DEFAULT_NUM_FILES;
  if (options.get("String_Node_Str").numValue != null)   noFilesToFetch=options.get("String_Node_Str").numValue.intValue();
  String volume=arguments.get(0);
  boolean isVolUUID=false;
  if (volume.startsWith("String_Node_Str")) {
    volume=volume.substring("String_Node_Str".length());
    isVolUUID=true;
  }
  SSLOptions sslOptions=useSSL ? new SSLOptions(serviceCredsFile,serviceCredsPass,SSLOptions.PKCS12_CONTAINER,trustedCAsFile,trustedCAsPass,SSLOptions.JKS_CONTAINER,false) : null;
  Map<String,Object> query=RPCClient.generateMap(isVolUUID ? "String_Node_Str" : "String_Node_Str",volume);
  DIRClient dirClient=new DIRClient(dirAddr,sslOptions,RPCClient.DEFAULT_TIMEOUT);
  TimeSync.initialize(dirClient,100000,50,authString);
  RPCResponse<Map<String,Map<String,Object>>> resp=dirClient.getEntities(query,RPCClient.generateStringList("String_Node_Str","String_Node_Str"),authString);
  Map<String,Map<String,Object>> result=resp.get();
  resp.freeBuffers();
  if (result.isEmpty()) {
    System.err.println("String_Node_Str" + arguments.get(0) + "String_Node_Str"+ dirURL+ "String_Node_Str");
    System.exit(3);
  }
  Map<String,Object> volMap=result.values().iterator().next();
  String mrc=(String)volMap.get("String_Node_Str");
  volume=(String)volMap.get("String_Node_Str");
  UUIDResolver.start(dirClient,60 * 60,10 * 60 * 60);
  ServiceUUID mrcUUID=new ServiceUUID(mrc);
  InetSocketAddress mrcAddress=mrcUUID.getAddress();
  try {
    MultiSpeedy speedy=new MultiSpeedy(sslOptions);
    speedy.start();
    AsyncScrubber scrubber=new AsyncScrubber(speedy,dirAddr,mrcAddress,volume,!checkOnly,noConnectionsPerOSD,noFilesToFetch,sslOptions);
    scrubber.start();
    scrubber.shutdown();
    System.exit(scrubber.getReturnCode());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  TimeSync.close();
  UUIDResolver.shutdown();
  dirClient.shutdown();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  Logging.start(Logging.LEVEL_WARN);
  Map<String,CliOption> options=new HashMap<String,CliOption>();
  List<String> arguments=new ArrayList<String>(1);
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.SWITCH));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.URL));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.SWITCH));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.NUMBER));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.NUMBER));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.STRING));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.STRING));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.STRING));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.STRING));
  options.put("String_Node_Str",new CliOption(CliOption.OPTIONTYPE.SWITCH));
  CLIParser.parseCLI(args,options,arguments);
  if (arguments.size() != 1 || options.get("String_Node_Str").switchValue != null) {
    usage();
    return;
  }
  InetSocketAddress dirAddr=null;
  boolean useSSL=false;
  String serviceCredsFile=null;
  String serviceCredsPass=null;
  String trustedCAsFile=null;
  String trustedCAsPass=null;
  URL dirURL=options.get("String_Node_Str").urlValue;
  if (dirURL != null && "String_Node_Str".equals(dirURL.getProtocol())) {
    useSSL=true;
    serviceCredsFile=options.get("String_Node_Str").stringValue;
    serviceCredsPass=options.get("String_Node_Str").stringValue;
    trustedCAsFile=options.get("String_Node_Str").stringValue;
    trustedCAsPass=options.get("String_Node_Str").stringValue;
  }
  if (dirURL == null) {
    DefaultDirConfig cfg=new DefaultDirConfig(DEFAULT_DIR_CONFIG);
    cfg.read();
    dirAddr=cfg.getDirectoryService();
    useSSL=cfg.isSslEnabled();
    serviceCredsFile=cfg.getServiceCredsFile();
    serviceCredsPass=cfg.getServiceCredsPassphrase();
    trustedCAsFile=cfg.getTrustedCertsFile();
    trustedCAsPass=cfg.getTrustedCertsPassphrase();
  }
 else   dirAddr=new InetSocketAddress(dirURL.getHost(),dirURL.getPort());
  boolean checkOnly=options.get("String_Node_Str").switchValue != null;
  int noConnectionsPerOSD=DEFAULT_NUM_CONS;
  if (options.get("String_Node_Str").numValue != null)   noConnectionsPerOSD=options.get("String_Node_Str").numValue.intValue();
  int noFilesToFetch=DEFAULT_NUM_FILES;
  if (options.get("String_Node_Str").numValue != null)   noFilesToFetch=options.get("String_Node_Str").numValue.intValue();
  String volume=arguments.get(0);
  boolean isVolUUID=false;
  if (volume.startsWith("String_Node_Str")) {
    volume=volume.substring("String_Node_Str".length());
    isVolUUID=true;
  }
  SSLOptions sslOptions=useSSL ? new SSLOptions(new FileInputStream(serviceCredsFile),serviceCredsPass,SSLOptions.PKCS12_CONTAINER,new FileInputStream(trustedCAsFile),trustedCAsPass,SSLOptions.JKS_CONTAINER,false) : null;
  Map<String,Object> query=RPCClient.generateMap(isVolUUID ? "String_Node_Str" : "String_Node_Str",volume);
  DIRClient dirClient=new DIRClient(dirAddr,sslOptions,RPCClient.DEFAULT_TIMEOUT);
  TimeSync.initialize(dirClient,100000,50,authString);
  RPCResponse<Map<String,Map<String,Object>>> resp=dirClient.getEntities(query,RPCClient.generateStringList("String_Node_Str","String_Node_Str"),authString);
  Map<String,Map<String,Object>> result=resp.get();
  resp.freeBuffers();
  if (result.isEmpty()) {
    System.err.println("String_Node_Str" + arguments.get(0) + "String_Node_Str"+ dirURL+ "String_Node_Str");
    System.exit(3);
  }
  Map<String,Object> volMap=result.values().iterator().next();
  String mrc=(String)volMap.get("String_Node_Str");
  volume=(String)volMap.get("String_Node_Str");
  UUIDResolver.start(dirClient,60 * 60,10 * 60 * 60);
  ServiceUUID mrcUUID=new ServiceUUID(mrc);
  InetSocketAddress mrcAddress=mrcUUID.getAddress();
  try {
    MultiSpeedy speedy=new MultiSpeedy(sslOptions);
    speedy.start();
    AsyncScrubber scrubber=new AsyncScrubber(speedy,dirAddr,mrcAddress,volume,!checkOnly,noConnectionsPerOSD,noFilesToFetch,sslOptions);
    scrubber.start();
    scrubber.shutdown();
    System.exit(scrubber.getReturnCode());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  TimeSync.close();
  UUIDResolver.shutdown();
  dirClient.shutdown();
}