Program: 16065
Project: 16065
Buggy source:
/** 
 * Processes a file uploaded from the client.
 */
public void service(HttpServletRequest request,HttpServletResponse response,String pathInfo) throws ServletException, IOException {
  final Session sess=Sessions.getCurrent(false);
  if (sess == null) {
    response.setIntHeader("String_Node_Str",HttpServletResponse.SC_GONE);
    return;
  }
  final Map<String,String> attrs=new HashMap<String,String>();
  String alert=null, uuid=null, nextURI=null, sid=null;
  Desktop desktop=null;
  try {
    if (!isMultipartContent(request)) {
      if ("String_Node_Str".equals(request.getParameter("String_Node_Str"))) {
        uuid=request.getParameter("String_Node_Str");
        sid=request.getParameter("String_Node_Str");
        desktop=((WebAppCtrl)sess.getWebApp()).getDesktopCache(sess).getDesktop(request.getParameter("String_Node_Str"));
        Map<String,Integer> percent=cast((Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT));
        Map<String,Object> size=cast((Map)desktop.getAttribute(Attributes.UPLOAD_SIZE));
        final String key=uuid + '_' + sid;
        Object sinfo=size.get(key);
        if (sinfo instanceof String) {
          response.getWriter().write("String_Node_Str" + sinfo);
          size.remove(key);
          percent.remove(key);
          return;
        }
        final Integer p=percent.get(key);
        final Long cb=(Long)sinfo;
        response.getWriter().write((p != null ? p.intValue() : -1) + "String_Node_Str" + (cb != null ? cb.longValue() : -1));
        return;
      }
 else       alert="String_Node_Str";
    }
 else {
      uuid=request.getParameter("String_Node_Str");
      sid=request.getParameter("String_Node_Str");
      if (uuid == null || uuid.length() == 0) {
        alert="String_Node_Str";
      }
 else {
        attrs.put("String_Node_Str",uuid);
        attrs.put("String_Node_Str",sid);
        final String dtid=request.getParameter("String_Node_Str");
        if (dtid == null || dtid.length() == 0) {
          alert="String_Node_Str";
        }
 else {
          desktop=((WebAppCtrl)sess.getWebApp()).getDesktopCache(sess).getDesktop(dtid);
          final Map<String,Object> params=parseRequest(request,desktop,uuid + '_' + sid);
          nextURI=(String)params.get("String_Node_Str");
          params.put("String_Node_Str",request.getParameter("String_Node_Str"));
          processItems(desktop,params,attrs);
        }
      }
    }
  }
 catch (  Throwable ex) {
    if (uuid == null) {
      uuid=request.getParameter("String_Node_Str");
      if (uuid != null)       attrs.put("String_Node_Str",uuid);
    }
    if (nextURI == null)     nextURI=request.getParameter("String_Node_Str");
    if (ex instanceof ComponentNotFoundException) {
      alert=Messages.get(MZk.UPDATE_OBSOLETE_PAGE,uuid);
    }
 else     if (ex instanceof IOFileUploadException) {
      log.debug("String_Node_Str");
    }
 else {
      alert=handleError(ex);
    }
    if (desktop != null) {
      Map<String,Integer> percent=cast((Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT));
      Map<String,Object> size=cast((Map)desktop.getAttribute(Attributes.UPLOAD_SIZE));
      final String key=uuid + '_' + sid;
      if (percent != null) {
        percent.remove(key);
        size.remove(key);
      }
    }
  }
  if (attrs.get("String_Node_Str") == null && alert == null)   alert="String_Node_Str";
  if (alert != null) {
    if (desktop == null) {
      response.setIntHeader("String_Node_Str",HttpServletResponse.SC_GONE);
      return;
    }
    Map<String,Integer> percent=cast((Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT));
    Map<String,Object> size=cast((Map)desktop.getAttribute(Attributes.UPLOAD_SIZE));
    final String key=uuid + '_' + sid;
    if (percent != null) {
      percent.remove(key);
      size.put(key,alert);
    }
  }
  if (log.finerable())   log.finer(attrs);
  if (nextURI == null || nextURI.length() == 0)   nextURI="String_Node_Str";
  Servlets.forward(_ctx,request,response,nextURI,attrs,Servlets.PASS_THRU_ATTR);
}

Fixed version (ground truth):
/** 
 * Processes a file uploaded from the client.
 */
