Program: 33288
Project: 33288
Buggy source:
@Override public SerializerResult complex(final ServiceMetadata metadata,final EdmComplexType type,final Property property,final ComplexSerializerOptions 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);
    final EdmComplexType resolvedType=resolveComplexType(metadata,type,property.getType());
    if (!isODataMetadataNone && !resolvedType.equals(type)) {
      json.writeStringField(Constants.JSON_TYPE,"String_Node_Str" + property.getType());
    }
    final List<Property> values=property.isNull() ? Collections.<Property>emptyList() : property.asComplex().getValue();
    writeProperties(type,values,options == null ? null : options.getSelect(),json);
    if (!property.isNull() && property.isComplex()) {
      writeNavigationProperties(metadata,type,property.asComplex(),options == null ? null : options.getExpand(),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;
  }
 finally {
    closeCircleStreamBufferOutput(buffer,cachedException);
  }
}

Fixed version (ground truth):
@Override public SerializerResult complex(final ServiceMetadata metadata,final EdmComplexType type,final Property property,final ComplexSerializerOptions 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);
    final EdmComplexType resolvedType=resolveComplexType(metadata,type,property.getType());
    if (!isODataMetadataNone && !resolvedType.equals(type)) {
      json.writeStringField(Constants.JSON_TYPE,"String_Node_Str" + property.getType());
    }
    final List<Property> values=property.isNull() ? Collections.<Property>emptyList() : property.asComplex().getValue();
    writeProperties(type,values,options == null ? null : options.getSelect(),json);
    if (!property.isNull() && property.isComplex()) {
      writeNavigationProperties(metadata,type,property.asComplex(),options == null ? null : options.getExpand(),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;
  }
 finally {
    closeCircleStreamBufferOutput(outputStream,cachedException);
  }
}