Program: 51968
Project: 51968
Buggy source:
/** 
 * Do any post-processing after the step's backend processing occurred (in the doProcessing() method). <P> It is this method's job to determine whether processing completed successfully, or display another JSP informing the users of any potential problems/errors. <P> If this step doesn't require user interaction OR you are solely using Manakin for your user interface, then this method may be left EMPTY, since all step processing should occur in the doProcessing() method.
 * @param context current DSpace context
 * @param request current servlet request object
 * @param response current servlet response object
 * @param subInfo submission info object
 * @param status any status/errors reported by doProcessing() method
 */
public void doPostProcessing(Context context,HttpServletRequest request,HttpServletResponse response,SubmissionInfo subInfo,int status) throws ServletException, IOException, SQLException, AuthorizeException {
  String buttonPressed=UIUtil.getSubmitButton(request,UploadStep.NEXT_BUTTON);
  boolean fileRequired=ConfigurationManager.getBooleanProperty("String_Node_Str",true);
  if (UIUtil.getBoolParameter(request,"String_Node_Str")) {
    Gson gson=new Gson();
    response.setContentType("String_Node_Str");
    JSONUploadResponse jsonResponse=new JSONUploadResponse();
    String bitstreamName=null;
    UUID bitstreamID=null;
    long size=0;
    String url=null;
    if (subInfo.getBitstream() != null) {
      Bitstream bitstream=subInfo.getBitstream();
      bitstreamName=bitstream.getName();
      bitstreamID=bitstream.getID();
      size=bitstream.getSize();
      url=request.getContextPath() + "String_Node_Str" + bitstreamID+ "String_Node_Str"+ UIUtil.encodeBitstreamName(bitstreamName);
    }
    jsonResponse.addUploadFileStatus(bitstreamName,bitstreamID,size,url,status);
    response.getWriter().print(gson.toJson(jsonResponse));
    response.flushBuffer();
    return;
  }
  if (buttonPressed.equalsIgnoreCase(UploadStep.SUBMIT_SKIP_BUTTON) || (buttonPressed.equalsIgnoreCase(UploadStep.SUBMIT_UPLOAD_BUTTON) && !fileRequired)) {
    List<Bundle> bundles=itemService.getBundles(subInfo.getSubmissionItem().getItem(),"String_Node_Str");
    boolean fileAlreadyUploaded=false;
    for (    Bundle bnd : bundles) {
      fileAlreadyUploaded=bnd.getBitstreams().size() > 0;
      if (fileAlreadyUploaded) {
        break;
      }
    }
    if (fileAlreadyUploaded) {
      showUploadFileList(context,request,response,subInfo,true,false);
    }
    return;
  }
  if (buttonPressed.equalsIgnoreCase("String_Node_Str")) {
    showUploadPage(context,request,response,subInfo,false);
  }
 else   if (status == UploadWithEmbargoStep.STATUS_EDIT_POLICIES) {
    showEditBitstreamAccess(context,request,response,subInfo);
  }
 else   if (status == UploadWithEmbargoStep.STATUS_EDIT_COMPLETE) {
    showUploadPage(context,request,response,subInfo,false);
  }
 else   if (status == AccessStep.STATUS_EDIT_POLICY) {
    showEditPolicy(context,request,response,subInfo);
  }
  if (status != UploadStep.STATUS_COMPLETE) {
    if (status == UploadStep.STATUS_INTEGRITY_ERROR) {
      log.warn(LogManager.getHeader(context,"String_Node_Str",UIUtil.getRequestLogInfo(request)));
      JSPManager.showIntegrityError(request,response);
    }
 else     if (status == UploadStep.STATUS_UPLOAD_ERROR || status == UploadStep.STATUS_NO_FILES_ERROR) {
      if (buttonPressed.startsWith("String_Node_Str")) {
        showUploadPage(context,request,response,subInfo,false);
      }
 else {
        if (subInfo != null) {
          try {
            Collection c=subInfo.getSubmissionItem().getCollection();
            DCInputsReader inputsReader=new DCInputsReader();
            request.setAttribute("String_Node_Str",inputsReader.getInputs(c.getHandle()));
          }
 catch (          DCInputsReaderException e) {
            throw new ServletException(e);
          }
        }
        JSPStepManager.showJSP(request,response,subInfo,UPLOAD_ERROR_JSP);
      }
    }
 else     if (status == UploadStep.STATUS_VIRUS_CHECKER_UNAVAILABLE) {
      if (subInfo != null) {
        try {
          Collection c=subInfo.getSubmissionItem().getCollection();
          DCInputsReader inputsReader=new DCInputsReader();
          request.setAttribute("String_Node_Str",inputsReader.getInputs(c.getHandle()));
        }
 catch (        DCInputsReaderException e) {
          throw new ServletException(e);
        }
      }
      JSPStepManager.showJSP(request,response,subInfo,VIRUS_CHECKER_ERROR_JSP);
    }
 else     if (status == UploadStep.STATUS_CONTAINS_VIRUS) {
      if (subInfo != null) {
        try {
          Collection c=subInfo.getSubmissionItem().getCollection();
          DCInputsReader inputsReader=new DCInputsReader();
          request.setAttribute("String_Node_Str",inputsReader.getInputs(c.getHandle()));
        }
 catch (        DCInputsReaderException e) {
          throw new ServletException(e);
        }
      }
      JSPStepManager.showJSP(request,response,subInfo,VIRUS_ERROR_JSP);
    }
 else     if (status == UploadStep.STATUS_UNKNOWN_FORMAT) {
      showGetFileFormat(context,request,response,subInfo);
    }
  }
  if (status == UploadStep.STATUS_COMPLETE && buttonPressed.equals(UploadStep.NEXT_BUTTON)) {
    return;
  }
  if (buttonPressed.equals(UploadStep.SUBMIT_MORE_BUTTON)) {
    showChooseFile(context,request,response,subInfo);
  }
 else   if (buttonPressed.equals("String_Node_Str")) {
    showUploadFileList(context,request,response,subInfo,false,true);
  }
 else   if (buttonPressed.startsWith("String_Node_Str")) {
    Bitstream bitstream;
    try {
      UUID id=UUID.fromString(buttonPressed.substring(16));
      bitstream=bitstreamService.find(context,id);
    }
 catch (    NumberFormatException nfe) {
      bitstream=null;
    }
    if (bitstream == null) {
      log.warn(LogManager.getHeader(context,"String_Node_Str",UIUtil.getRequestLogInfo(request)));
      JSPManager.showIntegrityError(request,response);
    }
    subInfo.setBitstream(bitstream);
    showFileDescription(context,request,response,subInfo);
  }
 else   if (buttonPressed.startsWith("String_Node_Str")) {
    Bitstream bitstream;
    try {
      UUID id=UUID.fromString(buttonPressed.substring(14));
      bitstream=bitstreamService.find(context,id);
    }
 catch (    NumberFormatException nfe) {
      bitstream=null;
    }
    if (bitstream == null) {
      log.warn(LogManager.getHeader(context,"String_Node_Str",UIUtil.getRequestLogInfo(request)));
      JSPManager.showIntegrityError(request,response);
    }
    subInfo.setBitstream(bitstream);
    showGetFileFormat(context,request,response,subInfo);
  }
 else {
    String contentType=request.getContentType();
    boolean fileUpload=false;
    if ((contentType != null) && (contentType.indexOf("String_Node_Str") != -1)) {
      fileUpload=true;
    }
    showUploadPage(context,request,response,subInfo,fileUpload);
  }
}

