protected Object unmarshalFromInputStream(Unmarshaller unmarshaller, InputStream is, MediaType mt) throws JAXBException { // Try to create the read before unmarshalling the stream XMLStreamReader xmlReader = null; try { if (is == null) { Reader reader = getStreamHandlerFromCurrentMessage(Reader.class); if (reader == null) { LOG.severe("No InputStream, Reader, or XMLStreamReader is available"); throw ExceptionUtils.toInternalServerErrorException(null, null); } xmlReader = StaxUtils.createXMLStreamReader(reader); } else { xmlReader = StaxUtils.createXMLStreamReader(is); } configureReaderRestrictions(xmlReader); return unmarshaller.unmarshal(xmlReader); } finally { StaxUtils.close(xmlReader); } }
protected Object unmarshalFromInputStream(Unmarshaller unmarshaller, InputStream is, Annotation[] anns, MediaType mt) throws JAXBException { // Try to create the read before unmarshalling the stream XMLStreamReader xmlReader = null; try { if (is == null) { Reader reader = getStreamHandlerFromCurrentMessage(Reader.class); if (reader == null) { LOG.severe("No InputStream, Reader, or XMLStreamReader is available"); throw ExceptionUtils.toInternalServerErrorException(null, null); } xmlReader = StaxUtils.createXMLStreamReader(reader); } else { xmlReader = StaxUtils.createXMLStreamReader(is); } configureReaderRestrictions(xmlReader); return unmarshaller.unmarshal(xmlReader); } finally { try { StaxUtils.close(xmlReader); } catch (XMLStreamException e) { // Ignore } } }