Program: 34858
Project: 34858
Buggy source:
public synchronized void processNextFrame(Frame frame,Constants.Direction direction) throws ProtocolException {
  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");
        }
        throw new ProtocolException("String_Node_Str");
      }
 else {
        if (frame.getFrameType() == FrameTypes.PRIORITY || frame.getFrameType() == FrameTypes.WINDOW_UPDATE || frame.getFrameType() == FrameTypes.RST_STREAM) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc,"String_Node_Str");
          }
          return;
        }
 else         if (frame.getFrameType() == FrameTypes.HEADERS || frame.getFrameType() == FrameTypes.DATA || frame.getFrameType() == FrameTypes.PUSH_PROMISE) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc,"String_Node_Str");
          }
          throw new ProtocolException("String_Node_Str");
        }
      }
    }
 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 (state.equals(StreamState.HALF_CLOSED_REMOTE)) {
          throw new ProtocolException("String_Node_Str");
        }
 else {
          return;
        }
      }
 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) {
        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.RST_STREAM || frameType == FrameTypes.SETTINGS || frameType == FrameTypes.GOAWAY || frameType == FrameTypes.PING) {
switch (frameType) {
case RST_STREAM:
          processRstFrame();
        break;
case SETTINGS:
      processSETTINGSFrame();
    break;
case GOAWAY:
  processGOAWAYFrame();
updateStreamState(StreamState.CLOSED);
break;
case PING:
processPINGFrame();
break;
default :
break;
}
return;
}
try {
verifyReadFrameSequence();
}
 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 (frameType == FrameTypes.PRIORITY) {
processPriorityFrame();
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;
}
}
 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) {
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;
}
}
 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):
public synchronized void processNextFrame(Frame frame,Constants.Direction direction) throws ProtocolException {
  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");
        }
        throw new ProtocolException("String_Node_Str");
      }
 else {
        if (frame.getFrameType() == FrameTypes.PRIORITY || frame.getFrameType() == FrameTypes.WINDOW_UPDATE || frame.getFrameType() == FrameTypes.RST_STREAM) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc,"String_Node_Str");
          }
          return;
        }
 else         if (frame.getFrameType() == FrameTypes.HEADERS || frame.getFrameType() == FrameTypes.DATA || frame.getFrameType() == FrameTypes.PUSH_PROMISE) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc,"String_Node_Str");
          }
          throw new ProtocolException("String_Node_Str");
        }
      }
    }
 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) {
        throw new ProtocolException("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) {
        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;
}
}
 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) {
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;
}
}
 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;
}
}
}