Program: 189325
Project: 189325
Buggy source:
/** 
 * A method to update the "Personal Info", "Document Info" and "Degree Info" excluding committee members.
 * @param subId (The submission id)
 * @param field (The name of the form field being updated)
 * @param value (The value being submitted)
 */
@Security(RoleType.REVIEWER) public static void updateJSON(Long subId,String field,String value){
  if (value != null) {
    value=value.trim();
    if ("String_Node_Str".equals(value.toLowerCase()) || "String_Node_Str".equals(value.toLowerCase()))     value=null;
  }
  Submission submission=subRepo.findSubmission(subId);
  Person submitter=submission.getSubmitter();
  Object currentValue=null;
  String message=null;
  DegreeLevel degreeLevel=null;
  try {
    if ("String_Node_Str".equals(field)) {
      submission.setStudentFirstName(value);
      currentValue=submission.getStudentFirstName();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setStudentMiddleName(value);
      currentValue=submission.getStudentMiddleName();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setStudentLastName(value);
      currentValue=submission.getStudentLastName();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      try {
        new InternetAddress(value).validate();
      }
 catch (      AddressException ae) {
        throw new RuntimeException("String_Node_Str");
      }
      submitter.setCurrentEmailAddress(value);
      currentValue=submitter.getCurrentEmailAddress();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value != null && value.length() > 0) {
        Integer birthYearInt=null;
        try {
          birthYearInt=Integer.valueOf(value);
        }
 catch (        NumberFormatException nfe) {
          throw new RuntimeException("String_Node_Str");
        }
        if (birthYearInt < 1900 || birthYearInt > Calendar.getInstance().get(Calendar.YEAR))         throw new RuntimeException("String_Node_Str" + Calendar.getInstance().get(Calendar.YEAR) + "String_Node_Str");
        submission.setStudentBirthYear(Integer.valueOf(value));
      }
 else {
        submission.setStudentBirthYear(null);
      }
      currentValue=submission.getStudentBirthYear();
    }
 else     if ("String_Node_Str".equals(field)) {
      boolean orcidVerify=true;
      if (settingRepo.getConfigBoolean(AppConfig.ORCID_VALIDATION)) {
        if (settingRepo.getConfigBoolean(AppConfig.ORCID_AUTHENTICATION))         orcidVerify=Utilities.verifyOrcid(value,submission.getStudentFirstName(),submission.getStudentLastName());
 else         orcidVerify=Utilities.verifyOrcid(value);
      }
      if (!orcidVerify)       throw new RuntimeException("String_Node_Str");
      submission.setOrcid(value);
      currentValue=submission.getOrcid();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      submitter.setPermanentPhoneNumber(value);
      currentValue=submitter.getPermanentPhoneNumber();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value != null && value.length() > 0) {
        try {
          new InternetAddress(value).validate();
        }
 catch (        AddressException ae) {
          throw new RuntimeException("String_Node_Str");
        }
      }
      submitter.setPermanentEmailAddress(value);
      currentValue=submitter.getPermanentEmailAddress();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      submitter.setPermanentPostalAddress(value);
      currentValue=submitter.getPermanentPostalAddress();
    }
 else     if ("String_Node_Str".equals(field)) {
      submitter.setCurrentPhoneNumber(value);
      currentValue=submitter.getCurrentPhoneNumber();
    }
 else     if ("String_Node_Str".equals(field)) {
      submitter.setCurrentPostalAddress(value);
      currentValue=submitter.getCurrentPostalAddress();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      submission.setDocumentTitle(value);
      currentValue=submission.getDocumentTitle();
    }
 else     if ("String_Node_Str".equals(field)) {
      EmbargoType embargo=settingRepo.findEmbargoType(Long.parseLong(value));
      submission.addEmbargoType(embargo);
      currentValue=submission.getEmbargoTypeByGuarantor(EmbargoGuarantor.DEFAULT).getName();
    }
 else     if ("String_Node_Str".equals(field)) {
      Boolean umi=null;
      if ("String_Node_Str".equals(value)) {
        umi=true;
      }
 else {
        umi=false;
      }
      submission.setUMIRelease(umi);
      currentValue=submission.getUMIRelease() ? "String_Node_Str" : "String_Node_Str";
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDocumentType(value);
      currentValue=submission.getDocumentType();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDocumentKeywords(value);
      currentValue=submission.getDocumentKeywords();
    }
 else     if ("String_Node_Str".equals(field)) {
      String primary=params.get("String_Node_Str");
      String secondary=params.get("String_Node_Str");
      String tertiary=params.get("String_Node_Str");
      submission.getDocumentSubjects().clear();
      if (primary != null && primary.trim().length() > 0)       submission.addDocumentSubject(primary);
      if (secondary != null && secondary.trim().length() > 0)       submission.addDocumentSubject(secondary);
      if (tertiary != null && tertiary.trim().length() > 0)       submission.addDocumentSubject(tertiary);
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDocumentLanguage(value);
      currentValue=submission.getDocumentLanguageLocale().getDisplayName();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setPublishedMaterial(value);
      currentValue=submission.getPublishedMaterial();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDocumentAbstract(value);
      currentValue=submission.getDocumentAbstract();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setCollege(value);
      currentValue=submission.getCollege();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setProgram(value);
      currentValue=submission.getProgram();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDepartment(value);
      currentValue=submission.getDepartment();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDegree(value);
      currentValue=submission.getDegree();
      degreeLevel=settingRepo.findDegreeByName(submission.getDegree()).getLevel();
      submission.setDegreeLevel(degreeLevel);
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setMajor(value);
      currentValue=submission.getMajor();
    }
 else     if ("String_Node_Str".equals(field)) {
      List<String> parsedGrad=parseGraduation(value);
      int month=monthNameToInt(parsedGrad.get(0));
      Integer year=null;
      try {
        year=Integer.valueOf(parsedGrad.get(1));
      }
 catch (      NumberFormatException nfe) {
        throw new RuntimeException("String_Node_Str");
      }
      submission.setGraduationMonth(month);
      submission.setGraduationYear(year);
      String gradMonth=new DateFormatSymbols().getMonths()[submission.getGraduationMonth()];
      currentValue=gradMonth + "String_Node_Str" + submission.getGraduationYear().toString();
    }
 else     if ("String_Node_Str".equals(field)) {
      Logger.info("String_Node_Str" + value);
      Date defenseDate=null;
      DateFormat formatter=new SimpleDateFormat("String_Node_Str");
      if (value != null) {
        try {
          defenseDate=(Date)formatter.parse(value);
        }
 catch (        ParseException e) {
          throw new RuntimeException("String_Node_Str");
        }
      }
      submission.setDefenseDate(defenseDate);
      if (submission.getDefenseDate() != null)       currentValue=formatter.format(submission.getDefenseDate());
 else       currentValue=null;
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      try {
        new InternetAddress(value).validate();
      }
 catch (      AddressException ae) {
        throw new RuntimeException("String_Node_Str");
      }
      submission.setCommitteeContactEmail(value);
      currentValue=submission.getCommitteeContactEmail();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setReviewerNotes(value);
      currentValue=submission.getReviewerNotes();
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + field);
    }
    submitter.save();
    submission.save();
  }
 catch (  RuntimeException re) {
    if (value == null) {
      value="String_Node_Str";
    }
    value=escapeJavaScript(value);
    message=re.getMessage();
    Logger.error("String_Node_Str" + field + "String_Node_Str");
    renderJSON("String_Node_Str" + value + "String_Node_Str"+ message+ "String_Node_Str");
  }
  if (currentValue == null) {
    value=escapeJavaScript("String_Node_Str");
  }
 else {
    value=escapeJavaScript(currentValue.toString());
  }
  String json;
  if (degreeLevel != null) {
    json="String_Node_Str" + value + "String_Node_Str"+ degreeLevel+ "String_Node_Str";
  }
 else {
    json="String_Node_Str" + value + "String_Node_Str";
  }
  renderJSON(json);
}

