Program: 64984
Project: 64984
Buggy source:
public final void writeTo(Object object,Class<?> type,Type genericType,Annotation[] annotations,MediaType mediaType,MultivaluedMap<String,Object> httpHeaders,OutputStream entityStream) throws IOException, WebApplicationException {
  try {
    Class<?> domainClass=getDomainClass(genericType);
    JAXBContext jaxbContext=getJAXBContext(domainClass,annotations,mediaType,httpHeaders);
    Marshaller marshaller=jaxbContext.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,formattedOutput);
    marshaller.setProperty(MarshallerProperties.MEDIA_TYPE,MediaType.APPLICATION_JSON);
    marshaller.setProperty(MarshallerProperties.JSON_ATTRIBUTE_PREFIX,attributePrefix);
    marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT,includeRoot);
    marshaller.setProperty(MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS,marshalEmptyCollections);
    marshaller.setProperty(MarshallerProperties.JSON_NAMESPACE_SEPARATOR,namespaceSeperator);
    marshaller.setProperty(MarshallerProperties.JSON_VALUE_WRAPPER,valueWrapper);
    marshaller.setProperty(MarshallerProperties.NAMESPACE_PREFIX_MAPPER,namespacePrefixMapper);
    Map<String,String> mediaTypeParameters=mediaType.getParameters();
    if (mediaTypeParameters.containsKey(CHARSET)) {
      String charSet=mediaTypeParameters.get(CHARSET);
      marshaller.setProperty(Marshaller.JAXB_ENCODING,charSet);
    }
    preWriteTo(object,type,genericType,annotations,mediaType,httpHeaders,marshaller);
    marshaller.marshal(object,entityStream);
  }
 catch (  JAXBException jaxbException) {
    throw new WebApplicationException(jaxbException);
  }
}

Fixed version (ground truth):
public final void writeTo(Object object,Class<?> type,Type genericType,Annotation[] annotations,MediaType mediaType,MultivaluedMap<String,Object> httpHeaders,OutputStream entityStream) throws IOException, WebApplicationException {
  try {
    Class<?> domainClass=getDomainClass(genericType);
    JAXBContext jaxbContext=getJAXBContext(domainClass,annotations,mediaType,httpHeaders);
    Marshaller marshaller=jaxbContext.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,formattedOutput);
    marshaller.setProperty(MarshallerProperties.MEDIA_TYPE,MediaType.APPLICATION_JSON);
    marshaller.setProperty(MarshallerProperties.JSON_ATTRIBUTE_PREFIX,attributePrefix);
    marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT,includeRoot);
    marshaller.setProperty(MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS,marshalEmptyCollections);
    marshaller.setProperty(MarshallerProperties.JSON_NAMESPACE_SEPARATOR,namespaceSeperator);
    if (null != valueWrapper) {
      marshaller.setProperty(MarshallerProperties.JSON_VALUE_WRAPPER,valueWrapper);
    }
    marshaller.setProperty(MarshallerProperties.NAMESPACE_PREFIX_MAPPER,namespacePrefixMapper);
    Map<String,String> mediaTypeParameters=mediaType.getParameters();
    if (mediaTypeParameters.containsKey(CHARSET)) {
      String charSet=mediaTypeParameters.get(CHARSET);
      marshaller.setProperty(Marshaller.JAXB_ENCODING,charSet);
    }
    preWriteTo(object,type,genericType,annotations,mediaType,httpHeaders,marshaller);
    marshaller.marshal(object,entityStream);
  }
 catch (  JAXBException jaxbException) {
    throw new WebApplicationException(jaxbException);
  }
}