public T parse(InputSource from) { try { return doParse(from); } catch (Exception e) { return addDetailsAndPropagate(null, e); } }
public T parse(InputSource from) { try { return doParse(from); } catch (Exception e) { return addDetailsAndPropagate(null, e); } }
public T parse(InputSource from) { try { return doParse(from); } catch (Exception e) { return addDetailsAndPropagate(null, e); } }
public T parse(InputSource from) { try { return doParse(from); } catch (Exception e) { return addDetailsAndPropagate(null, e); } }
public T parse(InputSource from) { try { return doParse(from); } catch (Exception e) { return addDetailsAndPropagate(null, e); } }
public T parse(InputSource from) { try { return doParse(from); } catch (Exception e) { return addDetailsAndPropagate(null, e); } }
public T parse(String from) { try { validateXml(from); return doParse(new InputSource(new StringReader(from))); } catch (Exception e) { return addDetailsAndPropagate(null, e, from); } }
public T parse(String from) { try { validateXml(from); return doParse(new InputSource(new StringReader(from))); } catch (Exception e) { return addDetailsAndPropagate(null, e, from); } }
public T parse(String from) { try { validateXml(from); return doParse(new InputSource(new StringReader(from))); } catch (Exception e) { return addDetailsAndPropagate(null, e, from); } }
public T parse(String from) { try { validateXml(from); return doParse(new InputSource(new StringReader(from))); } catch (Exception e) { return addDetailsAndPropagate(null, e, from); } }
private T convertStreamToStringAndParse(HttpResponse response) { String from = null; try { from = new String(closeClientButKeepContentStream(response)); validateXml(from); return doParse(new InputSource(new StringReader(from))); } catch (Exception e) { return addDetailsAndPropagate(response, e, from); } }
private T convertStreamToStringAndParse(HttpResponse response) { String from = null; try { from = new String(closeClientButKeepContentStream(response)); validateXml(from); return doParse(new InputSource(new StringReader(from))); } catch (Exception e) { return addDetailsAndPropagate(response, e, from); } }
private T convertStreamToStringAndParse(HttpResponse response) { String from = null; try { byte[] fromBytes = closeClientButKeepContentStream(response); from = new String(fromBytes); validateXml(from); // Use InputStream to skip over byte order mark. return doParse(new InputSource(new ByteArrayInputStream(fromBytes))); } catch (Exception e) { return addDetailsAndPropagate(response, e, from); } }
private T convertStreamToStringAndParse(HttpResponse response) { String from = null; try { from = new String(closeClientButKeepContentStream(response)); validateXml(from); return doParse(new InputSource(new StringReader(from))); } catch (Exception e) { return addDetailsAndPropagate(response, e, from); } }
private T convertStreamToStringAndParse(HttpResponse response) { String from = null; try { byte[] fromBytes = closeClientButKeepContentStream(response); from = new String(fromBytes); validateXml(from); // Use InputStream to skip over byte order mark. return doParse(new InputSource(new ByteArrayInputStream(fromBytes))); } catch (Exception e) { return addDetailsAndPropagate(response, e, from); } }
private T convertStreamToStringAndParse(HttpResponse response) { String from = null; try { byte[] fromBytes = closeClientButKeepContentStream(response); from = new String(fromBytes); validateXml(from); // Use InputStream to skip over byte order mark. return doParse(new InputSource(new ByteArrayInputStream(fromBytes))); } catch (Exception e) { return addDetailsAndPropagate(response, e, from); } }
@Test public void testAddDetailsAndPropagateOkWhenRequestWithNoDataAndRuntimeExceptionThrowsOriginalException() throws ExecutionException, InterruptedException, TimeoutException, IOException { ParseSax<String> parser = createParser(); Exception input = new RuntimeException("foo"); try { parser.addDetailsAndPropagate(null, input); } catch (RuntimeException e) { assertEquals(e, input); } }
@Test public void testAddDetailsAndPropagateOkWhenRequestWithNoDataAndExceptionPropagates() throws ExecutionException, InterruptedException, TimeoutException, IOException { ParseSax<String> parser = createParser(); Exception input = new Exception("foo"); try { parser.addDetailsAndPropagate(null, input); } catch (RuntimeException e) { assertEquals(e.getMessage(), "java.lang.Exception: foo"); assertEquals(e.getCause(), input); } }
@Test public void testAddDetailsAndPropagateOkWhenRequestWithNoDataAndRuntimeExceptionThrowsOriginalException() { ParseSax<String> parser = createParser(); Exception input = new RuntimeException("foo"); try { parser.addDetailsAndPropagate(null, input); } catch (RuntimeException e) { assertEquals(e, input); } }
@Test public void testAddDetailsAndPropagateOkWhenRequestWithNoDataAndExceptionPropagates() { ParseSax<String> parser = createParser(); Exception input = new Exception("foo"); try { parser.addDetailsAndPropagate(null, input); } catch (RuntimeException e) { assertEquals(e.getMessage(), "java.lang.Exception: foo"); assertEquals(e.getCause(), input); } }