Program: 33166
Project: 33166
Buggy source:
@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(IO_EXCEPTION_TEXT,e,SerializerException.MessageKeys.IO_EXCEPTION);
    throw cachedException;
  }
 finally {
    closeCircleStreamBufferOutput(outputStream,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(metadata,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(IO_EXCEPTION_TEXT,e,SerializerException.MessageKeys.IO_EXCEPTION);
    throw cachedException;
  }
 finally {
    closeCircleStreamBufferOutput(outputStream,cachedException);
  }
}