Program: 43472
Project: 43472
Buggy source:
public Map<String,Object> parse(HttpServletRequest req,UploadingContext context) throws UploadException {
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + Mvcs.getRequestPath(req));
  int bufferSize=context.getBufferSize();
  String charset=context.getCharset();
  FilePool tmps=context.getFilePool();
  int maxFileSize=context.getMaxFileSize();
  UploadInfo info=Uploads.createInfo(req);
  if (log.isDebugEnabled())   log.debug("String_Node_Str");
  NutMap params=Uploads.createParamsMap(req);
  if (log.isDebugEnabled())   log.debugf("String_Node_Str",params.size());
  String firstBoundary="String_Node_Str" + Http.multipart.getBoundary(req.getContentType());
  RemountBytes firstBoundaryBytes=RemountBytes.create(firstBoundary);
  String itemEndl="String_Node_Str" + Http.multipart.getBoundary(req.getContentType());
  RemountBytes itemEndlBytes=RemountBytes.create(itemEndl);
  RemountBytes nameEndlBytes=RemountBytes.create("String_Node_Str");
  if (Http.multipart.getBoundary(req.getContentType()) == null) {
    if (log.isInfoEnabled())     log.info("String_Node_Str");
    return params;
  }
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + itemEndl);
  MarkMode mm;
  BufferRing br;
  try {
    ServletInputStream ins=req.getInputStream();
    br=new BufferRing(ins,3,bufferSize);
    info.current=br.load();
    mm=br.mark(firstBoundaryBytes);
    if (mm != MarkMode.FOUND) {
      if (log.isWarnEnabled())       log.warnf("String_Node_Str",firstBoundary);
      return params;
    }
    br.skipMark();
    if (log.isDebugEnabled())     log.debug("String_Node_Str");
  }
 catch (  IOException e) {
    throw Lang.wrapThrow(e);
  }
  if (log.isDebugEnabled())   log.debug("String_Node_Str");
  try {
    FieldMeta meta;
    do {
      info.current=br.load();
      mm=br.mark(nameEndlBytes);
      String s=br.dumpAsString(charset);
      if ("String_Node_Str".equals(s) || MarkMode.STREAM_END == mm) {
        break;
      }
 else       if (MarkMode.FOUND == mm) {
        meta=new FieldMeta(s);
      }
 else {
        throw new UploadInvalidFormatException("String_Node_Str");
      }
      if (meta.isFile()) {
        if (!context.isNameAccepted(meta.getFileLocalName())) {
          throw new UploadUnsupportedFileNameException(meta);
        }
        if (!context.isContentTypeAccepted(meta.getContentType())) {
          throw new UploadUnsupportedFileTypeException(meta);
        }
        if (Strings.isBlank(meta.getFileLocalPath())) {
          do {
            info.current=br.load();
            mm=br.mark(itemEndlBytes);
            assertStreamNotEnd(mm);
            br.skipMark();
          }
 while (mm == MarkMode.NOT_FOUND);
        }
 else {
          File tmp=tmps.createFile(meta.getFileExtension());
          OutputStream ops=null;
          try {
            ops=new BufferedOutputStream(new FileOutputStream(tmp),bufferSize * 2);
            if (maxFileSize > 0) {
              long maxPos=info.current + maxFileSize;
              do {
                info.current=br.load();
                mm=br.mark(itemEndlBytes);
                assertStreamNotEnd(mm);
                if (info.current > maxPos) {
                  throw new UploadOutOfSizeException(meta);
                }
                br.dump(ops);
              }
 while (mm == MarkMode.NOT_FOUND);
            }
 else {
              do {
                info.current=br.load();
                mm=br.mark(itemEndlBytes);
                assertStreamNotEnd(mm);
                br.dump(ops);
              }
 while (mm == MarkMode.NOT_FOUND);
            }
          }
  finally {
            Streams.safeFlush(ops);
            Streams.safeClose(ops);
          }
          if (context.isIgnoreNull() && tmp.length() == 0) {
          }
 else {
            params.add(meta.getName(),new TempFile(meta,tmp));
          }
        }
      }
 else {
        StringBuilder sb=new StringBuilder();
        do {
          info.current=br.load();
          mm=br.mark(itemEndlBytes);
          assertStreamNotEnd(mm);
          sb.append(br.dumpAsString(charset));
        }
 while (mm == MarkMode.NOT_FOUND);
        params.add(meta.getName(),sb.toString());
        if (log.isDebugEnabled())         log.debugf("String_Node_Str",meta.getName(),sb.toString());
      }
    }
 while (mm != MarkMode.STREAM_END);
  }
 catch (  IOException e) {
    throw Lang.wrapThrow(e,UploadException.class);
  }
 finally {
    br.close();
  }
  if (log.isDebugEnabled())   log.debugf("String_Node_Str",br.readed());
  return params;
}

