Program: 105510
Project: 105510
Buggy source:
/** 
 * Multipart upload is a complex operation with all the options defined by Amazon.   Part of the functionality is provided by the query done against the database.  The CommonPrefixes functionality is done the same way as done in the listBucketContents function (i.e., by iterating though the list to decide which output element each key is placed).
 * @param request
 * @param response
 * @throws IOException
 */
public void executeListMultipartUploads(HttpServletRequest request,HttpServletResponse response) throws IOException {
  String bucketName=(String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
  String delimiter=request.getParameter("String_Node_Str");
  String keyMarker=request.getParameter("String_Node_Str");
  String prefix=request.getParameter("String_Node_Str");
  int maxUploads=1000;
  int nextUploadId=0;
  String nextKey=null;
  boolean isTruncated=false;
  S3MultipartUpload[] uploads=null;
  S3MultipartUpload onePart=null;
  String temp=request.getParameter("String_Node_Str");
  if (null != temp) {
    maxUploads=Integer.parseInt(temp);
    if (maxUploads > 1000 || maxUploads < 0)     maxUploads=1000;
  }
  String uploadIdMarker=request.getParameter("String_Node_Str");
  if (null == keyMarker)   uploadIdMarker=null;
  SBucketVO bucket=bucketDao.getByName(bucketName);
  if (bucket == null) {
    logger.error("String_Node_Str" + bucketName + "String_Node_Str");
    response.setStatus(404);
    return;
  }
  S3PolicyContext context=new S3PolicyContext(PolicyActions.ListBucketMultipartUploads,bucketName);
  context.setEvalParam(ConditionKeys.Prefix,prefix);
  context.setEvalParam(ConditionKeys.Delimiter,delimiter);
  S3Engine.verifyAccess(context,"String_Node_Str",bucket.getId(),SAcl.PERMISSION_READ);
  try {
    MultipartLoadDao uploadDao=new MultipartLoadDao();
    OrderedPair<S3MultipartUpload[],Boolean> result=uploadDao.getInitiatedUploads(bucketName,maxUploads,prefix,keyMarker,uploadIdMarker);
    uploads=result.getFirst();
    isTruncated=result.getSecond().booleanValue();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + e.getMessage(),e);
    response.setStatus(500);
  }
  StringBuffer xml=new StringBuffer();
  xml.append("String_Node_Str");
  xml.append("String_Node_Str");
  xml.append("String_Node_Str").append(bucketName).append("String_Node_Str");
  xml.append("String_Node_Str").append((null == keyMarker ? "String_Node_Str" : keyMarker)).append("String_Node_Str");
  xml.append("String_Node_Str").append((null == uploadIdMarker ? "String_Node_Str" : uploadIdMarker)).append("String_Node_Str");
  StringBuffer partsList=new StringBuffer();
  for (int i=0; i < uploads.length; i++) {
    onePart=uploads[i];
    if (null == onePart)     break;
    if (delimiter != null && !delimiter.isEmpty()) {
      if (StringHelper.substringInBetween(onePart.getKey(),prefix,delimiter) != null)       continue;
    }
    nextKey=onePart.getKey();
    nextUploadId=onePart.getId();
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str").append(nextKey).append("String_Node_Str");
    partsList.append("String_Node_Str").append(nextUploadId).append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str").append(onePart.getAccessKey()).append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str").append(onePart.getAccessKey()).append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str").append(DatatypeConverter.printDateTime(onePart.getLastModified())).append("String_Node_Str");
    partsList.append("String_Node_Str");
  }
  for (int i=0; i < uploads.length; i++) {
    onePart=uploads[i];
    if (null == onePart)     break;
    if (delimiter != null && !delimiter.isEmpty()) {
      String subName=StringHelper.substringInBetween(onePart.getKey(),prefix,delimiter);
      if (subName != null) {
        partsList.append("String_Node_Str");
        partsList.append("String_Node_Str");
        if (prefix != null && prefix.length() > 0)         partsList.append(prefix + delimiter + subName);
 else         partsList.append(subName);
        partsList.append("String_Node_Str");
        partsList.append("String_Node_Str");
      }
    }
  }
  xml.append("String_Node_Str").append((null == nextKey ? "String_Node_Str" : nextKey)).append("String_Node_Str");
  xml.append("String_Node_Str").append((0 == nextUploadId ? "String_Node_Str" : nextUploadId)).append("String_Node_Str");
  xml.append("String_Node_Str").append(maxUploads).append("String_Node_Str");
  xml.append("String_Node_Str").append(isTruncated).append("String_Node_Str");
  xml.append(partsList.toString());
  xml.append("String_Node_Str");
  response.setStatus(200);
  response.setContentType("String_Node_Str");
  S3RestServlet.endResponse(response,xml.toString());
}

