Program: 34745
Project: 34745
Buggy source:
/** 
 * Update the state of this stream by passing in a given Frame to read or write. This method handles state validation, state transitions, connection setting updates, frame responses, and error processing. Note this method is synchronized.
 * @param Frame
 * @param Direction.WRITING_OUT or Direction.READING_IN
 * @throws ProtocolException
 * @throws StreamClosedException
 */
public synchronized void processNextFrame(Frame frame,Constants.Direction direction) throws ProtocolException, StreamClosedException {
  boolean doDebugWhile=false;
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str" + myID + "String_Node_Str"+ frame.getFrameType().toString()+ "String_Node_Str"+ direction.toString()+ "String_Node_Str"+ muxLink.hashCode());
  }
  if (isStreamClosed()) {
    if (direction.equals(Constants.Direction.WRITING_OUT)) {
      if (muxLink.significantlyPastCloseTime(myID)) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + myID);
        }
        return;
      }
 else {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + myID);
        }
        return;
      }
    }
 else     if (direction.equals(Constants.Direction.READ_IN)) {
      if (frame.getFrameType() == FrameTypes.PRIORITY) {
        return;
      }
      if (muxLink.significantlyPastCloseTime(myID)) {
        throw new ProtocolException("String_Node_Str");
      }
      if (frame.getFrameType() == FrameTypes.DATA || frame.getFrameType() == FrameTypes.HEADERS) {
        if (muxLink.closeTable.containsKey(this.myID)) {
          throw new StreamClosedException(frame.getFrameType() + "String_Node_Str");
        }
 else {
          throw new ProtocolException(frame.getFrameType() + "String_Node_Str");
        }
      }
 else       if (frame.getFrameType() == FrameTypes.RST_STREAM) {
        return;
      }
    }
  }
  ADDITIONAL_FRAME addFrame=ADDITIONAL_FRAME.FIRST_TIME;
  Http2Exception addFrameException=null;
  currentFrame=frame;
  while (addFrame != ADDITIONAL_FRAME.NO) {
    if (doDebugWhile) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + myID + "String_Node_Str"+ frame.getFrameType().toString()+ "String_Node_Str"+ direction.toString());
      }
    }
 else {
      doDebugWhile=true;
    }
    if (addFrame == ADDITIONAL_FRAME.RESET) {
      currentFrame=new FrameRstStream(myID,addFrameException.getErrorCode(),false);
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + myID + "String_Node_Str"+ addFrameException.getErrorString());
      }
      direction=Constants.Direction.WRITING_OUT;
    }
    if (addFrame == ADDITIONAL_FRAME.GOAWAY) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + muxLink.getHighestClientStreamId());
      }
      currentFrame=new FrameGoAway(0,addFrameException.getMessage().getBytes(),addFrameException.getErrorCode(),muxLink.getHighestClientStreamId(),false);
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + addFrameException.getErrorString());
      }
      direction=Constants.Direction.WRITING_OUT;
    }
    frameType=currentFrame.getFrameType();
    if (frameType == FrameTypes.RST_STREAM && addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
      addFrame=ADDITIONAL_FRAME.RESET;
    }
 else     if (frameType == FrameTypes.GOAWAY && addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
      addFrame=ADDITIONAL_FRAME.GOAWAY;
    }
    try {
      currentFrame.validate(muxLink.getConnectionSettings());
    }
 catch (    Http2Exception e) {
      if (addFrame == ADDITIONAL_FRAME.FIRST_TIME || addFrame == ADDITIONAL_FRAME.RESET || addFrame == ADDITIONAL_FRAME.GOAWAY) {
        if (e.isConnectionError()) {
          addFrame=ADDITIONAL_FRAME.GOAWAY;
        }
 else {
          addFrame=ADDITIONAL_FRAME.RESET;
        }
        addFrameException=e;
      }
 else {
        if (direction == Constants.Direction.READ_IN) {
          addFrame=ADDITIONAL_FRAME.RESET;
          addFrameException=e;
        }
 else {
        }
        addFrame=ADDITIONAL_FRAME.NO;
      }
      continue;
    }
    if (direction == Constants.Direction.READ_IN) {
      if (muxLink.checkIfGoAwaySendingOrClosing()) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + currentFrame.getFrameType() + "String_Node_Str"+ this.myID+ "String_Node_Str");
        }
        return;
      }
      if (isContinuationFrameExpected() && (frameType != FrameTypes.CONTINUATION || !this.continuationExpected)) {
        addFrame=ADDITIONAL_FRAME.GOAWAY;
        addFrameException=new ProtocolException("String_Node_Str");
        continue;
      }
      if (frameType == FrameTypes.SETTINGS || frameType == FrameTypes.GOAWAY || frameType == FrameTypes.PING) {
switch (frameType) {
case SETTINGS:
          processSETTINGSFrame();
        break;
case GOAWAY:
      processGOAWAYFrame();
    updateStreamState(StreamState.CLOSED);
  break;
case PING:
processPINGFrame();
break;
default :
break;
}
return;
}
try {
verifyReadFrameSequence();
}
 catch (Http2Exception e) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
