Program: 64982
Project: 64982
Buggy source:
public final Object readFrom(Class<Object> type,Type genericType,Annotation[] annotations,MediaType mediaType,MultivaluedMap<String,String> httpHeaders,InputStream entityStream) throws IOException, WebApplicationException {
  try {
    Class<?> domainClass=getDomainClass(genericType);
    JAXBContext jaxbContext=getJAXBContext(domainClass,annotations,mediaType,httpHeaders);
    Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
    unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE,MediaType.APPLICATION_JSON);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_ATTRIBUTE_PREFIX,attributePrefix);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT,includeRoot);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_NAMESPACE_PREFIX_MAPPER,namespacePrefixMapper);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_NAMESPACE_SEPARATOR,namespaceSeperator);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_VALUE_WRAPPER,valueWrapper);
    preReadFrom(type,genericType,annotations,mediaType,httpHeaders,unmarshaller);
    StreamSource jsonSource;
    Map<String,String> mediaTypeParameters=mediaType.getParameters();
    if (mediaTypeParameters.containsKey(CHARSET)) {
      String charSet=mediaTypeParameters.get(CHARSET);
      Reader entityReader=new InputStreamReader(entityStream,charSet);
      jsonSource=new StreamSource(entityReader);
    }
 else {
      jsonSource=new StreamSource(entityStream);
    }
    return unmarshaller.unmarshal(jsonSource,domainClass).getValue();
  }
 catch (  JAXBException jaxbException) {
    throw new WebApplicationException(jaxbException);
  }
}

Fixed version (ground truth):
public final Object readFrom(Class<Object> type,Type genericType,Annotation[] annotations,MediaType mediaType,MultivaluedMap<String,String> httpHeaders,InputStream entityStream) throws IOException, WebApplicationException {
  try {
    Class<?> domainClass=getDomainClass(genericType);
    JAXBContext jaxbContext=getJAXBContext(domainClass,annotations,mediaType,httpHeaders);
    Unmarshaller unmarshaller=jaxbContext.createUnmarshaller();
    unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE,MediaType.APPLICATION_JSON);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_ATTRIBUTE_PREFIX,attributePrefix);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT,includeRoot);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_NAMESPACE_PREFIX_MAPPER,namespacePrefixMapper);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_NAMESPACE_SEPARATOR,namespaceSeperator);
    unmarshaller.setProperty(UnmarshallerProperties.JSON_VALUE_WRAPPER,valueWrapper);
    preReadFrom(type,genericType,annotations,mediaType,httpHeaders,unmarshaller);
    StreamSource jsonSource;
    Map<String,String> mediaTypeParameters=mediaType.getParameters();
    if (mediaTypeParameters.containsKey(CHARSET)) {
      String charSet=mediaTypeParameters.get(CHARSET);
      Reader entityReader=new InputStreamReader(entityStream,charSet);
      jsonSource=new StreamSource(entityReader);
    }
 else {
      jsonSource=new StreamSource(entityStream);
    }
    JAXBElement<?> jaxbElement=unmarshaller.unmarshal(jsonSource,domainClass);
    if (type.isAssignableFrom(JAXBElement.class)) {
      return jaxbElement;
    }
 else {
      return jaxbElement.getValue();
    }
  }
 catch (  JAXBException jaxbException) {
    throw new WebApplicationException(jaxbException);
  }
}