Program: 46892
Project: 46892
Buggy source:
@Override public void write(Span value,Buffer b){
  Parsed parsed=parse(value);
  byte[] endpointBytes=legacyEndpointBytes(value.localEndpoint());
  b.writeAscii("String_Node_Str").writeAscii(value.traceId()).writeByte('"');
  if (value.parentId() != null) {
    b.writeAscii("String_Node_Str").writeAscii(value.parentId()).writeByte('"');
  }
  b.writeAscii("String_Node_Str").writeAscii(value.id()).writeByte('"');
  b.writeAscii("String_Node_Str");
  if (value.name() != null)   b.writeUtf8(jsonEscape(value.name()));
  b.writeByte('"');
  if (Boolean.TRUE.equals(value.shared()) && "String_Node_Str".equals(parsed.begin)) {
  }
 else {
    if (value.timestamp() != null) {
      b.writeAscii("String_Node_Str").writeAscii(value.timestamp());
    }
    if (value.duration() != null) {
      b.writeAscii("String_Node_Str").writeAscii(value.duration());
    }
  }
  int annotationCount=value.annotations().size();
  boolean beginAnnotation=parsed.startTs != null && parsed.begin != null;
  boolean endAnnotation=parsed.endTs != null && parsed.end != null;
  if (annotationCount > 0) {
    int length=value.annotations().size();
    b.writeAscii("String_Node_Str");
    if (beginAnnotation) {
      V2SpanWriter.writeAnnotation(Annotation.create(parsed.startTs,parsed.begin),endpointBytes,b);
      if (length > 0)       b.writeByte(',');
    }
    for (int i=0; i < length; ) {
      V2SpanWriter.writeAnnotation(value.annotations().get(i++),endpointBytes,b);
      if (i < length)       b.writeByte(',');
    }
    if (endAnnotation) {
      if (length > 0)       b.writeByte(',');
      V2SpanWriter.writeAnnotation(Annotation.create(parsed.endTs,parsed.end),endpointBytes,b);
    }
    b.writeByte(']');
  }
  int binaryAnnotationCount=value.tags().size();
  boolean hasRemoteEndpoint=parsed.remoteEndpointType != null && value.remoteEndpoint() != null;
  if (hasRemoteEndpoint)   binaryAnnotationCount++;
  if (binaryAnnotationCount > 0) {
    b.writeAscii("String_Node_Str");
    Iterator<Map.Entry<String,String>> i=value.tags().entrySet().iterator();
    while (i.hasNext()) {
      Map.Entry<String,String> entry=i.next();
      writeBinaryAnnotation(entry.getKey(),entry.getValue(),endpointBytes,b);
      if (i.hasNext())       b.writeByte(',');
    }
    if (hasRemoteEndpoint) {
      if (!value.tags().isEmpty())       b.writeByte(',');
      b.writeAscii("String_Node_Str").writeAscii(parsed.remoteEndpointType);
      b.writeAscii("String_Node_Str");
      b.write(legacyEndpointBytes(value.remoteEndpoint()));
      b.writeByte('}');
    }
    b.writeByte(']');
  }
  if (Boolean.TRUE.equals(value.debug())) {
    b.writeAscii("String_Node_Str");
  }
  b.writeByte('}');
}

Fixed version (ground truth):
@Override public void write(Span value,Buffer b){
  Parsed parsed=parse(value);
  byte[] endpointBytes=legacyEndpointBytes(value.localEndpoint());
  b.writeAscii("String_Node_Str").writeAscii(value.traceId()).writeByte('"');
  if (value.parentId() != null) {
    b.writeAscii("String_Node_Str").writeAscii(value.parentId()).writeByte('"');
  }
  b.writeAscii("String_Node_Str").writeAscii(value.id()).writeByte('"');
  b.writeAscii("String_Node_Str");
  if (value.name() != null)   b.writeUtf8(jsonEscape(value.name()));
  b.writeByte('"');
  if (Boolean.TRUE.equals(value.shared()) && "String_Node_Str".equals(parsed.begin)) {
  }
 else {
    if (value.timestamp() != null) {
      b.writeAscii("String_Node_Str").writeAscii(value.timestamp());
    }
    if (value.duration() != null) {
      b.writeAscii("String_Node_Str").writeAscii(value.duration());
    }
  }
  int annotationCount=value.annotations().size();
  boolean beginAnnotation=parsed.startTs != null && parsed.begin != null;
  boolean endAnnotation=parsed.endTs != null && parsed.end != null;
  if (annotationCount > 0 || beginAnnotation || endAnnotation) {
    int length=value.annotations().size();
    b.writeAscii("String_Node_Str");
    if (beginAnnotation) {
      V2SpanWriter.writeAnnotation(Annotation.create(parsed.startTs,parsed.begin),endpointBytes,b);
      if (length > 0)       b.writeByte(',');
    }
    for (int i=0; i < length; ) {
      V2SpanWriter.writeAnnotation(value.annotations().get(i++),endpointBytes,b);
      if (i < length)       b.writeByte(',');
    }
    if (endAnnotation) {
      b.writeByte(',');
      V2SpanWriter.writeAnnotation(Annotation.create(parsed.endTs,parsed.end),endpointBytes,b);
    }
    b.writeByte(']');
  }
  int binaryAnnotationCount=value.tags().size();
  boolean hasRemoteEndpoint=parsed.remoteEndpointType != null && value.remoteEndpoint() != null;
  if (hasRemoteEndpoint)   binaryAnnotationCount++;
  if (binaryAnnotationCount > 0) {
    b.writeAscii("String_Node_Str");
    Iterator<Map.Entry<String,String>> i=value.tags().entrySet().iterator();
    while (i.hasNext()) {
      Map.Entry<String,String> entry=i.next();
      writeBinaryAnnotation(entry.getKey(),entry.getValue(),endpointBytes,b);
      if (i.hasNext())       b.writeByte(',');
    }
    if (hasRemoteEndpoint) {
      if (!value.tags().isEmpty())       b.writeByte(',');
      b.writeAscii("String_Node_Str").writeAscii(parsed.remoteEndpointType);
      b.writeAscii("String_Node_Str");
      b.write(legacyEndpointBytes(value.remoteEndpoint()));
      b.writeByte('}');
    }
    b.writeByte(']');
  }
  if (Boolean.TRUE.equals(value.debug())) {
    b.writeAscii("String_Node_Str");
  }
  b.writeByte('}');
}