addFrame=ADDITIONAL_FRAME.RESET;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
addFrameException=e;
continue;
}
if (frameType == FrameTypes.PRIORITY) {
processPriorityFrame();
return;
}
if (frameType == FrameTypes.RST_STREAM) {
processRstFrame();
return;
}
try {
if (frameType == FrameTypes.WINDOW_UPDATE) {
processWindowUpdateFrame();
if (dataWaitingForWindowUpdate != null) {
if (!this.isWindowLimitExceeded(dataWaitingForWindowUpdate.peek())) {
waitingForWindowUpdate=false;
}
}
 else {
return;
}
}
}
 catch (Http2Exception e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else {
addFrame=ADDITIONAL_FRAME.RESET;
}
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
try {
updateStreamReadWindow();
}
 catch (Http2Exception e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else {
addFrame=ADDITIONAL_FRAME.RESET;
}
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
try {
readWriteTransitionState(direction);
}
 catch (CompressionException e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
catch (Http2Exception e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else {
addFrame=ADDITIONAL_FRAME.RESET;
}
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
}
 else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc,"String_Node_Str");
}
try {
verifyWriteFrameSequence();
readWriteTransitionState(direction);
}
 catch (CompressionException e) {
if ((addFrame == ADDITIONAL_FRAME.FIRST_TIME) || (addFrame == ADDITIONAL_FRAME.RESET)) {
Tr.info(tc,"String_Node_Str");
addFrame=ADDITIONAL_FRAME.GOAWAY;
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
catch (Http2Exception e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else {
addFrame=ADDITIONAL_FRAME.RESET;
}
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
}
if (!waitingForWindowUpdate && dataWaitingForWindowUpdate != null && !this.isWindowLimitExceeded(this.dataWaitingForWindowUpdate.peek())) {
addFrame=ADDITIONAL_FRAME.DATA;
currentFrame=this.dataWaitingForWindowUpdate.remove();
direction=Constants.Direction.WRITING_OUT;
if (this.dataWaitingForWindowUpdate.isEmpty()) {
this.dataWaitingForWindowUpdate=null;
}
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
}
}

Fixed version (ground truth):
/** 
 * Update the state of this stream by passing in a given Frame to read or write. This method handles state validation, state transitions, connection setting updates, frame responses, and error processing. Note this method is synchronized.
 * @param Frame
 * @param Direction.WRITING_OUT or Direction.READING_IN
 * @throws ProtocolException
 * @throws StreamClosedException
 */
public synchronized void processNextFrame(Frame frame,Constants.Direction direction) throws ProtocolException, StreamClosedException {
  boolean doDebugWhile=false;
  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
    Tr.debug(tc,"String_Node_Str" + myID + "String_Node_Str"+ frame.getFrameType().toString()+ "String_Node_Str"+ direction.toString()+ "String_Node_Str"+ muxLink.hashCode());
  }
  if (isStreamClosed()) {
    if (direction.equals(Constants.Direction.WRITING_OUT)) {
      if (muxLink.significantlyPastCloseTime(myID)) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + myID);
        }
        return;
      }
 else {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + myID);
        }
        return;
      }
    }
 else     if (direction.equals(Constants.Direction.READ_IN)) {
      if (frame.getFrameType() == FrameTypes.PRIORITY) {
        return;
      }
      if (muxLink.significantlyPastCloseTime(myID)) {
        throw new ProtocolException("String_Node_Str");
      }
      if (frame.getFrameType() == FrameTypes.DATA || frame.getFrameType() == FrameTypes.HEADERS) {
        if (muxLink.closeTable.containsKey(this.myID)) {
          throw new StreamClosedException(frame.getFrameType() + "String_Node_Str");
        }
 else {
          throw new ProtocolException(frame.getFrameType() + "String_Node_Str");
        }
      }
 else       if (frame.getFrameType() == FrameTypes.RST_STREAM) {
        return;
      }
    }
  }
  ADDITIONAL_FRAME addFrame=ADDITIONAL_FRAME.FIRST_TIME;
  Http2Exception addFrameException=null;
  currentFrame=frame;
  while (addFrame != ADDITIONAL_FRAME.NO) {
    if (doDebugWhile) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + myID + "String_Node_Str"+ frame.getFrameType().toString()+ "String_Node_Str"+ direction.toString());
      }
    }
 else {
      doDebugWhile=true;
    }
    if (addFrame == ADDITIONAL_FRAME.RESET) {
      updateStreamState(StreamState.HALF_CLOSED_LOCAL);
      currentFrame=new FrameRstStream(myID,addFrameException.getErrorCode(),false);
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + myID + "String_Node_Str"+ addFrameException.getErrorString());
      }
      direction=Constants.Direction.WRITING_OUT;
    }
    if (addFrame == ADDITIONAL_FRAME.GOAWAY) {
      updateStreamState(StreamState.HALF_CLOSED_LOCAL);
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + muxLink.getHighestClientStreamId());
      }
      currentFrame=new FrameGoAway(0,addFrameException.getMessage().getBytes(),addFrameException.getErrorCode(),muxLink.getHighestClientStreamId(),false);
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + addFrameException.getErrorString());
      }
      direction=Constants.Direction.WRITING_OUT;
    }
    frameType=currentFrame.getFrameType();
    if (frameType == FrameTypes.RST_STREAM && addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
      addFrame=ADDITIONAL_FRAME.RESET;
    }
 else     if (frameType == FrameTypes.GOAWAY && addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
      addFrame=ADDITIONAL_FRAME.GOAWAY;
    }
    try {
      currentFrame.validate(muxLink.getConnectionSettings());
    }
 catch (    Http2Exception e) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str" + currentFrame.getFrameType() + "String_Node_Str"+ this.myID+ "String_Node_Str"+ e.getErrorString());
      }
      if (addFrame == ADDITIONAL_FRAME.FIRST_TIME || addFrame == ADDITIONAL_FRAME.RESET || addFrame == ADDITIONAL_FRAME.GOAWAY) {
        if (e.isConnectionError()) {
          addFrame=ADDITIONAL_FRAME.GOAWAY;
        }
 else {
          addFrame=ADDITIONAL_FRAME.RESET;
        }
        addFrameException=e;
      }
 else {
        if (direction == Constants.Direction.READ_IN) {
          addFrame=ADDITIONAL_FRAME.RESET;
          addFrameException=e;
        }
 else {
        }
        addFrame=ADDITIONAL_FRAME.NO;
      }
      continue;
    }
    if (direction == Constants.Direction.READ_IN) {
      if (muxLink.checkIfGoAwaySendingOrClosing()) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
          Tr.debug(tc,"String_Node_Str" + currentFrame.getFrameType() + "String_Node_Str"+ this.myID+ "String_Node_Str");
        }
        return;
      }
      if (isContinuationFrameExpected() && (frameType != FrameTypes.CONTINUATION || !this.continuationExpected)) {
        addFrame=ADDITIONAL_FRAME.GOAWAY;
        addFrameException=new ProtocolException("String_Node_Str");
        continue;
      }
      if (frameType == FrameTypes.SETTINGS || frameType == FrameTypes.GOAWAY || frameType == FrameTypes.PING) {
switch (frameType) {
case SETTINGS:
          processSETTINGSFrame();
        break;
case GOAWAY:
      processGOAWAYFrame();
    updateStreamState(StreamState.CLOSED);
  break;
case PING:
processPINGFrame();
break;
default :
break;
}
return;
}
try {
verifyReadFrameSequence();
}
 catch (Http2Exception e) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