Fixed version (ground truth):
/** 
 * Do any post-processing after the step's backend processing occurred (in the doProcessing() method). <P> It is this method's job to determine whether processing completed successfully, or display another JSP informing the users of any potential problems/errors. <P> If this step doesn't require user interaction OR you are solely using Manakin for your user interface, then this method may be left EMPTY, since all step processing should occur in the doProcessing() method.
 * @param context current DSpace context
 * @param request current servlet request object
 * @param response current servlet response object
 * @param subInfo submission info object
 * @param status any status/errors reported by doProcessing() method
 */
public void doPostProcessing(Context context,HttpServletRequest request,HttpServletResponse response,SubmissionInfo subInfo,int status) throws ServletException, IOException, SQLException, AuthorizeException {
  String buttonPressed=UIUtil.getSubmitButton(request,UploadStep.NEXT_BUTTON);
  boolean fileRequired=ConfigurationManager.getBooleanProperty("String_Node_Str",true);
  if (UIUtil.getBoolParameter(request,"String_Node_Str")) {
    Gson gson=new Gson();
    response.setContentType("String_Node_Str");
    JSONUploadResponse jsonResponse=new JSONUploadResponse();
    String bitstreamName=null;
    UUID bitstreamID=null;
    long size=0;
    String url=null;
    if (subInfo.getBitstream() != null) {
      Bitstream bitstream=subInfo.getBitstream();
      bitstreamName=bitstream.getName();
      bitstreamID=bitstream.getID();
      size=bitstream.getSize();
      url=request.getContextPath() + "String_Node_Str" + bitstreamID+ "String_Node_Str"+ UIUtil.encodeBitstreamName(bitstreamName);
      jsonResponse.addUploadFileStatus(bitstreamName,bitstreamID,size,url,status);
      response.getWriter().print(gson.toJson(jsonResponse));
      response.flushBuffer();
    }
    return;
  }
  if (buttonPressed.equalsIgnoreCase(UploadStep.SUBMIT_SKIP_BUTTON) || (buttonPressed.equalsIgnoreCase(UploadStep.SUBMIT_UPLOAD_BUTTON) && !fileRequired)) {
    List<Bundle> bundles=itemService.getBundles(subInfo.getSubmissionItem().getItem(),"String_Node_Str");
    boolean fileAlreadyUploaded=false;
    for (    Bundle bnd : bundles) {
      fileAlreadyUploaded=bnd.getBitstreams().size() > 0;
      if (fileAlreadyUploaded) {
        break;
      }
    }
    if (fileAlreadyUploaded) {
      showUploadFileList(context,request,response,subInfo,true,false);
    }
    return;
  }
  if (buttonPressed.equalsIgnoreCase("String_Node_Str")) {
    showUploadPage(context,request,response,subInfo,false);
  }
 else   if (status == UploadWithEmbargoStep.STATUS_EDIT_POLICIES) {
    showEditBitstreamAccess(context,request,response,subInfo);
  }
 else   if (status == UploadWithEmbargoStep.STATUS_EDIT_COMPLETE) {
    showUploadPage(context,request,response,subInfo,false);
  }
 else   if (status == AccessStep.STATUS_EDIT_POLICY) {
    showEditPolicy(context,request,response,subInfo);
  }
  if (status != UploadStep.STATUS_COMPLETE) {
    if (status == UploadStep.STATUS_INTEGRITY_ERROR) {
      log.warn(LogManager.getHeader(context,"String_Node_Str",UIUtil.getRequestLogInfo(request)));
      JSPManager.showIntegrityError(request,response);
    }
 else     if (status == UploadStep.STATUS_UPLOAD_ERROR || status == UploadStep.STATUS_NO_FILES_ERROR) {
      if (buttonPressed.startsWith("String_Node_Str")) {
        showUploadPage(context,request,response,subInfo,false);
      }
 else {
        if (subInfo != null) {
          try {
            Collection c=subInfo.getSubmissionItem().getCollection();
            DCInputsReader inputsReader=new DCInputsReader();
            request.setAttribute("String_Node_Str",inputsReader.getInputs(c.getHandle()));
          }
 catch (          DCInputsReaderException e) {
            throw new ServletException(e);
          }
        }
        JSPStepManager.showJSP(request,response,subInfo,UPLOAD_ERROR_JSP);
      }
    }
 else     if (status == UploadStep.STATUS_VIRUS_CHECKER_UNAVAILABLE) {
      if (subInfo != null) {
        try {
          Collection c=subInfo.getSubmissionItem().getCollection();
          DCInputsReader inputsReader=new DCInputsReader();
          request.setAttribute("String_Node_Str",inputsReader.getInputs(c.getHandle()));
        }
 catch (        DCInputsReaderException e) {
          throw new ServletException(e);
        }
      }
      JSPStepManager.showJSP(request,response,subInfo,VIRUS_CHECKER_ERROR_JSP);
    }
 else     if (status == UploadStep.STATUS_CONTAINS_VIRUS) {
      if (subInfo != null) {
        try {
          Collection c=subInfo.getSubmissionItem().getCollection();
          DCInputsReader inputsReader=new DCInputsReader();
          request.setAttribute("String_Node_Str",inputsReader.getInputs(c.getHandle()));
        }
 catch (        DCInputsReaderException e) {
          throw new ServletException(e);
        }
      }
      JSPStepManager.showJSP(request,response,subInfo,VIRUS_ERROR_JSP);
    }
 else     if (status == UploadStep.STATUS_UNKNOWN_FORMAT) {
      showGetFileFormat(context,request,response,subInfo);
    }
  }
  if (status == UploadStep.STATUS_COMPLETE && buttonPressed.equals(UploadStep.NEXT_BUTTON)) {
    return;
  }
  if (buttonPressed.equals(UploadStep.SUBMIT_MORE_BUTTON)) {
    showChooseFile(context,request,response,subInfo);
  }
 else   if (buttonPressed.equals("String_Node_Str")) {
    showUploadFileList(context,request,response,subInfo,false,true);
  }
 else   if (buttonPressed.startsWith("String_Node_Str")) {
    Bitstream bitstream;
    try {
      UUID id=UUID.fromString(buttonPressed.substring(16));
      bitstream=bitstreamService.find(context,id);
    }
 catch (    NumberFormatException nfe) {
      bitstream=null;
    }
    if (bitstream == null) {
      log.warn(LogManager.getHeader(context,"String_Node_Str",UIUtil.getRequestLogInfo(request)));
      JSPManager.showIntegrityError(request,response);
    }
    subInfo.setBitstream(bitstream);
    showFileDescription(context,request,response,subInfo);
  }
 else   if (buttonPressed.startsWith("String_Node_Str")) {
    Bitstream bitstream;
    try {
      UUID id=UUID.fromString(buttonPressed.substring(14));
      bitstream=bitstreamService.find(context,id);
    }
 catch (    NumberFormatException nfe) {
      bitstream=null;
    }
    if (bitstream == null) {
      log.warn(LogManager.getHeader(context,"String_Node_Str",UIUtil.getRequestLogInfo(request)));
      JSPManager.showIntegrityError(request,response);
    }
    subInfo.setBitstream(bitstream);
    showGetFileFormat(context,request,response,subInfo);
  }
 else {
    String contentType=request.getContentType();
    boolean fileUpload=false;
    if ((contentType != null) && (contentType.indexOf("String_Node_Str") != -1)) {
      fileUpload=true;
    }
    showUploadPage(context,request,response,subInfo,fileUpload);
  }
}