Program: 34793
Project: 34793
Buggy source:
/** 
 * pushNewRequest - called by WebContainer when a servlet determines that a push_promise is needed 1. Send an HTTP2 push promise frame to the client 2. Send an HTTP 1.1 request to WebContainer
 * @return
 * @throws Http2PushException
 */
@Override public void pushNewRequest(Http2PushBuilder pushBuilder) throws Http2PushException, com.ibm.ws.http.channel.h2internal.exceptions.ProtocolException {
  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
    Tr.entry(tc,"String_Node_Str" + this);
  }
  if (!isPushSupported())   return;
  HttpInboundServiceContext isc=(HttpInboundServiceContext)getServiceContext();
  HttpInboundLink link=((HttpInboundServiceContextImpl)isc).getLink();
  H2HeaderTable h2WriteTable=((H2HttpInboundLinkWrap)link).muxLink.getWriteTable();
  ByteArrayOutputStream ppStream=new ByteArrayOutputStream();
  ByteArrayOutputStream hdrStream=new ByteArrayOutputStream();
  try {
    if (pushBuilder.getMethod() == null) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str");
      }
      throw new Http2PushException("String_Node_Str");
    }
 else {
      ppStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.METHOD,pushBuilder.getMethod(),LiteralIndexType.NOINDEXING));
      hdrStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.METHOD,pushBuilder.getMethod(),LiteralIndexType.NOINDEXING));
    }
    if (pushBuilder.getPath() == null) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str");
      }
      throw new Http2PushException("String_Node_Str");
    }
 else {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + pushBuilder.getPath());
      }
      ppStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.PATH,pushBuilder.getPath(),LiteralIndexType.NOINDEXING));
      hdrStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.PATH,pushBuilder.getPath(),LiteralIndexType.NOINDEXING));
    }
    ppStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.SCHEME,"String_Node_Str",LiteralIndexType.NOINDEXING));
    hdrStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.SCHEME,"String_Node_Str",LiteralIndexType.NOINDEXING));
    ppStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.AUTHORITY,isc.getLocalAddr().getHostName(),LiteralIndexType.NOINDEXING));
    hdrStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.AUTHORITY,isc.getLocalAddr().getHostName(),LiteralIndexType.NOINDEXING));
    Set<HeaderField> headerSet=pushBuilder.getHeaders();
    if (headerSet != null) {
      Iterator<HeaderField> hsit=headerSet.iterator();
      HeaderField hf=null;
      while (hsit.hasNext()) {
        hf=hsit.next();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + hf.getName() + "String_Node_Str"+ hf.asString());
        }
        ppStream.write(H2Headers.encodeHeader(h2WriteTable,hf.getName(),hf.asString(),LiteralIndexType.NOINDEXING));
        hdrStream.write(H2Headers.encodeHeader(h2WriteTable,hf.getName(),hf.asString(),LiteralIndexType.NOINDEXING));
      }
    }
    Set<HttpCookie> cookieSet=pushBuilder.getCookies();
    if (cookieSet != null) {
      Iterator<HttpCookie> ckit=cookieSet.iterator();
      HttpCookie ck=null;
      while (ckit.hasNext()) {
        ck=ckit.next();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + ck.getName() + "String_Node_Str"+ ck.toString());
        }
        ppStream.write(H2Headers.encodeHeader(h2WriteTable,"String_Node_Str",ck.getName() + "String_Node_Str" + ck.toString(),LiteralIndexType.NOINDEXING));
        hdrStream.write(H2Headers.encodeHeader(h2WriteTable,"String_Node_Str",ck.getName() + "String_Node_Str" + ck.toString(),LiteralIndexType.NOINDEXING));
        ckit.next();
      }
    }
 else {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str");
      }
    }
    if (pushBuilder.getSessionId() != null) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + pushBuilder.getSessionId());
      }
      ppStream.write(H2Headers.encodeHeader(h2WriteTable,"String_Node_Str","String_Node_Str" + pushBuilder.getSessionId(),LiteralIndexType.NOINDEXING));
      hdrStream.write(H2Headers.encodeHeader(h2WriteTable,"String_Node_Str","String_Node_Str" + pushBuilder.getSessionId(),LiteralIndexType.NOINDEXING));
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str" + e);
    }
    return;
  }
  int promisedStreamId=((H2HttpInboundLinkWrap)link).muxLink.getNextPromisedStreamId();
  H2StreamProcessor promisedSP=((H2HttpInboundLinkWrap)link).muxLink.createNewInboundLink(promisedStreamId);
  ((H2HttpInboundLinkWrap)link).setPushPromise(true);
  promisedSP.initializePromisedStream();
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str" + promisedStreamId);
  }
  int streamId=((H2HttpInboundLinkWrap)link).getStreamId();
  FramePushPromise pushPromiseFrame=new FramePushPromise(streamId,ppStream.toByteArray(),promisedStreamId,0,true,false,false);
  FrameHeaders headersFrame=new FrameHeaders(streamId,hdrStream.toByteArray());
  H2StreamProcessor existingSP=((H2HttpInboundLinkWrap)link).muxLink.getStreamProcessor(streamId);
  if (existingSP != null)   existingSP.processNextFrame(pushPromiseFrame,Constants.Direction.WRITING_OUT);
 else {
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str" + streamId + "String_Node_Str");
    }
    return;
  }
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str" + streamId);
  }
  promisedSP.sendRequestToWc(headersFrame);
  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
    Tr.exit(tc,"String_Node_Str" + this);
  }
}

