@Test(expected = EntityProviderException.class) public void invalidErrorDocumentMissingError() throws EntityProviderException { InputStream in = StringHelper.encapsulate(XML_ERROR_DOCUMENT_MISSING_ERROR); try { xedc.readError(in); fail("Expected exception was not thrown"); } catch (EntityProviderException e) { assertEquals("Got wrong exception: " + e.getMessageReference().getKey(), EntityProviderException.INVALID_STATE, e.getMessageReference()); throw e; } }
public ODataErrorContext readError(final InputStream errorDocument) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(errorDocument); return parserError(reader); } catch (XMLStreamException e) { cachedException = new EntityProviderException(EntityProviderException.INVALID_STATE.addContent( e.getMessage()), e); throw cachedException; } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException( EntityProviderException.EXCEPTION_OCCURRED.addContent( e.getClass().getSimpleName()), e); } } } } }
XmlErrorDocumentConsumer { public ODataErrorContext readError(final InputStream errorDocument) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(errorDocument); return parserError(reader); } catch (XMLStreamException e) { cachedException = new EntityProviderException(EntityProviderException.INVALID_STATE.addContent( e.getMessage()), e); throw cachedException; } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException( EntityProviderException.EXCEPTION_OCCURRED.addContent( e.getClass().getSimpleName()), e); } } } } } }
XmlErrorDocumentConsumer { public ODataErrorContext readError(final InputStream errorDocument) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(errorDocument); return parserError(reader); } catch (XMLStreamException e) { cachedException = new EntityProviderException(EntityProviderException.INVALID_STATE.addContent( e.getMessage()), e); throw cachedException; } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException( EntityProviderException.EXCEPTION_OCCURRED.addContent( e.getClass().getSimpleName()), e); } } } } }  }
XmlErrorDocumentConsumer { public ODataErrorContext readError(final InputStream errorDocument) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(errorDocument); return parserError(reader); } catch (XMLStreamException e) { cachedException = new EntityProviderException(EntityProviderException.INVALID_STATE.addContent( e.getMessage()), e); throw cachedException; } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException( EntityProviderException.EXCEPTION_OCCURRED.addContent( e.getClass().getSimpleName()), e); } } } } }  ODataErrorContext readError(final InputStream errorDocument); }
XmlErrorDocumentConsumer { public ODataErrorContext readError(final InputStream errorDocument) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(errorDocument); return parserError(reader); } catch (XMLStreamException e) { cachedException = new EntityProviderException(EntityProviderException.INVALID_STATE.addContent( e.getMessage()), e); throw cachedException; } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException( EntityProviderException.EXCEPTION_OCCURRED.addContent( e.getClass().getSimpleName()), e); } } } } }  ODataErrorContext readError(final InputStream errorDocument);  }