/** * Create a new RuntimeException, setting the cause if possible. * @param message * @param cause * @return A runtime exception object. */ public static RuntimeException createRuntimeException( String message, Throwable cause) { return (RuntimeException) createWithCause( RuntimeException.class, message, cause); }
/** * Initialize the event cartridge if appropriate. * * @param rsvc current instance of RuntimeServices * @param eventCartridge the event cartridge to be initialized */ private static void initializeEventCartridge(RuntimeServices rsvc, EventCartridge eventCartridge) { if (eventCartridge != null) { try { eventCartridge.initialize(rsvc); } catch (Exception e) { throw ExceptionUtils.createRuntimeException("Couldn't initialize event cartridge : ", e); } } }
/** * @param wrapped A throwable object that caused the Exception. * @since 1.5 */ public VelocityException(final Throwable wrapped) { super(); this.wrapped = wrapped; ExceptionUtils.setCause(this, wrapped); }
/** * Initialize the event cartridge if appropriate. * * @param rsvc current instance of RuntimeServices * @param eventCartridge the event cartridge to be initialized */ private static void initializeEventCartridge(RuntimeServices rsvc, EventCartridge eventCartridge) { if (eventCartridge != null) { try { eventCartridge.initialize(rsvc); } catch (Exception e) { throw ExceptionUtils.createRuntimeException("Couldn't initialize event cartridge : ", e); } } }
/** * Create a new RuntimeException, setting the cause if possible. * @param message * @param cause * @return A runtime exception object. */ public static RuntimeException createRuntimeException( String message, Throwable cause) { return (RuntimeException) createWithCause( RuntimeException.class, message, cause); }
/** * @param exceptionMessage The message to register. * @param wrapped A throwable object that caused the Exception. * @since 1.5 */ public VelocityException(final String exceptionMessage, final Throwable wrapped) { super(exceptionMessage); this.wrapped = wrapped; ExceptionUtils.setCause(this, wrapped); }
private void initAppender(String file) throws Exception { try { // to add the appender PatternLayout layout = new PatternLayout("%d - %m%n"); this.appender = new RollingFileAppender(layout, file, true); // if we successfully created the file appender, // configure it and set the logger to use only it appender.setMaxBackupIndex(1); appender.setMaximumFileSize(100000); // don't inherit appenders from higher in the logger heirarchy logger.setAdditivity(false); logger.addAppender(appender); log(DEBUG_ID, "Log4JLogChute initialized using file '"+file+'\''); } catch (IOException ioe) { rsvc.getLog().error("Could not create file appender '"+file+'\'', ioe); throw ExceptionUtils.createRuntimeException("Error configuring Log4JLogChute : ", ioe); } }
@Override public InputStream getResourceStream(String name) throws ResourceNotFoundException { InputStream result = null; if (StringUtils.isEmpty(name)) { throw new ResourceNotFoundException("No template name provided"); } String path = base + name; try { result = ClassUtils.getResourceAsStream(getClass(), path); } catch (Exception fnfe) { throw (ResourceNotFoundException) ExceptionUtils.createWithCause( ResourceNotFoundException.class, "problem with template: " + path, fnfe); } if (result == null) { throw new ResourceNotFoundException("ClasspathResourceLoader Error: cannot find resource " + path); } return result; }
/** * @param wrapped A throwable object that caused the Exception. * @since 1.5 */ public VelocityException(final Throwable wrapped) { super(); this.wrapped = wrapped; ExceptionUtils.setCause(this, wrapped); }
private void initAppender(String file) throws Exception { try { // to add the appender PatternLayout layout = new PatternLayout("%d - %m%n"); this.appender = new RollingFileAppender(layout, file, true); // if we successfully created the file appender, // configure it and set the logger to use only it appender.setMaxBackupIndex(1); appender.setMaximumFileSize(100000); // don't inherit appenders from higher in the logger heirarchy logger.setAdditivity(false); logger.addAppender(appender); log(DEBUG_ID, "Log4JLogChute initialized using file '"+file+'\''); } catch (IOException ioe) { rsvc.getLog().error("Could not create file appender '"+file+'\'', ioe); throw ExceptionUtils.createRuntimeException("Error configuring Log4JLogChute : ", ioe); } }
throw (ResourceNotFoundException) ExceptionUtils.createWithCause(ResourceNotFoundException.class, "problem with template: " + name, fnfe );
/** * @param exceptionMessage The message to register. * @param wrapped A throwable object that caused the Exception. * @since 1.5 */ public VelocityException(final String exceptionMessage, final Throwable wrapped) { super(exceptionMessage); this.wrapped = wrapped; ExceptionUtils.setCause(this, wrapped); }
throw ExceptionUtils.createRuntimeException(msg, sqle); throw ExceptionUtils.createRuntimeException(msg, ne);
throw (ResourceNotFoundException) ExceptionUtils.createWithCause(ResourceNotFoundException.class, "problem with template: " + name, fnfe );
/** * Creates a new UnicodeInputStream object. * * @param inputStream The input stream to use for reading. * @param skipBOM If this is set to true, a BOM read from the stream is discarded. This parameter should normally be true. */ public UnicodeInputStream(final InputStream inputStream, boolean skipBOM) throws IllegalStateException, IOException { super(); this.skipBOM = skipBOM; this.inputStream = new PushbackInputStream(inputStream, MAX_BOM_SIZE); try { this.encoding = readEncoding(); } catch (IOException ioe) { IllegalStateException ex = new IllegalStateException("Could not read BOM from Stream"); ExceptionUtils.setCause(ex, ioe); throw ex; } }
throw ExceptionUtils.createRuntimeException(msg, sqle); throw ExceptionUtils.createRuntimeException(msg, ne);
/** * Creates a new UnicodeInputStream object. * * @param inputStream The input stream to use for reading. * @param skipBOM If this is set to true, a BOM read from the stream is discarded. This parameter should normally be true. */ public UnicodeInputStream(final InputStream inputStream, boolean skipBOM) throws IllegalStateException, IOException { super(); this.skipBOM = skipBOM; this.inputStream = new PushbackInputStream(inputStream, MAX_BOM_SIZE); try { this.encoding = readEncoding(); } catch (IOException ioe) { IllegalStateException ex = new IllegalStateException("Could not read BOM from Stream"); ExceptionUtils.setCause(ex, ioe); throw ex; } }
throw ExceptionUtils.createRuntimeException("Exception in event handler.",e);
throw ExceptionUtils.createRuntimeException("Exception in event handler.",e);
throw ExceptionUtils.createRuntimeException("Couldn't initialize " + "directive of class " + parser.getDirective(directiveName).getClass().getName(), throw ExceptionUtils.createRuntimeException("Couldn't initialize " + "directive of class " + parser.getDirective(directiveName).getClass().getName(),