Program: 90598
Project: 90598
Buggy source:
@ServeResourceMethod(portletNames="String_Node_Str",asyncSupported=true) public void getResource(ResourceRequest req,ResourceResponse resp) throws IOException, PortletException {
  Boolean auto=(Boolean)req.getAttribute(ATTRIB_AUTO);
  if (auto == null) {
    auto=false;
  }
  req.removeAttribute(ATTRIB_AUTO);
  Integer reps=(Integer)req.getAttribute(ATTRIB_REPS);
  if (reps == null) {
    reps=adb.getReps();
  }
  StringBuilder txt=new StringBuilder(128);
  txt.append("String_Node_Str");
  txt.append("String_Node_Str").append(adb.getDelay());
  txt.append("String_Node_Str").append(adb.getType());
  txt.append("String_Node_Str").append(reps);
  txt.append("String_Node_Str").append(adb.getReps());
  txt.append("String_Node_Str").append(adb.isAutoDispatch());
  txt.append("String_Node_Str").append(auto);
  LOGGER.fine(txt.toString());
  AsyncContext ctx=null;
  if (reps > 0) {
    reps--;
    req.setAttribute(ATTRIB_REPS,reps);
    ctx=req.startAsync();
    ctx.setTimeout(4000);
  }
  if (auto || (adb.getDelay() <= 0)) {
    PortletRequestDispatcher rd;
    if (ctx == null) {
      LOGGER.fine("String_Node_Str");
      try {
        ctx=req.getAsyncContext();
      }
 catch (      Exception e) {
        txt.setLength(0);
        txt.append("String_Node_Str").append(e.toString());
        LOGGER.warning(txt.toString());
        resp.getWriter().write(txt.toString());
        return;
      }
    }
    HttpServletRequest hreq=(HttpServletRequest)req.getAttribute("String_Node_Str");
    trace(hreq,"String_Node_Str");
    PortletConfig config=(PortletConfig)req.getAttribute("String_Node_Str");
    String portletName="String_Node_Str";
    if (config != null) {
      portletName=config.getPortletName();
    }
switch (adb.getType()) {
case DISPATCH:
      LOGGER.fine("String_Node_Str");
    ctx.dispatch(JSP);
  break;
case FWD:
LOGGER.fine("String_Node_Str");
req.setAttribute(ATTRIB_TITLE,"String_Node_Str");
rd=req.getPortletContext().getRequestDispatcher(JSP);
rd.forward(req,resp);
resp.flushBuffer();
if (!auto) {
ctx.complete();
}
break;
case INC:
LOGGER.fine("String_Node_Str");
req.setAttribute(ATTRIB_TITLE,"String_Node_Str");
rd=req.getPortletContext().getRequestDispatcher(JSP);
rd.include(req,resp);
resp.flushBuffer();
if (!auto) {
ctx.complete();
}
break;
default :
LOGGER.fine("String_Node_Str");
txt.setLength(0);
txt.append("String_Node_Str" + portletName + "String_Node_Str");
txt.append("String_Node_Str").append(req.getDispatcherType().toString());
txt.append("String_Node_Str");
resp.getWriter().write(txt.toString());
resp.flushBuffer();
if (!auto) {
ctx.complete();
}
break;
}
}
if (adb.getDelay() > 0 && req.isAsyncStarted()) {
OutputType type=adb.getType();
if (adb.isAutoDispatch()) {
type=OutputType.AUTO;
}
AsyncRunnable ar=new AsyncRunnable(ctx,adb.getDelay(),type);
ctx.start(ar);
}
}

Fixed version (ground truth):
@ServeResourceMethod(portletNames="String_Node_Str",asyncSupported=true) public void getResource(ResourceRequest req,ResourceResponse resp) throws IOException, PortletException {
  Boolean auto=(Boolean)req.getAttribute(ATTRIB_AUTO);
  if (auto == null) {
    auto=false;
  }
  req.removeAttribute(ATTRIB_AUTO);
  Integer reps=(Integer)req.getAttribute(ATTRIB_REPS);
  if (reps == null) {
    reps=adb.getReps();
  }
  boolean done=(reps <= 0) || (adb.getDelay() <= 0);
  reps--;
  req.setAttribute(ATTRIB_REPS,reps);
  StringBuilder txt=new StringBuilder(128);
  txt.append("String_Node_Str");
  txt.append("String_Node_Str").append(adb.getDelay());
  txt.append("String_Node_Str").append(adb.getType());
  txt.append("String_Node_Str").append(reps);
  txt.append("String_Node_Str").append(adb.getReps());
  txt.append("String_Node_Str").append(adb.isAutoDispatch());
  txt.append("String_Node_Str").append(auto);
  LOGGER.fine(txt.toString());
  AsyncContext ctx=req.startAsync();
  ctx.setTimeout(4000);
  if (auto || (adb.getDelay() <= 0)) {
    PortletRequestDispatcher rd;
    HttpServletRequest hreq=(HttpServletRequest)req.getAttribute("String_Node_Str");
    trace(hreq,"String_Node_Str");
    PortletConfig config=(PortletConfig)req.getAttribute("String_Node_Str");
    String portletName="String_Node_Str";
    if (config != null) {
      portletName=config.getPortletName();
    }
switch (adb.getType()) {
case DISPATCH:
      LOGGER.fine("String_Node_Str");
    req.setAttribute(ATTRIB_TITLE,"String_Node_Str");
  ctx.dispatch(hreq.getServletContext(),JSP);
break;
case FWD:
LOGGER.fine("String_Node_Str");
req.setAttribute(ATTRIB_TITLE,"String_Node_Str");
rd=req.getPortletContext().getRequestDispatcher(JSP);
rd.forward(req,resp);
resp.flushBuffer();
if (done) {
ctx.complete();
}
break;
case INC:
LOGGER.fine("String_Node_Str");
req.setAttribute(ATTRIB_TITLE,"String_Node_Str");
rd=req.getPortletContext().getRequestDispatcher(JSP);
rd.include(req,resp);
resp.flushBuffer();
if (done) {
ctx.complete();
}
break;
default :
LOGGER.fine("String_Node_Str");
txt.setLength(0);
txt.append("String_Node_Str" + portletName + "String_Node_Str");
txt.append("String_Node_Str").append(req.getDispatcherType().toString());
txt.append("String_Node_Str");
resp.getWriter().write(txt.toString());
resp.flushBuffer();
if (done) {
ctx.complete();
}
break;
}
}
if (!done) {
OutputType type=adb.getType();
if (adb.isAutoDispatch()) {
type=OutputType.AUTO;
}
AsyncRunnable ar=new AsyncRunnable(ctx,adb.getDelay(),type);
ctx.start(ar);
}
}