Fixed version (ground truth):
/** 
 * A method to update the "Personal Info", "Document Info" and "Degree Info" excluding committee members.
 * @param subId (The submission id)
 * @param field (The name of the form field being updated)
 * @param value (The value being submitted)
 */
@Security(RoleType.REVIEWER) public static void updateJSON(Long subId,String field,String value){
  if (value != null) {
    value=value.trim();
    if ("String_Node_Str".equals(value.toLowerCase()) || "String_Node_Str".equals(value.toLowerCase()))     value=null;
  }
  Submission submission=subRepo.findSubmission(subId);
  Person submitter=submission.getSubmitter();
  Object currentValue=null;
  String message=null;
  DegreeLevel degreeLevel=null;
  try {
    if ("String_Node_Str".equals(field)) {
      submission.setStudentFirstName(value);
      currentValue=submission.getStudentFirstName();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setStudentMiddleName(value);
      currentValue=submission.getStudentMiddleName();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setStudentLastName(value);
      currentValue=submission.getStudentLastName();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      try {
        new InternetAddress(value).validate();
      }
 catch (      AddressException ae) {
        throw new RuntimeException("String_Node_Str");
      }
      submitter.setCurrentEmailAddress(value);
      currentValue=submitter.getCurrentEmailAddress();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value != null && value.length() > 0) {
        Integer birthYearInt=null;
        try {
          birthYearInt=Integer.valueOf(value);
        }
 catch (        NumberFormatException nfe) {
          throw new RuntimeException("String_Node_Str");
        }
        if (birthYearInt < 1900 || birthYearInt > Calendar.getInstance().get(Calendar.YEAR))         throw new RuntimeException("String_Node_Str" + Calendar.getInstance().get(Calendar.YEAR) + "String_Node_Str");
        submission.setStudentBirthYear(Integer.valueOf(value));
      }
 else {
        submission.setStudentBirthYear(null);
      }
      currentValue=submission.getStudentBirthYear();
    }
 else     if ("String_Node_Str".equals(field)) {
      boolean orcidVerify=true;
      if (settingRepo.getConfigBoolean(AppConfig.ORCID_VALIDATION)) {
        if (settingRepo.getConfigBoolean(AppConfig.ORCID_AUTHENTICATION))         orcidVerify=Utilities.verifyOrcid(value,submission.getStudentFirstName(),submission.getStudentLastName());
 else         orcidVerify=Utilities.verifyOrcid(value);
      }
      if (!orcidVerify)       throw new RuntimeException("String_Node_Str");
      submitter.setOrcid(value);
      currentValue=submitter.getOrcid();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      submitter.setPermanentPhoneNumber(value);
      currentValue=submitter.getPermanentPhoneNumber();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value != null && value.length() > 0) {
        try {
          new InternetAddress(value).validate();
        }
 catch (        AddressException ae) {
          throw new RuntimeException("String_Node_Str");
        }
      }
      submitter.setPermanentEmailAddress(value);
      currentValue=submitter.getPermanentEmailAddress();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      submitter.setPermanentPostalAddress(value);
      currentValue=submitter.getPermanentPostalAddress();
    }
 else     if ("String_Node_Str".equals(field)) {
      submitter.setCurrentPhoneNumber(value);
      currentValue=submitter.getCurrentPhoneNumber();
    }
 else     if ("String_Node_Str".equals(field)) {
      submitter.setCurrentPostalAddress(value);
      currentValue=submitter.getCurrentPostalAddress();
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      submission.setDocumentTitle(value);
      currentValue=submission.getDocumentTitle();
    }
 else     if ("String_Node_Str".equals(field)) {
      EmbargoType embargo=settingRepo.findEmbargoType(Long.parseLong(value));
      submission.addEmbargoType(embargo);
      currentValue=submission.getEmbargoTypeByGuarantor(EmbargoGuarantor.DEFAULT).getName();
    }
 else     if ("String_Node_Str".equals(field)) {
      Boolean umi=null;
      if ("String_Node_Str".equals(value)) {
        umi=true;
      }
 else {
        umi=false;
      }
      submission.setUMIRelease(umi);
      currentValue=submission.getUMIRelease() ? "String_Node_Str" : "String_Node_Str";
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDocumentType(value);
      currentValue=submission.getDocumentType();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDocumentKeywords(value);
      currentValue=submission.getDocumentKeywords();
    }
 else     if ("String_Node_Str".equals(field)) {
      String primary=params.get("String_Node_Str");
      String secondary=params.get("String_Node_Str");
      String tertiary=params.get("String_Node_Str");
      submission.getDocumentSubjects().clear();
      if (primary != null && primary.trim().length() > 0)       submission.addDocumentSubject(primary);
      if (secondary != null && secondary.trim().length() > 0)       submission.addDocumentSubject(secondary);
      if (tertiary != null && tertiary.trim().length() > 0)       submission.addDocumentSubject(tertiary);
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDocumentLanguage(value);
      currentValue=submission.getDocumentLanguageLocale().getDisplayName();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setPublishedMaterial(value);
      currentValue=submission.getPublishedMaterial();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDocumentAbstract(value);
      currentValue=submission.getDocumentAbstract();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setCollege(value);
      currentValue=submission.getCollege();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setProgram(value);
      currentValue=submission.getProgram();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDepartment(value);
      currentValue=submission.getDepartment();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setDegree(value);
      currentValue=submission.getDegree();
      degreeLevel=settingRepo.findDegreeByName(submission.getDegree()).getLevel();
      submission.setDegreeLevel(degreeLevel);
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setMajor(value);
      currentValue=submission.getMajor();
    }
 else     if ("String_Node_Str".equals(field)) {
      List<String> parsedGrad=parseGraduation(value);
      int month=monthNameToInt(parsedGrad.get(0));
      Integer year=null;
      try {
        year=Integer.valueOf(parsedGrad.get(1));
      }
 catch (      NumberFormatException nfe) {
        throw new RuntimeException("String_Node_Str");
      }
      submission.setGraduationMonth(month);
      submission.setGraduationYear(year);
      String gradMonth=new DateFormatSymbols().getMonths()[submission.getGraduationMonth()];
      currentValue=gradMonth + "String_Node_Str" + submission.getGraduationYear().toString();
    }
 else     if ("String_Node_Str".equals(field)) {
      Logger.info("String_Node_Str" + value);
      Date defenseDate=null;
      DateFormat formatter=new SimpleDateFormat("String_Node_Str");
      if (value != null) {
        try {
          defenseDate=(Date)formatter.parse(value);
        }
 catch (        ParseException e) {
          throw new RuntimeException("String_Node_Str");
        }
      }
      submission.setDefenseDate(defenseDate);
      if (submission.getDefenseDate() != null)       currentValue=formatter.format(submission.getDefenseDate());
 else       currentValue=null;
    }
 else     if ("String_Node_Str".equals(field)) {
      if (value == null || value.length() == 0)       throw new RuntimeException("String_Node_Str");
      try {
        new InternetAddress(value).validate();
      }
 catch (      AddressException ae) {
        throw new RuntimeException("String_Node_Str");
      }
      submission.setCommitteeContactEmail(value);
      currentValue=submission.getCommitteeContactEmail();
    }
 else     if ("String_Node_Str".equals(field)) {
      submission.setReviewerNotes(value);
      currentValue=submission.getReviewerNotes();
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + field);
    }
    submitter.save();
    submission.save();
  }
 catch (  RuntimeException re) {
    if (value == null) {
      value="String_Node_Str";
    }
    value=escapeJavaScript(value);
    message=re.getMessage();
    Logger.error("String_Node_Str" + field + "String_Node_Str");
    renderJSON("String_Node_Str" + value + "String_Node_Str"+ message+ "String_Node_Str");
  }
  if (currentValue == null) {
    value=escapeJavaScript("String_Node_Str");
  }
 else {
    value=escapeJavaScript(currentValue.toString());
  }
  String json;
  if (degreeLevel != null) {
    json="String_Node_Str" + value + "String_Node_Str"+ degreeLevel+ "String_Node_Str";
  }
 else {
    json="String_Node_Str" + value + "String_Node_Str";
  }
  renderJSON(json);
}