Fixed version (ground truth):
/** 
 * pushNewRequest - called by WebContainer when a servlet determines that a push_promise is needed 1. Send an HTTP2 push promise frame to the client 2. Send an HTTP 1.1 request to WebContainer
 * @return
 * @throws Http2PushException
 */
@Override public void pushNewRequest(Http2PushBuilder pushBuilder) throws Http2PushException, com.ibm.ws.http.channel.h2internal.exceptions.ProtocolException {
  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
    Tr.entry(tc,"String_Node_Str" + this);
  }
  if (!isPushSupported())   return;
  HttpInboundServiceContext isc=(HttpInboundServiceContext)getServiceContext();
  HttpInboundLink link=((HttpInboundServiceContextImpl)isc).getLink();
  H2HeaderTable h2WriteTable=((H2HttpInboundLinkWrap)link).muxLink.getWriteTable();
  ByteArrayOutputStream ppStream=new ByteArrayOutputStream();
  ByteArrayOutputStream hdrStream=new ByteArrayOutputStream();
  try {
    if (pushBuilder.getMethod() == null) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str");
      }
      throw new Http2PushException("String_Node_Str");
    }
 else {
      ppStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.METHOD,pushBuilder.getMethod(),LiteralIndexType.NOINDEXING));
      hdrStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.METHOD,pushBuilder.getMethod(),LiteralIndexType.NOINDEXING));
    }
    if (pushBuilder.getPath() == null) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str");
      }
      throw new Http2PushException("String_Node_Str");
    }
 else {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + pushBuilder.getPath());
      }
      ppStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.PATH,pushBuilder.getPath(),LiteralIndexType.NOINDEXING));
      hdrStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.PATH,pushBuilder.getPath(),LiteralIndexType.NOINDEXING));
    }
    if (isc.isSecure()) {
      ppStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.SCHEME,"String_Node_Str",LiteralIndexType.NOINDEXING));
      hdrStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.SCHEME,"String_Node_Str",LiteralIndexType.NOINDEXING));
    }
 else {
      ppStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.SCHEME,"String_Node_Str",LiteralIndexType.NOINDEXING));
      hdrStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.SCHEME,"String_Node_Str",LiteralIndexType.NOINDEXING));
    }
    String authority=isc.getLocalAddr().getHostName() + "String_Node_Str" + isc.getLocalPort();
    ppStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.AUTHORITY,authority,LiteralIndexType.NOINDEXING));
    hdrStream.write(H2Headers.encodeHeader(h2WriteTable,HpackConstants.AUTHORITY,authority,LiteralIndexType.NOINDEXING));
    Set<HeaderField> headerSet=pushBuilder.getHeaders();
    if (headerSet != null) {
      Iterator<HeaderField> hsit=headerSet.iterator();
      HeaderField hf=null;
      while (hsit.hasNext()) {
        hf=hsit.next();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + hf.getName() + "String_Node_Str"+ hf.asString());
        }
        ppStream.write(H2Headers.encodeHeader(h2WriteTable,hf.getName(),hf.asString(),LiteralIndexType.NOINDEXING));
        hdrStream.write(H2Headers.encodeHeader(h2WriteTable,hf.getName(),hf.asString(),LiteralIndexType.NOINDEXING));
      }
    }
    Set<HttpCookie> cookieSet=pushBuilder.getCookies();
    if (cookieSet != null) {
      Iterator<HttpCookie> ckit=cookieSet.iterator();
      HttpCookie ck=null;
      while (ckit.hasNext()) {
        ck=ckit.next();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + ck.getName() + "String_Node_Str"+ ck.toString());
        }
        ppStream.write(H2Headers.encodeHeader(h2WriteTable,"String_Node_Str",ck.getName() + "String_Node_Str" + ck.toString(),LiteralIndexType.NOINDEXING));
        hdrStream.write(H2Headers.encodeHeader(h2WriteTable,"String_Node_Str",ck.getName() + "String_Node_Str" + ck.toString(),LiteralIndexType.NOINDEXING));
        ckit.next();
      }
    }
 else {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str" + e);
    }
    return;
  }
  int promisedStreamId=((H2HttpInboundLinkWrap)link).muxLink.getNextPromisedStreamId();
  H2StreamProcessor promisedSP=((H2HttpInboundLinkWrap)link).muxLink.createNewInboundLink(promisedStreamId);
  if (promisedSP == null) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str" + "String_Node_Str" + link);
    }
    return;
  }
  ((H2HttpInboundLinkWrap)link).setPushPromise(true);
  promisedSP.initializePromisedStream();
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str" + promisedStreamId);
  }
  int streamId=((H2HttpInboundLinkWrap)link).getStreamId();
  FramePushPromise pushPromiseFrame=new FramePushPromise(streamId,ppStream.toByteArray(),promisedStreamId,0,true,false,false);
  FrameHeaders headersFrame=new FrameHeaders(streamId,hdrStream.toByteArray());
  H2StreamProcessor existingSP=((H2HttpInboundLinkWrap)link).muxLink.getStreamProcessor(streamId);
  if (existingSP != null)   existingSP.processNextFrame(pushPromiseFrame,Constants.Direction.WRITING_OUT);
 else {
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
      Tr.debug(tc,"String_Node_Str" + streamId + "String_Node_Str");
    }
    return;
  }
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str" + streamId);
  }
  promisedSP.sendRequestToWc(headersFrame);
  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
    Tr.exit(tc,"String_Node_Str" + this);
  }
}