Program: 52069
Project: 52069
Buggy source:
/** 
 * Respond to a post request for metadata bulk importing via csv
 * @param context a DSpace Context object
 * @param request the HTTP request
 * @param response the HTTP response
 * @throws ServletException
 * @throws IOException
 * @throws SQLException
 * @throws AuthorizeException
 */
protected void doDSPost(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  int type=-1;
  String typeS=request.getParameter("String_Node_Str");
  if (typeS != null) {
    try {
      type=Integer.parseInt(typeS);
    }
 catch (    NumberFormatException e) {
      e.printStackTrace();
    }
  }
  List<Collection> collections=null;
  String colIdS=request.getParameter("String_Node_Str");
  if (colIdS != null) {
    collections=new ArrayList<Collection>();
    collections.add(Collection.find(context,Integer.parseInt(colIdS)));
  }
 else {
    collections=Arrays.asList(Collection.findAll(context));
  }
  request.setAttribute("String_Node_Str",collections);
  if (type != 0) {
    String contentType=request.getContentType();
    if ((contentType != null) && (contentType.indexOf("String_Node_Str") != -1)) {
      String message=null;
      try {
        FileUploadRequest wrapper=new FileUploadRequest(request);
        File f=wrapper.getFile("String_Node_Str");
        int colId=Integer.parseInt(wrapper.getParameter("String_Node_Str"));
        Collection collection=Collection.find(context,colId);
        String inputType=wrapper.getParameter("String_Node_Str");
        try {
          ItemImport.processUploadableImport(f,new Collection[]{collection},inputType,context);
          request.setAttribute("String_Node_Str","String_Node_Str");
        }
 catch (        Exception e) {
          request.setAttribute("String_Node_Str","String_Node_Str");
          message=e.getMessage();
          e.printStackTrace();
        }
      }
 catch (      FileSizeLimitExceededException e) {
        request.setAttribute("String_Node_Str","String_Node_Str");
        message=e.getMessage();
        e.printStackTrace();
      }
catch (      Exception e) {
        request.setAttribute("String_Node_Str","String_Node_Str");
        message=e.getMessage();
        e.printStackTrace();
      }
      BTEBatchImportService dls=new DSpace().getSingletonService(BTEBatchImportService.class);
      List<String> inputTypes=dls.getFileDataLoaders();
      request.setAttribute("String_Node_Str",inputTypes);
      request.setAttribute("String_Node_Str",message);
      JSPManager.showJSP(request,response,"String_Node_Str");
    }
 else {
      request.setAttribute("String_Node_Str","String_Node_Str");
      JSPManager.showJSP(request,response,"String_Node_Str");
    }
  }
 else {
    request.setAttribute("String_Node_Str",type);
    String message=null;
    String uploadId=request.getParameter("String_Node_Str");
    if (uploadId != null) {
      request.setAttribute("String_Node_Str",uploadId);
    }
    String zipurl=request.getParameter("String_Node_Str");
    if (StringUtils.isEmpty(zipurl)) {
      request.setAttribute("String_Node_Str","String_Node_Str");
    }
 else {
      Collection owningCollection=null;
      if (request.getParameter("String_Node_Str") != null) {
        int colId=Integer.parseInt(request.getParameter("String_Node_Str"));
        if (colId > 0)         owningCollection=Collection.find(context,colId);
      }
      String[] reqCollections=request.getParameterValues("String_Node_Str");
      if (owningCollection == null && reqCollections.length > 0) {
        request.setAttribute("String_Node_Str","String_Node_Str");
        Locale locale=request.getLocale();
        ResourceBundle msgs=ResourceBundle.getBundle("String_Node_Str",locale);
        String ms=msgs.getString("String_Node_Str");
        if (ms == null) {
          ms="String_Node_Str";
        }
        request.setAttribute("String_Node_Str",ms);
        JSPManager.showJSP(request,response,"String_Node_Str");
        return;
      }
      List<Collection> collectionList=new ArrayList<Collection>();
      if (reqCollections != null) {
        for (        String colID : reqCollections) {
          int colId=Integer.parseInt(colID);
          if (colId != owningCollection.getID()) {
            Collection col=Collection.find(context,colId);
            if (col != null) {
              collectionList.add(col);
            }
          }
        }
      }
      Collection[] otherCollections=collectionList.toArray(new Collection[collectionList.size()]);
      try {
        if (uploadId != null) {
          ItemImport.processResumableImport(zipurl,owningCollection,otherCollections,uploadId,context);
        }
 else {
          ItemImport.processUploadableImport(zipurl,owningCollection,otherCollections,context);
        }
        request.setAttribute("String_Node_Str","String_Node_Str");
      }
 catch (      Exception e) {
        request.setAttribute("String_Node_Str","String_Node_Str");
        message=e.getMessage();
        e.printStackTrace();
      }
    }
    request.setAttribute("String_Node_Str",message);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Respond to a post request for metadata bulk importing via csv
 * @param context a DSpace Context object
 * @param request the HTTP request
 * @param response the HTTP response
 * @throws ServletException
 * @throws IOException
 * @throws SQLException
 * @throws AuthorizeException
 */
protected void doDSPost(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  int type=-1;
  String typeS=request.getParameter("String_Node_Str");
  if (typeS != null) {
    try {
      type=Integer.parseInt(typeS);
    }
 catch (    NumberFormatException e) {
      e.printStackTrace();
    }
  }
  List<Collection> collections=null;
  String colIdS=request.getParameter("String_Node_Str");
  if (colIdS != null) {
    collections=new ArrayList<Collection>();
    collections.add(Collection.find(context,Integer.parseInt(colIdS)));
  }
 else {
    collections=Arrays.asList(Collection.findAll(context));
  }
  request.setAttribute("String_Node_Str",collections);
  if (type != 0) {
    String contentType=request.getContentType();
    if ((contentType != null) && (contentType.indexOf("String_Node_Str") != -1)) {
      String message=null;
      try {
        FileUploadRequest wrapper=new FileUploadRequest(request);
        File f=wrapper.getFile("String_Node_Str");
        int colId=Integer.parseInt(wrapper.getParameter("String_Node_Str"));
        Collection collection=Collection.find(context,colId);
        String inputType=wrapper.getParameter("String_Node_Str");
        try {
          ItemImport.processUploadableImport(f,new Collection[]{collection},inputType,context);
          request.setAttribute("String_Node_Str","String_Node_Str");
        }
 catch (        Exception e) {
          request.setAttribute("String_Node_Str","String_Node_Str");
          message=e.getMessage();
          e.printStackTrace();
        }
      }
 catch (      FileSizeLimitExceededException e) {
        request.setAttribute("String_Node_Str","String_Node_Str");
        message=e.getMessage();
        e.printStackTrace();
      }
catch (      Exception e) {
        request.setAttribute("String_Node_Str","String_Node_Str");
        message=e.getMessage();
        e.printStackTrace();
      }
      BTEBatchImportService dls=new DSpace().getSingletonService(BTEBatchImportService.class);
      List<String> inputTypes=dls.getFileDataLoaders();
      request.setAttribute("String_Node_Str",inputTypes);
      request.setAttribute("String_Node_Str",message);
      JSPManager.showJSP(request,response,"String_Node_Str");
    }
 else {
      request.setAttribute("String_Node_Str","String_Node_Str");
      JSPManager.showJSP(request,response,"String_Node_Str");
    }
  }
 else {
    request.setAttribute("String_Node_Str",type);
    String message=null;
    String uploadId=request.getParameter("String_Node_Str");
    if (uploadId != null) {
      request.setAttribute("String_Node_Str",uploadId);
    }
    String zipurl=request.getParameter("String_Node_Str");
    if (StringUtils.isEmpty(zipurl)) {
      request.setAttribute("String_Node_Str","String_Node_Str");
    }
 else {
      Collection owningCollection=null;
      if (request.getParameter("String_Node_Str") != null) {
        int colId=Integer.parseInt(request.getParameter("String_Node_Str"));
        if (colId > 0)         owningCollection=Collection.find(context,colId);
      }
      String[] reqCollections=request.getParameterValues("String_Node_Str");
      if (owningCollection == null && reqCollections.length > 0) {
        request.setAttribute("String_Node_Str","String_Node_Str");
        Locale locale=request.getLocale();
        ResourceBundle msgs=ResourceBundle.getBundle("String_Node_Str",locale);
        String ms=msgs.getString("String_Node_Str");
        if (ms == null) {
          ms="String_Node_Str";
        }
        request.setAttribute("String_Node_Str",ms);
        JSPManager.showJSP(request,response,"String_Node_Str");
        return;
      }
      try {
        if (uploadId != null) {
          ItemImport.processResumableImport(zipurl,owningCollection,reqCollections,uploadId,context);
        }
 else {
          ItemImport.processUploadableImport(zipurl,owningCollection,reqCollections,context);
        }
        request.setAttribute("String_Node_Str","String_Node_Str");
      }
 catch (      Exception e) {
        request.setAttribute("String_Node_Str","String_Node_Str");
        message=e.getMessage();
        e.printStackTrace();
      }
    }
    request.setAttribute("String_Node_Str",message);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
}