Program: 1716
Project: 1716
Buggy source:
private void fillInApplicationVersionFromParameters(Application app,ApplicationVersion version,List<ProcessingEvent> events,Map<Object,Object> parameterMap){
  version.setIdentifier(firstValue("String_Node_Str",parameterMap));
  if (version.getArchive() == null) {
    version.setArchive(new ApplicationArchive());
    version.getArchive().setApplication(app);
  }
  version.setApplication(app);
  version.setNotes(firstValue("String_Node_Str",parameterMap));
  Boolean archiveUncreated=true;
  if (parameterMap.get("String_Node_Str") != null) {
    if (!(parameterMap.get("String_Node_Str") instanceof FileItem)) {
      events.add(new MessagesEvent("String_Node_Str"));
    }
 else {
      FileItem item=(FileItem)parameterMap.get("String_Node_Str");
      Long size=item.getSize();
      if (size > 0) {
        try {
          File tempFile=ServletUtils.tempFileFromFileItem(modelManager.getGlobalSettings().getTemporaryStoragePath(),item);
          ApplicationArchive archive=version.getArchive();
          archive.setNewFileUploaded(tempFile.getAbsolutePath());
          archiveUncreated=false;
        }
 catch (        Exception ioe) {
          logger.error("String_Node_Str",ioe);
          events.add(new MessagesEvent(ioe.getMessage()));
          return;
        }
 finally {
          item.delete();
        }
      }
 else {
        events.add(new MessagesEvent("String_Node_Str"));
      }
    }
  }
  if (archiveUncreated) {
    ApplicationArchive archive=version.getArchive();
    archive.setUrl(firstValue("String_Node_Str",parameterMap));
    archive.setHashAlgorithm(firstValue("String_Node_Str",parameterMap));
    archive.setHash(firstValue("String_Node_Str",parameterMap));
    if (notEmpty("String_Node_Str",parameterMap)) {
      archive.setBytesLength(Integer.valueOf(firstValue("String_Node_Str",parameterMap)));
    }
    if (notEmpty("String_Node_Str",parameterMap)) {
      archive.setBytesLengthUncompressed(Integer.valueOf(firstValue("String_Node_Str",parameterMap)));
    }
  }
}

Fixed version (ground truth):
private void fillInApplicationVersionFromParameters(Application app,ApplicationVersion version,List<ProcessingEvent> events,Map<Object,Object> parameterMap){
  version.setIdentifier(firstValue("String_Node_Str",parameterMap));
  if (version.getArchive() == null) {
    version.setArchive(new ApplicationArchive());
    version.getArchive().setApplication(app);
  }
  version.setApplication(app);
  version.setNotes(firstValue("String_Node_Str",parameterMap));
  Boolean archiveUncreated=true;
  if (parameterMap.get("String_Node_Str") != null) {
    if (!(parameterMap.get("String_Node_Str") instanceof FileItem)) {
      events.add(new MessagesEvent("String_Node_Str"));
    }
 else {
      FileItem item=(FileItem)parameterMap.get("String_Node_Str");
      Long size=item.getSize();
      if (size > 0) {
        try {
          File tempFile=ServletUtils.tempFileFromFileItem(modelManager.getGlobalSettings().getTemporaryStoragePath(),item);
          ApplicationArchive archive=version.getArchive();
          archive.setNewFileUploaded(tempFile.getAbsolutePath());
          archiveUncreated=false;
        }
 catch (        Exception ioe) {
          logger.error("String_Node_Str",ioe);
          events.add(new MessagesEvent(ioe.getMessage()));
          return;
        }
 finally {
          item.delete();
        }
      }
 else {
        events.add(new MessagesEvent("String_Node_Str"));
      }
    }
  }
  if (archiveUncreated) {
    ApplicationArchive archive=version.getArchive();
    archive.setHashAlgorithm(firstValue("String_Node_Str",parameterMap));
    archive.setHash(firstValue("String_Node_Str",parameterMap));
    ApplicationArchive arch=modelManager.getModelService().findApplicationArchiveByHashAndAlgorithm(app,archive.getHash(),archive.getHashAlgorithm());
    if (arch != null) {
      version.setArchive(arch);
      archive=arch;
    }
    archive.setUrl(firstValue("String_Node_Str",parameterMap));
    if (notEmpty("String_Node_Str",parameterMap)) {
      archive.setBytesLength(Integer.valueOf(firstValue("String_Node_Str",parameterMap)));
    }
    if (notEmpty("String_Node_Str",parameterMap)) {
      archive.setBytesLengthUncompressed(Integer.valueOf(firstValue("String_Node_Str",parameterMap)));
    }
  }
}