Program: 83591
Project: 83591
Buggy source:
private void doCommandAnalyse() throws IOException {
  if (featureDir == null)   throw new RuntimeException("String_Node_Str");
  if (maxentModelFilePath == null)   throw new RuntimeException("String_Node_Str");
  if (outfilePath == null)   throw new RuntimeException("String_Node_Str");
  CSVEventListReader reader=this.getReader(TrainingSetType.ALL_TEST,false);
  GenericEvents events=reader.getEvents();
  try {
    LOG.info("String_Node_Str");
    ZipInputStream zis=new ZipInputStream(new FileInputStream(maxentModelFilePath));
    ZipEntry ze;
    while ((ze=zis.getNextEntry()) != null) {
      if (ze.getName().endsWith("String_Node_Str"))       break;
    }
    MaxentModel model=new MaxentModelReader(zis).getModel();
    zis.close();
    MaxentAnalyser analyser=new MaxentAnalyser();
    analyser.setMaxentModel(model);
    if (preferredOutcome != null) {
      analyser.setPreferredOutcome(preferredOutcome);
      analyser.setBias(bias);
    }
    String outDirPath=outfilePath.substring(0,outfilePath.lastIndexOf('/'));
    File outDir=new File(outDirPath);
    outDir.mkdirs();
    File outcomeFile=new File(outfilePath);
    if (outfilePath.endsWith("String_Node_Str")) {
      MaxentOutcomeXmlWriter xmlWriter=new MaxentOutcomeXmlWriter(outcomeFile);
      xmlWriter.setMinProbToConsider(minProbToConsider);
      xmlWriter.setUnknownOutcomeName(unknownOutcomeName);
      analyser.addObserver(xmlWriter);
    }
 else {
      MaxentOutcomeCsvWriter csvWriter=new MaxentOutcomeCsvWriter(model,outcomeFile);
      csvWriter.setMinProbToConsider(minProbToConsider);
      csvWriter.setUnknownOutcomeName(unknownOutcomeName);
      analyser.addObserver(csvWriter);
    }
    MaxentBestFeatureObserver bestFeatureObserver=null;
    if (!crossValidation && featureCount > 0 && resultFilePath != null) {
      bestFeatureObserver=new MaxentBestFeatureObserver(model,featureCount,reader.getFeatureToFileMap());
      analyser.addObserver(bestFeatureObserver);
    }
    MaxentFScoreCalculator maxentFScoreCalculator=null;
    if (resultFilePath != null) {
      maxentFScoreCalculator=new MaxentFScoreCalculator();
      maxentFScoreCalculator.setMinProbToConsider(minProbToConsider);
      maxentFScoreCalculator.setUnknownOutcomeName(unknownOutcomeName);
      analyser.addObserver(maxentFScoreCalculator);
    }
    analyser.analyse(events);
    if (maxentFScoreCalculator != null) {
      FScoreCalculator<String> fscoreCalculator=maxentFScoreCalculator.getFscoreCalculator();
      LOG.info("String_Node_Str" + fscoreCalculator.getTotalFScore());
      File fscoreFile=new File(outfilePath + "String_Node_Str");
      fscoreCalculator.writeScoresToCSVFile(fscoreFile);
    }
    if (bestFeatureObserver != null) {
      File weightPerFileFile=new File(outfilePath + "String_Node_Str");
      weightPerFileFile.delete();
      weightPerFileFile.createNewFile();
      Writer weightPerFileWriter=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(weightPerFileFile,false),"String_Node_Str"));
      try {
        bestFeatureObserver.writeFileTotalsToFile(weightPerFileWriter);
      }
  finally {
        weightPerFileWriter.flush();
        weightPerFileWriter.close();
      }
      LOG.debug("String_Node_Str" + reader.getFeatures().size());
    }
  }
 catch (  IOException ioe) {
    LogUtils.logError(LOG,ioe);
    throw new RuntimeException(ioe);
  }
  if (generateEventFile) {
    File eventFile=new File(outfilePath + "String_Node_Str");
    this.generateEventFile(eventFile,events);
  }
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
private void doCommandAnalyse() throws IOException {
  if (featureDir == null)   throw new RuntimeException("String_Node_Str");
  if (maxentModelFilePath == null)   throw new RuntimeException("String_Node_Str");
  if (outfilePath == null)   throw new RuntimeException("String_Node_Str");
  CSVEventListReader reader=this.getReader(TrainingSetType.ALL_TEST,false);
  GenericEvents events=reader.getEvents();
  try {
    LOG.info("String_Node_Str");
    ZipInputStream zis=new ZipInputStream(new FileInputStream(maxentModelFilePath));
    ZipEntry ze;
    while ((ze=zis.getNextEntry()) != null) {
      if (ze.getName().endsWith("String_Node_Str"))       break;
    }
    MaxentModel model=new MaxentModelReader(zis).getModel();
    zis.close();
    MaxentAnalyser analyser=new MaxentAnalyser();
    analyser.setMaxentModel(model);
    if (preferredOutcome != null) {
      analyser.setPreferredOutcome(preferredOutcome);
      analyser.setBias(bias);
    }
    if (outfilePath.lastIndexOf('/') >= 0) {
      String outDirPath=outfilePath.substring(0,outfilePath.lastIndexOf('/'));
      File outDir=new File(outDirPath);
      outDir.mkdirs();
    }
    File outcomeFile=new File(outfilePath);
    if (outfilePath.endsWith("String_Node_Str")) {
      MaxentOutcomeXmlWriter xmlWriter=new MaxentOutcomeXmlWriter(outcomeFile);
      xmlWriter.setMinProbToConsider(minProbToConsider);
      xmlWriter.setUnknownOutcomeName(unknownOutcomeName);
      analyser.addObserver(xmlWriter);
    }
 else {
      MaxentOutcomeCsvWriter csvWriter=new MaxentOutcomeCsvWriter(model,outcomeFile);
      csvWriter.setMinProbToConsider(minProbToConsider);
      csvWriter.setUnknownOutcomeName(unknownOutcomeName);
      analyser.addObserver(csvWriter);
    }
    MaxentBestFeatureObserver bestFeatureObserver=null;
    if (!crossValidation && featureCount > 0 && resultFilePath != null) {
      bestFeatureObserver=new MaxentBestFeatureObserver(model,featureCount,reader.getFeatureToFileMap());
      analyser.addObserver(bestFeatureObserver);
    }
    MaxentFScoreCalculator maxentFScoreCalculator=null;
    if (resultFilePath != null) {
      maxentFScoreCalculator=new MaxentFScoreCalculator();
      maxentFScoreCalculator.setMinProbToConsider(minProbToConsider);
      maxentFScoreCalculator.setUnknownOutcomeName(unknownOutcomeName);
      analyser.addObserver(maxentFScoreCalculator);
    }
    analyser.analyse(events);
    if (maxentFScoreCalculator != null) {
      FScoreCalculator<String> fscoreCalculator=maxentFScoreCalculator.getFscoreCalculator();
      LOG.info("String_Node_Str" + fscoreCalculator.getTotalFScore());
      File fscoreFile=new File(outfilePath + "String_Node_Str");
      fscoreCalculator.writeScoresToCSVFile(fscoreFile);
    }
    if (bestFeatureObserver != null) {
      File weightPerFileFile=new File(outfilePath + "String_Node_Str");
      weightPerFileFile.delete();
      weightPerFileFile.createNewFile();
      Writer weightPerFileWriter=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(weightPerFileFile,false),"String_Node_Str"));
      try {
        bestFeatureObserver.writeFileTotalsToFile(weightPerFileWriter);
      }
  finally {
        weightPerFileWriter.flush();
        weightPerFileWriter.close();
      }
      LOG.debug("String_Node_Str" + reader.getFeatures().size());
    }
  }
 catch (  IOException ioe) {
    LogUtils.logError(LOG,ioe);
    throw new RuntimeException(ioe);
  }
  if (generateEventFile) {
    File eventFile=new File(outfilePath + "String_Node_Str");
    this.generateEventFile(eventFile,events);
  }
  LOG.info("String_Node_Str");
}