/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return {@code true} if the exception was thrown by this stream, * {@code false} otherwise */ public boolean isCauseOf(final Throwable exception) { return TaggedIOException.isTaggedWith(exception, tag); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return {@code true} if the exception was thrown by this stream, * {@code false} otherwise */ public boolean isCauseOf(final Exception exception) { return TaggedIOException.isTaggedWith(exception, tag); }
/** * Throws the original {@link IOException} if the given throwable is * a {@link TaggedIOException} decorator the given tag. Does nothing * if the given throwable is of a different type or if it is tagged * with some other tag. * <p> * This method is typically used in a <code>catch</code> block to * selectively rethrow tagged exceptions. * <pre> * Serializable tag = ...; * try { * ...; * } catch (Throwable t) { * TaggedIOExcepton.throwCauseIfTagged(t, tag); * // handle other kinds of exceptions * } * </pre> * * @param throwable an exception * @param tag tag object * @throws IOException original exception from the tagged decorator, if any */ public static void throwCauseIfTaggedWith(final Throwable throwable, final Object tag) throws IOException { if (isTaggedWith(throwable, tag)) { throw ((TaggedIOException) throwable).getCause(); } }
@Test public void testTaggedIOException() { final Serializable tag = UUID.randomUUID(); final IOException exception = new IOException("Test exception"); final TaggedIOException tagged = new TaggedIOException(exception, tag); assertTrue(TaggedIOException.isTaggedWith(tagged, tag)); assertFalse(TaggedIOException.isTaggedWith(tagged, UUID.randomUUID())); assertEquals(exception, tagged.getCause()); assertEquals(exception.getMessage(), tagged.getMessage()); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return {@code true} if the exception was thrown by this stream, * {@code false} otherwise */ public boolean isCauseOf(final Throwable exception) { return TaggedIOException.isTaggedWith(exception, tag); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return {@code true} if the exception was thrown by this stream, * {@code false} otherwise */ public boolean isCauseOf(final Throwable exception) { return TaggedIOException.isTaggedWith(exception, tag); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return {@code true} if the exception was thrown by this stream, * {@code false} otherwise */ public boolean isCauseOf(final Exception exception) { return TaggedIOException.isTaggedWith(exception, tag); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return {@code true} if the exception was thrown by this stream, * {@code false} otherwise */ public boolean isCauseOf(final Exception exception) { return TaggedIOException.isTaggedWith(exception, tag); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return <code>true</code> if the exception was thrown by this stream, * <code>false</code> otherwise */ public boolean isCauseOf(Exception exception) { return TaggedIOException.isTaggedWith(exception, tag); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return <code>true</code> if the exception was thrown by this stream, * <code>false</code> otherwise */ public boolean isCauseOf(Throwable exception) { return TaggedIOException.isTaggedWith(exception, tag); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return {@code true} if the exception was thrown by this stream, * {@code false} otherwise */ public boolean isCauseOf(Throwable exception) { return TaggedIOException.isTaggedWith(exception, tag); }
/** * Tests if the given exception was caused by this stream. * * @param exception an exception * @return {@code true} if the exception was thrown by this stream, * {@code false} otherwise */ public boolean isCauseOf(Exception exception) { return TaggedIOException.isTaggedWith(exception, tag); }
if (TaggedIOException.isTaggedWith(e, spewer)) { return ExtractionStatus.FAILURE_NOT_SAVED; if (TaggedIOException.isTaggedWith(e, MetadataTransformer.class)) { return ExtractionStatus.FAILURE_NOT_PARSED;
/** * Throws the original {@link IOException} if the given throwable is * a {@link TaggedIOException} decorator the given tag. Does nothing * if the given throwable is of a different type or if it is tagged * with some other tag. * <p> * This method is typically used in a <code>catch</code> block to * selectively rethrow tagged exceptions. * <pre> * Serializable tag = ...; * try { * ...; * } catch (Throwable t) { * TaggedIOExcepton.throwCauseIfTagged(t, tag); * // handle other kinds of exceptions * } * </pre> * * @param throwable an exception * @param tag tag object * @throws IOException original exception from the tagged decorator, if any */ public static void throwCauseIfTaggedWith(final Throwable throwable, final Object tag) throws IOException { if (isTaggedWith(throwable, tag)) { throw ((TaggedIOException) throwable).getCause(); } }
/** * Throws the original {@link IOException} if the given throwable is * a {@link TaggedIOException} decorator the given tag. Does nothing * if the given throwable is of a different type or if it is tagged * with some other tag. * <p> * This method is typically used in a <code>catch</code> block to * selectively rethrow tagged exceptions. * <pre> * Serializable tag = ...; * try { * ...; * } catch (Throwable t) { * TaggedIOExcepton.throwCauseIfTagged(t, tag); * // handle other kinds of exceptions * } * </pre> * * @param throwable an exception * @param tag tag object * @throws IOException original exception from the tagged decorator, if any */ public static void throwCauseIfTaggedWith(final Throwable throwable, final Object tag) throws IOException { if (isTaggedWith(throwable, tag)) { throw ((TaggedIOException) throwable).getCause(); } }
/** * Throws the original {@link IOException} if the given throwable is * a {@link TaggedIOException} decorator the given tag. Does nothing * if the given throwable is of a different type or if it is tagged * with some other tag. * <p> * This method is typically used in a <code>catch</code> block to * selectively rethrow tagged exceptions. * <pre> * Serializable tag = ...; * try { * ...; * } catch (Throwable t) { * TaggedIOExcepton.throwCauseIfTagged(t, tag); * // handle other kinds of exceptions * } * </pre> * * @param throwable an exception * @param tag tag object * @throws IOException original exception from the tagged decorator, if any */ public static void throwCauseIfTaggedWith(Throwable throwable, Object tag) throws IOException { if (isTaggedWith(throwable, tag)) { throw ((TaggedIOException) throwable).getCause(); } }
/** * Throws the original {@link IOException} if the given throwable is * a {@link TaggedIOException} decorator the given tag. Does nothing * if the given throwable is of a different type or if it is tagged * with some other tag. * <p> * This method is typically used in a <code>catch</code> block to * selectively rethrow tagged exceptions. * <pre> * Serializable tag = ...; * try { * ...; * } catch (Throwable t) { * TaggedIOExcepton.throwCauseIfTagged(t, tag); * // handle other kinds of exceptions * } * </pre> * * @param throwable an exception * @param tag tag object * @throws IOException original exception from the tagged decorator, if any */ public static void throwCauseIfTaggedWith(Throwable throwable, Object tag) throws IOException { if (isTaggedWith(throwable, tag)) { throw ((TaggedIOException) throwable).getCause(); } }