Fixed version (ground truth):
public Map<String,Object> parse(HttpServletRequest req,UploadingContext context) throws UploadException {
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + Mvcs.getRequestPath(req));
  int bufferSize=context.getBufferSize();
  String charset=context.getCharset();
  FilePool tmps=context.getFilePool();
  int maxFileSize=context.getMaxFileSize();
  UploadInfo info=Uploads.createInfo(req);
  if (log.isDebugEnabled())   log.debug("String_Node_Str");
  NutMap params=Uploads.createParamsMap(req);
  if (log.isDebugEnabled())   log.debugf("String_Node_Str",params.size());
  String firstBoundary="String_Node_Str" + Http.multipart.getBoundary(req.getContentType());
  RemountBytes firstBoundaryBytes=RemountBytes.create(firstBoundary);
  String itemEndl="String_Node_Str" + Http.multipart.getBoundary(req.getContentType());
  RemountBytes itemEndlBytes=RemountBytes.create(itemEndl);
  RemountBytes nameEndlBytes=RemountBytes.create("String_Node_Str");
  if (Http.multipart.getBoundary(req.getContentType()) == null) {
    if (log.isInfoEnabled())     log.info("String_Node_Str");
    return params;
  }
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + itemEndl);
  MarkMode mm;
  BufferRing br;
  try {
    ServletInputStream ins=req.getInputStream();
    br=new BufferRing(ins,3,bufferSize);
    info.current=br.load();
    mm=br.mark(firstBoundaryBytes);
    if (mm != MarkMode.FOUND) {
      if (log.isWarnEnabled())       log.warnf("String_Node_Str",firstBoundary);
      return params;
    }
    br.skipMark();
    if (log.isDebugEnabled())     log.debug("String_Node_Str");
  }
 catch (  IOException e) {
    throw Lang.wrapThrow(e);
  }
  if (log.isDebugEnabled())   log.debug("String_Node_Str");
  try {
    FieldMeta meta;
    do {
      info.current=br.load();
      mm=br.mark(nameEndlBytes);
      String s=br.dumpAsString(charset);
      if ("String_Node_Str".equals(s) || MarkMode.STREAM_END == mm) {
        break;
      }
 else       if (MarkMode.FOUND == mm) {
        meta=new FieldMeta(s);
      }
 else {
        throw new UploadInvalidFormatException("String_Node_Str");
      }
      if (meta.isFile()) {
        if (!context.isNameAccepted(meta.getFileLocalName())) {
          throw new UploadUnsupportedFileNameException(meta);
        }
        if (!context.isContentTypeAccepted(meta.getContentType())) {
          throw new UploadUnsupportedFileTypeException(meta);
        }
        if (Strings.isBlank(meta.getFileLocalPath())) {
          do {
            info.current=br.load();
            mm=br.mark(itemEndlBytes);
            assertStreamNotEnd(mm);
            br.skipMark();
          }
 while (mm == MarkMode.NOT_FOUND);
        }
 else {
          File tmp=tmps.createFile(meta.getFileExtension());
          OutputStream ops=null;
          try {
            ops=new BufferedOutputStream(new FileOutputStream(tmp),bufferSize * 2);
            if (maxFileSize > 0) {
              long maxPos=info.current + maxFileSize;
              do {
                info.current=br.load();
                mm=br.mark(itemEndlBytes);
                assertStreamNotEnd(mm);
                if (info.current > maxPos) {
                  throw new UploadOutOfSizeException(meta);
                }
                br.dump(ops);
                if (info.stop)                 throw new UploadStopException(info);
              }
 while (mm == MarkMode.NOT_FOUND);
            }
 else {
              do {
                info.current=br.load();
                mm=br.mark(itemEndlBytes);
                assertStreamNotEnd(mm);
                br.dump(ops);
                if (info.stop)                 throw new UploadStopException(info);
              }
 while (mm == MarkMode.NOT_FOUND);
            }
          }
  finally {
            Streams.safeFlush(ops);
            Streams.safeClose(ops);
          }
          if (context.isIgnoreNull() && tmp.length() == 0) {
          }
 else {
            params.add(meta.getName(),new TempFile(meta,tmp));
          }
        }
      }
 else {
        StringBuilder sb=new StringBuilder();
        do {
          info.current=br.load();
          mm=br.mark(itemEndlBytes);
          assertStreamNotEnd(mm);
          sb.append(br.dumpAsString(charset));
        }
 while (mm == MarkMode.NOT_FOUND);
        params.add(meta.getName(),sb.toString());
        if (log.isDebugEnabled())         log.debugf("String_Node_Str",meta.getName(),sb.toString());
      }
    }
 while (mm != MarkMode.STREAM_END);
  }
 catch (  IOException e) {
    throw Lang.wrapThrow(e,UploadException.class);
  }
 finally {
    br.close();
  }
  if (log.isDebugEnabled())   log.debugf("String_Node_Str",br.readed());
  return params;
}