addFrame=ADDITIONAL_FRAME.RESET;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
addFrameException=e;
continue;
}
if (frameType == FrameTypes.PRIORITY) {
processPriorityFrame();
return;
}
if (frameType == FrameTypes.RST_STREAM) {
processRstFrame();
return;
}
try {
if (frameType == FrameTypes.WINDOW_UPDATE) {
processWindowUpdateFrame();
if (dataWaitingForWindowUpdate != null) {
if (!this.isWindowLimitExceeded(dataWaitingForWindowUpdate.peek())) {
waitingForWindowUpdate=false;
}
}
 else {
return;
}
}
}
 catch (Http2Exception e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else {
addFrame=ADDITIONAL_FRAME.RESET;
}
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
try {
updateStreamReadWindow();
}
 catch (Http2Exception e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else {
addFrame=ADDITIONAL_FRAME.RESET;
}
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
try {
readWriteTransitionState(direction);
}
 catch (CompressionException e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
catch (Http2Exception e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else {
addFrame=ADDITIONAL_FRAME.RESET;
}
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
}
 else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc,"String_Node_Str");
}
try {
verifyWriteFrameSequence();
readWriteTransitionState(direction);
}
 catch (CompressionException e) {
if ((addFrame == ADDITIONAL_FRAME.FIRST_TIME) || (addFrame == ADDITIONAL_FRAME.RESET)) {
Tr.info(tc,"String_Node_Str");
addFrame=ADDITIONAL_FRAME.GOAWAY;
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
catch (Http2Exception e) {
if (addFrame == ADDITIONAL_FRAME.FIRST_TIME) {
if (e.isConnectionError()) {
addFrame=ADDITIONAL_FRAME.GOAWAY;
}
 else {
addFrame=ADDITIONAL_FRAME.RESET;
}
addFrameException=e;
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
continue;
}
}
if (!waitingForWindowUpdate && dataWaitingForWindowUpdate != null && !this.isWindowLimitExceeded(this.dataWaitingForWindowUpdate.peek())) {
addFrame=ADDITIONAL_FRAME.DATA;
currentFrame=this.dataWaitingForWindowUpdate.remove();
direction=Constants.Direction.WRITING_OUT;
if (this.dataWaitingForWindowUpdate.isEmpty()) {
this.dataWaitingForWindowUpdate=null;
}
}
 else {
addFrame=ADDITIONAL_FRAME.NO;
}
}
}