Program: 29252
Project: 29252
Buggy source:
public GfSseInboundEvent readEvent() throws IOException {
  GfSseInboundEvent inboundEvent=new GfSseInboundEvent(messageBodyWorkers,annotations,mediaType,headers);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  State currentState=State.START;
  String fieldName=null;
  try {
    int data=0;
    while ((data=inputStream.read()) != -1) {
switch (currentState) {
case START:
        if (data == ':') {
          currentState=State.COMMENT;
        }
 else         if (data != '\n') {
          baos.write(data);
          currentState=State.FIELD_NAME;
        }
 else         if (data == '\n') {
          if (!inboundEvent.isEmpty()) {
            return inboundEvent;
          }
          inboundEvent=new GfSseInboundEvent(messageBodyWorkers,annotations,mediaType,headers);
        }
      break;
case COMMENT:
    if (data == '\n') {
      currentState=State.START;
    }
  break;
case FIELD_NAME:
if (data == ':') {
  fieldName=baos.toString();
  baos.reset();
  currentState=State.FIELD_VALUE_FIRST;
}
 else if (data == '\n') {
  processField(inboundEvent,baos.toString(),"String_Node_Str".getBytes());
  baos.reset();
  currentState=State.START;
}
 else {
  baos.write(data);
}
break;
case FIELD_VALUE_FIRST:
if (data != ' ') {
baos.write(data);
}
if (data == '\n') {
processField(inboundEvent,fieldName,baos.toByteArray());
baos.reset();
currentState=State.START;
break;
}
currentState=State.FIELD_VALUE;
break;
case FIELD_VALUE:
if (data == '\n') {
processField(inboundEvent,fieldName,baos.toByteArray());
baos.reset();
currentState=State.START;
}
 else {
baos.write(data);
}
break;
}
}
if (data == -1) {
closed=true;
}
return null;
}
 catch (IOException e) {
closed=true;
throw e;
}
}

Fixed version (ground truth):
public GfSseInboundEvent readEvent() throws IOException {
  GfSseInboundEvent inboundEvent=new GfSseInboundEvent(messageBodyWorkers,annotations,mediaType,headers);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  State currentState=State.START;
  String fieldName=null;
  try {
    int data=0;
    while ((data=inputStream.read()) != -1) {
switch (currentState) {
case START:
        if (data == ':') {
          currentState=State.COMMENT;
        }
 else         if (data != '\n') {
          baos.write(data);
          currentState=State.FIELD_NAME;
        }
 else         if (data == '\n') {
          if (!inboundEvent.isEmpty()) {
            return inboundEvent;
          }
          inboundEvent=new GfSseInboundEvent(messageBodyWorkers,annotations,mediaType,headers);
        }
      break;
case COMMENT:
    if (data == '\n') {
      currentState=State.START;
    }
  break;
case FIELD_NAME:
if (data == ':') {
  fieldName=baos.toString();
  baos.reset();
  currentState=State.FIELD_VALUE_FIRST;
}
 else if (data == '\n') {
  processField(inboundEvent,baos.toString(),"String_Node_Str".getBytes());
  baos.reset();
  currentState=State.START;
}
 else {
  baos.write(data);
}
break;
case FIELD_VALUE_FIRST:
if (data != ' ') {
baos.write(data);
}
if (data == '\n') {
processField(inboundEvent,fieldName,baos.toByteArray());
baos.reset();
currentState=State.START;
break;
}
currentState=State.FIELD_VALUE;
break;
case FIELD_VALUE:
if (data == '\n') {
processField(inboundEvent,fieldName,baos.toByteArray());
baos.reset();
currentState=State.START;
}
 else {
baos.write(data);
}
break;
default :
}
}
if (data == -1) {
closed=true;
}
return null;
}
 catch (IOException e) {
closed=true;
throw e;
}
}