Program: 16491
Project: 16491
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 attrs=new HashMap();
  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 precent=(Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT);
        Map size=(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);
          precent.remove(key);
          return;
        }
        final Integer p=(Integer)precent.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 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 precent=(Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT);
      Map size=(Map)desktop.getAttribute(Attributes.UPLOAD_SIZE);
      final String key=uuid + '_' + sid;
      if (precent != null) {
        precent.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 precent=(Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT);
    Map size=(Map)desktop.getAttribute(Attributes.UPLOAD_SIZE);
    final String key=uuid + '_' + sid;
    if (precent != null) {
      precent.remove(key);
      size.put(key,alert);
    }
  }
  if (D.ON && 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 attrs=new HashMap();
  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 precent=(Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT);
        Map size=(Map)desktop.getAttribute(Attributes.UPLOAD_SIZE);
        final String key=uuid + '_' + sid;
        Object sinfo=size.get(key);
        if (sinfo instanceof String) {
          System.out.println("String_Node_Str");
          response.getWriter().write("String_Node_Str" + sinfo);
          size.remove(key);
          precent.remove(key);
          return;
        }
        System.out.println("String_Node_Str");
        final Integer p=(Integer)precent.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 {
      System.out.println("String_Node_Str");
      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 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 precent=(Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT);
      Map size=(Map)desktop.getAttribute(Attributes.UPLOAD_SIZE);
      final String key=uuid + '_' + sid;
      if (precent != null) {
        precent.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 precent=(Map)desktop.getAttribute(Attributes.UPLOAD_PERCENT);
    Map size=(Map)desktop.getAttribute(Attributes.UPLOAD_SIZE);
    final String key=uuid + '_' + sid;
    if (precent != null) {
      precent.remove(key);
      size.put(key,alert);
    }
  }
  if (D.ON && 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);
}