Program: 3544
Project: 3544
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);
  if (buttonPressed.equalsIgnoreCase(UploadStep.SUBMIT_SKIP_BUTTON)) {
    Bundle[] bundles=subInfo.getSubmissionItem().getItem().getBundles("String_Node_Str");
    if (bundles.length > 0) {
      showUploadFileList(context,request,response,subInfo,true,false);
    }
    return;
  }
  if (buttonPressed.equalsIgnoreCase("String_Node_Str")) {
    showUploadPage(context,request,response,subInfo,false);
  }
  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) {
          Collection c=subInfo.getSubmissionItem().getCollection();
          DCInputsReader inputsReader=new DCInputsReader();
          request.setAttribute("String_Node_Str",inputsReader.getInputs(c.getHandle()));
        }
        JSPStepManager.showJSP(request,response,subInfo,UPLOAD_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 {
      int id=Integer.parseInt(buttonPressed.substring(16));
      bitstream=Bitstream.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 {
      int id=Integer.parseInt(buttonPressed.substring(14));
      bitstream=Bitstream.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 (buttonPressed.equalsIgnoreCase(UploadStep.SUBMIT_SKIP_BUTTON) || (buttonPressed.equalsIgnoreCase(UploadStep.SUBMIT_UPLOAD_BUTTON) && !fileRequired)) {
    Bundle[] bundles=subInfo.getSubmissionItem().getItem().getBundles("String_Node_Str");
    if (bundles.length > 0) {
      showUploadFileList(context,request,response,subInfo,true,false);
    }
    return;
  }
  if (buttonPressed.equalsIgnoreCase("String_Node_Str")) {
    showUploadPage(context,request,response,subInfo,false);
  }
  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) {
          Collection c=subInfo.getSubmissionItem().getCollection();
          DCInputsReader inputsReader=new DCInputsReader();
          request.setAttribute("String_Node_Str",inputsReader.getInputs(c.getHandle()));
        }
        JSPStepManager.showJSP(request,response,subInfo,UPLOAD_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 {
      int id=Integer.parseInt(buttonPressed.substring(16));
      bitstream=Bitstream.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 {
      int id=Integer.parseInt(buttonPressed.substring(14));
      bitstream=Bitstream.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);
  }
}