Program: 17297
Project: 17297
Buggy source:
private void serializeEvent(DataOutput out) throws IOException {
  if (event == null) {
    out.writeBoolean(false);
    return;
  }
  out.writeBoolean(true);
  if (eventType.equals(EventType.TASK_STATUS_UPDATE_EVENT)) {
    TaskStatusUpdateEvent sEvt=(TaskStatusUpdateEvent)event;
    sEvt.write(out);
  }
 else {
    byte[] eventBytes=null;
switch (eventType) {
case DATA_MOVEMENT_EVENT:
      DataMovementEvent dmEvt=(DataMovementEvent)event;
    eventBytes=DataMovementEventProto.newBuilder().setSourceIndex(dmEvt.getSourceIndex()).setTargetIndex(dmEvt.getTargetIndex()).setUserPayload(ByteString.copyFrom(dmEvt.getUserPayload())).build().toByteArray();
  break;
case INPUT_READ_ERROR_EVENT:
InputReadErrorEvent ideEvt=(InputReadErrorEvent)event;
eventBytes=InputReadErrorEventProto.newBuilder().setIndex(ideEvt.getIndex()).setDiagnostics(ideEvt.getDiagnostics()).build().toByteArray();
break;
case TASK_ATTEMPT_FAILED_EVENT:
TaskAttemptFailedEvent tfEvt=(TaskAttemptFailedEvent)event;
eventBytes=TaskAttemptFailedEventProto.newBuilder().setDiagnostics(tfEvt.getDiagnostics()).build().toByteArray();
break;
case TASK_ATTEMPT_COMPLETED_EVENT:
eventBytes=TaskAttemptCompletedEventProto.newBuilder().build().toByteArray();
break;
case INPUT_FAILED_EVENT:
InputFailedEvent ifEvt=(InputFailedEvent)event;
eventBytes=InputFailedEventProto.newBuilder().setSourceIndex(ifEvt.getSourceIndex()).setTargetIndex(ifEvt.getTargetIndex()).setVersion(ifEvt.getVersion()).build().toByteArray();
case INTPUT_INFORMATION_EVENT:
InputInformationEvent iEvt=(InputInformationEvent)event;
eventBytes=InputInformationEventProto.newBuilder().setUserPayload(ByteString.copyFrom(iEvt.getUserPayload())).build().toByteArray();
default :
throw new TezUncheckedException("String_Node_Str" + "String_Node_Str" + eventType);
}
out.writeInt(eventType.ordinal());
out.writeInt(eventBytes.length);
out.write(eventBytes);
}
}

Fixed version (ground truth):
private void serializeEvent(DataOutput out) throws IOException {
  if (event == null) {
    out.writeBoolean(false);
    return;
  }
  out.writeBoolean(true);
  out.writeInt(eventType.ordinal());
  if (eventType.equals(EventType.TASK_STATUS_UPDATE_EVENT)) {
    TaskStatusUpdateEvent sEvt=(TaskStatusUpdateEvent)event;
    sEvt.write(out);
  }
 else {
    byte[] eventBytes=null;
switch (eventType) {
case DATA_MOVEMENT_EVENT:
      DataMovementEvent dmEvt=(DataMovementEvent)event;
    eventBytes=DataMovementEventProto.newBuilder().setSourceIndex(dmEvt.getSourceIndex()).setTargetIndex(dmEvt.getTargetIndex()).setUserPayload(ByteString.copyFrom(dmEvt.getUserPayload())).build().toByteArray();
  break;
case INPUT_READ_ERROR_EVENT:
InputReadErrorEvent ideEvt=(InputReadErrorEvent)event;
eventBytes=InputReadErrorEventProto.newBuilder().setIndex(ideEvt.getIndex()).setDiagnostics(ideEvt.getDiagnostics()).build().toByteArray();
break;
case TASK_ATTEMPT_FAILED_EVENT:
TaskAttemptFailedEvent tfEvt=(TaskAttemptFailedEvent)event;
eventBytes=TaskAttemptFailedEventProto.newBuilder().setDiagnostics(tfEvt.getDiagnostics()).build().toByteArray();
break;
case TASK_ATTEMPT_COMPLETED_EVENT:
eventBytes=TaskAttemptCompletedEventProto.newBuilder().build().toByteArray();
break;
case INPUT_FAILED_EVENT:
InputFailedEvent ifEvt=(InputFailedEvent)event;
eventBytes=InputFailedEventProto.newBuilder().setSourceIndex(ifEvt.getSourceIndex()).setTargetIndex(ifEvt.getTargetIndex()).setVersion(ifEvt.getVersion()).build().toByteArray();
case INTPUT_INFORMATION_EVENT:
InputInformationEvent iEvt=(InputInformationEvent)event;
eventBytes=InputInformationEventProto.newBuilder().setUserPayload(ByteString.copyFrom(iEvt.getUserPayload())).build().toByteArray();
default :
throw new TezUncheckedException("String_Node_Str" + "String_Node_Str" + eventType);
}
out.writeInt(eventBytes.length);
out.write(eventBytes);
}
}