Program: 33281
Project: 33281
Buggy source:
@Override public SerializerResult primitive(final ServiceMetadata metadata,final EdmPrimitiveType type,final Property property,final PrimitiveSerializerOptions options) throws SerializerException {
  CircleStreamBuffer buffer=null;
  SerializerException cachedException=null;
  try {
    final ContextURL contextURL=checkContextURL(options == null ? null : options.getContextURL());
    buffer=new CircleStreamBuffer();
    JsonGenerator json=new JsonFactory().createGenerator(buffer.getOutputStream());
    json.writeStartObject();
    writeContextURL(contextURL,json);
    writeMetadataETag(metadata,json);
    if (property.isNull()) {
      throw new SerializerException("String_Node_Str",SerializerException.MessageKeys.NULL_INPUT);
    }
 else {
      json.writeFieldName(Constants.VALUE);
      writePrimitive(type,property,options == null ? null : options.isNullable(),options == null ? null : options.getMaxLength(),options == null ? null : options.getPrecision(),options == null ? null : options.getScale(),options == null ? null : options.isUnicode(),json);
    }
    json.writeEndObject();
    json.close();
    buffer.getOutputStream().close();
    return SerializerResultImpl.with().content(buffer.getInputStream()).build();
  }
 catch (  final IOException e) {
    cachedException=new SerializerException("String_Node_Str",e,SerializerException.MessageKeys.IO_EXCEPTION);
    throw cachedException;
  }
catch (  final EdmPrimitiveTypeException e) {
    cachedException=new SerializerException("String_Node_Str",e,SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,property.getName(),property.getValue().toString());
    throw cachedException;
  }
 finally {
    closeCircleStreamBufferOutput(buffer,cachedException);
  }
}

Fixed version (ground truth):
@Override public SerializerResult primitive(final ServiceMetadata metadata,final EdmPrimitiveType type,final Property property,final PrimitiveSerializerOptions options) throws SerializerException {
  OutputStream outputStream=null;
  SerializerException cachedException=null;
  try {
    final ContextURL contextURL=checkContextURL(options == null ? null : options.getContextURL());
    CircleStreamBuffer buffer=new CircleStreamBuffer();
    outputStream=buffer.getOutputStream();
    JsonGenerator json=new JsonFactory().createGenerator(outputStream);
    json.writeStartObject();
    writeContextURL(contextURL,json);
    writeMetadataETag(metadata,json);
    if (property.isNull()) {
      throw new SerializerException("String_Node_Str",SerializerException.MessageKeys.NULL_INPUT);
    }
 else {
      json.writeFieldName(Constants.VALUE);
      writePrimitive(type,property,options == null ? null : options.isNullable(),options == null ? null : options.getMaxLength(),options == null ? null : options.getPrecision(),options == null ? null : options.getScale(),options == null ? null : options.isUnicode(),json);
    }
    json.writeEndObject();
    json.close();
    outputStream.close();
    return SerializerResultImpl.with().content(buffer.getInputStream()).build();
  }
 catch (  final IOException e) {
    cachedException=new SerializerException("String_Node_Str",e,SerializerException.MessageKeys.IO_EXCEPTION);
    throw cachedException;
  }
catch (  final EdmPrimitiveTypeException e) {
    cachedException=new SerializerException("String_Node_Str",e,SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,property.getName(),property.getValue().toString());
    throw cachedException;
  }
 finally {
    closeCircleStreamBufferOutput(outputStream,cachedException);
  }
}