Fixed version (ground truth):
/** 
 * Multipart upload is a complex operation with all the options defined by Amazon.   Part of the functionality is provided by the query done against the database.  The CommonPrefixes functionality is done the same way as done in the listBucketContents function (i.e., by iterating though the list to decide which output element each key is placed).
 * @param request
 * @param response
 * @throws IOException
 */
public void executeListMultipartUploads(HttpServletRequest request,HttpServletResponse response) throws IOException {
  String bucketName=(String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
  String delimiter=request.getParameter("String_Node_Str");
  String keyMarker=request.getParameter("String_Node_Str");
  String prefix=request.getParameter("String_Node_Str");
  int maxUploads=1000;
  int nextUploadId=0;
  String nextKey=null;
  boolean isTruncated=false;
  S3MultipartUpload[] uploads=null;
  S3MultipartUpload onePart=null;
  String temp=request.getParameter("String_Node_Str");
  if (null != temp) {
    maxUploads=Integer.parseInt(temp);
    if (maxUploads > 1000 || maxUploads < 0)     maxUploads=1000;
  }
  String uploadIdMarker=request.getParameter("String_Node_Str");
  if (null == keyMarker)   uploadIdMarker=null;
  SBucketVO bucket=bucketDao.getByName(bucketName);
  if (bucket == null) {
    logger.error("String_Node_Str" + bucketName + "String_Node_Str");
    response.setStatus(404);
    return;
  }
  S3PolicyContext context=new S3PolicyContext(PolicyActions.ListBucketMultipartUploads,bucketName);
  context.setEvalParam(ConditionKeys.Prefix,prefix);
  context.setEvalParam(ConditionKeys.Delimiter,delimiter);
  S3Engine.verifyAccess(context,"String_Node_Str",bucket.getId(),SAcl.PERMISSION_READ);
  try {
    MultipartLoadDao uploadDao=new MultipartLoadDao();
    OrderedPair<S3MultipartUpload[],Boolean> result=uploadDao.getInitiatedUploads(bucketName,maxUploads,prefix,keyMarker,uploadIdMarker);
    uploads=result.getFirst();
    isTruncated=result.getSecond().booleanValue();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + e.getMessage(),e);
    response.setStatus(500);
  }
  StringBuffer xml=new StringBuffer();
  xml.append("String_Node_Str");
  xml.append("String_Node_Str");
  xml.append("String_Node_Str").append(bucketName).append("String_Node_Str");
  xml.append("String_Node_Str").append((null == keyMarker ? "String_Node_Str" : StringEscapeUtils.escapeHtml(keyMarker))).append("String_Node_Str");
  xml.append("String_Node_Str").append((null == uploadIdMarker ? "String_Node_Str" : uploadIdMarker)).append("String_Node_Str");
  StringBuffer partsList=new StringBuffer();
  for (int i=0; i < uploads.length; i++) {
    onePart=uploads[i];
    if (null == onePart)     break;
    if (delimiter != null && !delimiter.isEmpty()) {
      if (StringHelper.substringInBetween(onePart.getKey(),prefix,delimiter) != null)       continue;
    }
    nextKey=onePart.getKey();
    nextUploadId=onePart.getId();
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str").append(nextKey).append("String_Node_Str");
    partsList.append("String_Node_Str").append(nextUploadId).append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str").append(onePart.getAccessKey()).append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str").append(onePart.getAccessKey()).append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str");
    partsList.append("String_Node_Str").append(DatatypeConverter.printDateTime(onePart.getLastModified())).append("String_Node_Str");
    partsList.append("String_Node_Str");
  }
  for (int i=0; i < uploads.length; i++) {
    onePart=uploads[i];
    if (null == onePart)     break;
    if (delimiter != null && !delimiter.isEmpty()) {
      String subName=StringHelper.substringInBetween(onePart.getKey(),prefix,delimiter);
      if (subName != null) {
        partsList.append("String_Node_Str");
        partsList.append("String_Node_Str");
        if (prefix != null && prefix.length() > 0)         partsList.append(StringEscapeUtils.escapeHtml(prefix) + StringEscapeUtils.escapeHtml(delimiter) + StringEscapeUtils.escapeHtml(subName));
 else         partsList.append(StringEscapeUtils.escapeHtml(subName));
        partsList.append("String_Node_Str");
        partsList.append("String_Node_Str");
      }
    }
  }
  xml.append("String_Node_Str").append((null == nextKey ? "String_Node_Str" : nextKey)).append("String_Node_Str");
  xml.append("String_Node_Str").append((0 == nextUploadId ? "String_Node_Str" : nextUploadId)).append("String_Node_Str");
  xml.append("String_Node_Str").append(maxUploads).append("String_Node_Str");
  xml.append("String_Node_Str").append(isTruncated).append("String_Node_Str");
  xml.append(partsList.toString());
  xml.append("String_Node_Str");
  response.setStatus(200);
  response.setContentType("String_Node_Str");
  S3RestServlet.endResponse(response,xml.toString());
}