/** Copied from org.apache.velocity.app.VelocityEngine。 */ private boolean mergeTemplate(String templateName, String encoding, Context context, Writer writer) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception { Template template = ri.getTemplate(templateName, encoding); if (template == null) { String msg = "VelocityEngine.mergeTemplate() was unable to load template '" + templateName + "'"; ri.getLog().error(msg); throw new ResourceNotFoundException(msg); } else { template.merge(context, writer); return true; } }
/** Copied from org.apache.velocity.app.VelocityEngine。 */ private boolean mergeTemplate(String templateName, String encoding, Context context, Writer writer) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception { Template template = ri.getTemplate(templateName, encoding); if (template == null) { String msg = "VelocityEngine.mergeTemplate() was unable to load template '" + templateName + "'"; ri.getLog().error(msg); throw new ResourceNotFoundException(msg); } else { template.merge(context, writer); return true; } }
/** * @param message * @deprecated Use getLog() and call warn() on it. */ public void error(Object message) { getLog().error(message); }
/** * @deprecated Use getLog() and call error() on it. * @see Log#error(Object) * @param message The message to log. */ public void error(Object message) { getLog().error(message); }
/** * @deprecated Use getLog() and call error() on it. * @see Log#error(Object) * @param message The message to log. */ public void error(Object message) { getLog().error(message); }
/** * @param message * @deprecated Use getLog() and call warn() on it. */ public void error(Object message) { getLog().error(message); }
/** * @deprecated Use getLog() and call error() on it. * @see Log#error(Object) * @param message The message to log. */ public static void error(Object message) { getLog().error(message); }
/** * @deprecated Use getLog() and call error() on it. * @see Log#error(Object) * @param message The message to log. */ public static void error(Object message) { getLog().error( message ); }
/** * @deprecated Use getLog() and call error() on it. * @see Log#error(Object) * @param message The message to log. */ public static void error(Object message) { getLog().error(message); }
/** * @deprecated Use getLog() and call error() on it. * @see Log#error(Object) * @param message The message to log. */ public static void error(Object message) { getLog().error( message ); }
/** * {@inheritDoc} * * @see org.apache.velocity.util.introspection.Uberspect#init() */ @Override public void init() { if (this.inner != null) { try { this.inner.init(); } catch (Exception e) { this.log.error(e.getMessage(), e); } } }
private void tryToSetTimeout(URLConnection conn) { if (timeout > 0) { Object[] arg = new Object[] { new Integer(timeout) }; try { timeoutMethods[0].invoke(conn, arg); timeoutMethods[1].invoke(conn, arg); } catch (Exception e) { String msg = "Unexpected exception while setting connection timeout for "+conn; log.error(msg, e); throw new VelocityException(msg, e); } } }
private void tryToSetTimeout(URLConnection conn) { if (timeout > 0) { Object[] arg = new Object[] { new Integer(timeout) }; try { timeoutMethods[0].invoke(conn, arg); timeoutMethods[1].invoke(conn, arg); } catch (Exception e) { String msg = "Unexpected exception while setting connection timeout for "+conn; log.error(msg, e); throw new VelocityException(msg, e); } } }
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException { //render content StringWriter content = new StringWriter(); node.jjtGetChild(0).render(context, content); //compress try { writer.write(xmlCompressor.compress(content.toString())); } catch (Exception e) { writer.write(content.toString()); String msg = "Failed to compress content: "+content.toString(); log.error(msg, e); throw new RuntimeException(msg, e); } return true; }
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException { //render content StringWriter content = new StringWriter(); node.jjtGetChild(0).render(context, content); //compress try { writer.write(htmlCompressor.compress(content.toString())); } catch (Exception e) { writer.write(content.toString()); String msg = "Failed to compress content: "+content.toString(); log.error(msg, e); throw new RuntimeException(msg, e); } return true; }
/** * Init or die! (with some log help, of course) */ private void requireInitialization() { if (!initialized) { try { init(); } catch (Exception e) { getLog().error("Could not auto-initialize Velocity", e); throw new RuntimeException("Velocity could not be initialized!", e); } } }
/** * */ public void close() { try { theJar.close(); } catch ( Exception e ) { String msg = "JarHolder: error closing the JAR file"; log.error(msg, e); throw new VelocityException(msg, e); } theJar = null; conn = null; log.trace("JarHolder: JAR file closed"); }
/** * */ public void close() { try { theJar.close(); } catch ( Exception e ) { String msg = "JarHolder: error closing the JAR file"; log.error(msg, e); throw new VelocityException(msg, e); } theJar = null; conn = null; log.trace("JarHolder: JAR file closed"); }
/** Copied from org.apache.velocity.app.VelocityEngine。 */ private boolean mergeTemplate(String templateName, String encoding, Context context, Writer writer) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception { Template template = ri.getTemplate(templateName, encoding); if (template == null) { String msg = "VelocityEngine.mergeTemplate() was unable to load template '" + templateName + "'"; ri.getLog().error(msg); throw new ResourceNotFoundException(msg); } else { template.merge(context, writer); return true; } }
/** * Init or die! (with some log help, of course) */ private void requireInitialization() { if (!initialized && !initializing) { log.debug("Velocity was not initialized! Calling init()..."); try { init(); } catch (Exception e) { getLog().error("Could not auto-initialize Velocity", e); throw new RuntimeException("Velocity could not be initialized!", e); } } }