Program: 43655
Project: 43655
Buggy source:
public Map<String,Object> parse(HttpServletRequest req,String charset,FilePool tmps) throws UploadException {
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + Mvcs.getRequestPath(req));
  UploadInfo info=Uploads.createInfo(req);
  if (log.isDebugEnabled())   log.debug("String_Node_Str");
  Map<String,Object> params=Uploads.createParamsMap(req);
  if (log.isDebugEnabled())   log.debugf("String_Node_Str",params.size());
  String firstBoundary="String_Node_Str" + Http.multipart.getBoundary(req.getContentType());
  byte[] firstBoundaryBytes=Lang.toBytes(firstBoundary.toCharArray());
  String itemEndl="String_Node_Str" + Http.multipart.getBoundary(req.getContentType());
  byte[] itemEndlBytes=Lang.toBytes(itemEndl.toCharArray());
  byte[] nameEndlBytes=Lang.toBytes("String_Node_Str".toCharArray());
  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");
  FieldMeta meta;
  try {
    do {
      info.current=br.load();
      mm=br.mark(nameEndlBytes);
      String s=br.dumpAsString();
      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 (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);
            do {
              info.current=br.load();
              mm=br.mark(itemEndlBytes);
              assertStreamNotEnd(mm);
              br.dump(ops);
            }
 while (mm == MarkMode.NOT_FOUND);
          }
  finally {
            Streams.safeClose(ops);
          }
          params.put(meta.getName(),new TempFile(meta,tmp));
        }
      }
 else {
        StreamBuffer sb=new StreamBuffer();
        do {
          info.current=br.load();
          mm=br.mark(itemEndlBytes);
          assertStreamNotEnd(mm);
          br.dump(sb.getBuffer());
        }
 while (mm == MarkMode.NOT_FOUND);
        params.put(meta.getName(),sb.toString(charset));
      }
    }
 while (mm != MarkMode.STREAM_END);
  }
 catch (  Exception 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,String charset,FilePool tmps) throws UploadException {
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + Mvcs.getRequestPath(req));
  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());
  byte[] firstBoundaryBytes=Lang.toBytes(firstBoundary.toCharArray());
  String itemEndl="String_Node_Str" + Http.multipart.getBoundary(req.getContentType());
  byte[] itemEndlBytes=Lang.toBytes(itemEndl.toCharArray());
  byte[] nameEndlBytes=Lang.toBytes("String_Node_Str".toCharArray());
  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");
  FieldMeta meta;
  try {
    do {
      info.current=br.load();
      mm=br.mark(nameEndlBytes);
      String s=br.dumpAsString();
      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 (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);
            do {
              info.current=br.load();
              mm=br.mark(itemEndlBytes);
              assertStreamNotEnd(mm);
              br.dump(ops);
            }
 while (mm == MarkMode.NOT_FOUND);
          }
  finally {
            Streams.safeClose(ops);
          }
          params.add(meta.getName(),new TempFile(meta,tmp));
        }
      }
 else {
        StreamBuffer sb=new StreamBuffer();
        do {
          info.current=br.load();
          mm=br.mark(itemEndlBytes);
          assertStreamNotEnd(mm);
          br.dump(sb.getBuffer());
        }
 while (mm == MarkMode.NOT_FOUND);
        params.add(meta.getName(),sb.toString(charset));
      }
    }
 while (mm != MarkMode.STREAM_END);
  }
 catch (  Exception e) {
    throw Lang.wrapThrow(e,UploadException.class);
  }
 finally {
    br.close();
  }
  if (log.isDebugEnabled())   log.debugf("String_Node_Str",br.readed());
  return params;
}