/** * Throws out a {@link ConfigurationException} with message specified. * @param message * the error message format pattern. * @param args * the error message format arguments. */ public static ConfigurationException invalidConfiguration(String message, Object... args) { throw new ConfigurationException(message, args); }
/** * Throws out an {@link InvalidArgException}. */ public static InvalidArgException invalidArg() { throw new InvalidArgException(); }
private void mappingError(Throwable cause, String message, Object... messageArgs) { if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new MappingException(source, target, cause, message, messageArgs); }
/** * Throws out a {@link UnexpectedException} with message specified. * * @param msg * the message format pattern. * @param args * the message format arguments */ public static UnexpectedException unexpected(String msg, Object... args) { throw new UnexpectedException(msg, args); }
/** * Throws out an {@link InvalidStateException}. */ public static InvalidStateException invalidState() { throw new InvalidStateException(); }
/** * Wrap the {@link IOException} into {@link UnexpectedIOException} and throw it out. * @param cause * the {@link IOException}. */ public static UnexpectedIOException ioException(IOException cause) { throw new UnexpectedIOException(cause); }
/** * Throws out an {@link InvalidRangeException} with error message specified. * @param msg * the error message format pattern. * @param args * the error message format arguments. */ public static InvalidRangeException invalidRange(String msg, Object... args) { throw new InvalidRangeException(msg, args); }
/** * Wrap the {@link UnsupportedEncodingException} into an {@link UnexpectedEncodingException} * and throw it out. * * @param cause * the {@link UnsupportedEncodingException}. */ public static UnexpectedEncodingException encodingException(UnsupportedEncodingException cause) { throw new UnexpectedEncodingException(cause); }
private static void ensureWritable(boolean ro, String containerName) { if (ro) { throw new ReadOnlyException(containerName + " is readonly"); } }
/** * Convert an Exception to RuntimeException * @param e the Exception instance * @return a RuntimeException instance */ public static RuntimeException asRuntimeException(Exception e) { if (e instanceof RuntimeException) { return (RuntimeException) e; } return UnexpectedMethodInvocationException.triage(e); }
/** * Throws out a {@link ConfigurationException} with cause and message specified. * @param cause * the cause of the configuration error. * @param message * the error message format pattern. * @param args * the error message format arguments. */ public static ConfigurationException invalidConfiguration(Throwable cause, String message, Object... args) { throw new ConfigurationException(cause, message, args); }
/** * Throws out a {@link UnexpectedException} with cause specified. * * @param cause * the cause of the unexpected exception. */ public static UnexpectedException unexpected(Throwable cause) { throw new UnexpectedException(cause); }
/** * Throws out an {@link InvalidArgException} when `tester` is `false`. * @param tester * when `false` then throws out the exception */ public static void invalidArgIfNot(boolean tester) { if (!tester) { throw new InvalidArgException(); } }
private void mappingError(Throwable cause, String message, Object... messageArgs) { if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new MappingException(source, target, cause, message, messageArgs); }
/** * Throws out an {@link InvalidStateException}. */ public static InvalidStateException invalidState() { throw new InvalidStateException(); }
/** * Wrap the {@link IOException} into {@link UnexpectedIOException} and throw it out. * @param cause * the {@link IOException}. */ public static UnexpectedIOException ioException(IOException cause) { throw new UnexpectedIOException(cause); }
/** * Throws out an {@link InvalidRangeException} with error message specified. * @param msg * the error message format pattern. * @param args * the error message format arguments. */ public static InvalidRangeException invalidRange(String msg, Object... args) { throw new InvalidRangeException(msg, args); }
/** * Throws out an {@link InvalidArgException} when `tester` is `true`. * @param tester * when `true` then throws out the exception */ public static void invalidArgIf(boolean tester) { if (tester) { throw new InvalidArgException(); } }
/** * Throws out an {@link InvalidArgException} when `tester` is `true`. * @param tester * when `true` then throws out the exception */ public static void invalidArgIf(boolean tester) { if (tester) { throw new InvalidArgException(); } }
/** * Throws out an {@link InvalidArgException} with error message specified. * * @param msg * the error message format pattern. * @param args * the error message format arguments. */ public static InvalidArgException invalidArg(String msg, Object... args) { throw new InvalidArgException(msg, args); }