public void service(HttpServletRequest request,HttpServletResponse response,String pathInfo) throws ServletException, IOException {
  final Session sess=Sessions.getCurrent(false);
  if (sess == null) {
    response.setIntHeader("String_Node_Str",HttpServletResponse.SC_GONE);
    return;
  }
  final Map<String,String> attrs=new HashMap<String,String>();
  String alert=null, uuid=null, nextURI=null, sid=null;
  Desktop desktop=null;
  try {
    if (!isMultipartContent(request)) {
      if ("String_Node_Str".equals(request.getParameter("String_Node_Str"))) {
        uuid=XMLs.encodeText(request.getParameter("String_Node_Str"));
        sid=XMLs.encodeText(request.getParameter("String_Node_Str"));
        desktop=((WebAppCtrl)sess.getWebApp()).getDesktopCache(sess).getDesktop(XMLs.encodeText(request.getParameter("String_Node_Str")));
        Map<String,Integer> percent=cast((Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT));
        Map<String,Object> size=cast((Map)desktop.getAttribute(Attributes.UPLOAD_SIZE));
        final String key=uuid + '_' + sid;
        Object sinfo=size.get(key);
        if (sinfo instanceof String) {
          response.getWriter().write("String_Node_Str" + sinfo);
          size.remove(key);
          percent.remove(key);
          return;
        }
        final Integer p=percent.get(key);
        final Long cb=(Long)sinfo;
        response.getWriter().write((p != null ? p.intValue() : -1) + "String_Node_Str" + (cb != null ? cb.longValue() : -1));
        return;
      }
 else       alert="String_Node_Str";
    }
 else {
      uuid=XMLs.encodeText(request.getParameter("String_Node_Str"));
      sid=XMLs.encodeText(request.getParameter("String_Node_Str"));
      if (uuid == null || uuid.length() == 0) {
        alert="String_Node_Str";
      }
 else {
        attrs.put("String_Node_Str",uuid);
        attrs.put("String_Node_Str",sid);
        final String dtid=XMLs.encodeText(request.getParameter("String_Node_Str"));
        if (dtid == null || dtid.length() == 0) {
          alert="String_Node_Str";
        }
 else {
          desktop=((WebAppCtrl)sess.getWebApp()).getDesktopCache(sess).getDesktop(dtid);
          final Map<String,Object> params=parseRequest(request,desktop,uuid + '_' + sid);
          nextURI=(String)params.get("String_Node_Str");
          params.put("String_Node_Str",request.getParameter("String_Node_Str"));
          processItems(desktop,params,attrs);
        }
      }
    }
  }
 catch (  Throwable ex) {
    if (uuid == null) {
      uuid=request.getParameter("String_Node_Str");
      if (uuid != null)       attrs.put("String_Node_Str",uuid);
    }
    if (nextURI == null)     nextURI=request.getParameter("String_Node_Str");
    if (ex instanceof ComponentNotFoundException) {
      alert=Messages.get(MZk.UPDATE_OBSOLETE_PAGE,uuid);
    }
 else     if (ex instanceof IOFileUploadException) {
      log.debug("String_Node_Str");
    }
 else {
      alert=handleError(ex);
    }
    if (desktop != null) {
      Map<String,Integer> percent=cast((Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT));
      Map<String,Object> size=cast((Map)desktop.getAttribute(Attributes.UPLOAD_SIZE));
      final String key=uuid + '_' + sid;
      if (percent != null) {
        percent.remove(key);
        size.remove(key);
      }
    }
  }
  if (attrs.get("String_Node_Str") == null && alert == null)   alert="String_Node_Str";
  if (alert != null) {
    if (desktop == null) {
      response.setIntHeader("String_Node_Str",HttpServletResponse.SC_GONE);
      return;
    }
    Map<String,Integer> percent=cast((Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT));
    Map<String,Object> size=cast((Map)desktop.getAttribute(Attributes.UPLOAD_SIZE));
    final String key=uuid + '_' + sid;
    if (percent != null) {
      percent.remove(key);
      size.put(key,alert);
    }
  }
  if (log.finerable())   log.finer(attrs);
  if (nextURI == null || nextURI.length() == 0)   nextURI="String_Node_Str";
  Servlets.forward(_ctx,request,response,nextURI,attrs,Servlets.PASS_THRU_ATTR);
}