[utilities COMMIT] /java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java

noreply at shibboleth.net noreply at shibboleth.net
Fri Dec 14 20:42:14 EST 2012


Author: scantor
Date: Fri Dec 14 20:42:14 2012
New Revision: 306

URL: http://svn.shibboleth.net/view/utilities?rev=306&view=rev
Log:
Checkstyle and doc fixes.

Modified:
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java

Modified: java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
URL: http://svn.shibboleth.net/view/utilities/java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java?rev=306&r1=305&r2=306&view=diff
==============================================================================
--- java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java (original)
+++ java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java Fri Dec 14 20:42:14 2012
@@ -47,6 +47,9 @@
  * template. Note, this check occurs only at {@link Template} construction time so, if you're loading a named template
  * from a file and that file disappears before calling {@link #merge(Context)} or {@link #merge(Context, Writer)} you'll
  * still end up getting a {@link org.apache.velocity.exception.ResourceNotFoundException}.
+ * 
+ * Many methods throw an {@link org.apache.velocity.exception.VelocityException} to report template or argument errors,
+ * which is an unchecked exception type.
  */
 public final class Template {
 
@@ -91,12 +94,8 @@
      *            {@link #fromTemplateName(VelocityEngine, String, Charset)} for that
      * 
      * @return an instance of this class that can be used to evaluate the given template using the given engine
-     * 
-     * @throws VelocityException thrown if engine is not configured to load the given template from the default
-     *             {@link StringResourceRepository}
-     */
-    @Nonnull public static Template fromTemplate(@Nonnull VelocityEngine engine, @Nonnull @NotEmpty String template)
-            throws VelocityException {
+     */
+    @Nonnull public static Template fromTemplate(@Nonnull VelocityEngine engine, @Nonnull @NotEmpty String template) {
         return fromTemplate(engine, template, Charsets.US_ASCII);
     }
 
@@ -119,12 +118,9 @@
      * @param encoding the encoding used by the template
      * 
      * @return an instance of this class that can be used to evaluate the given template using the given engine
-     * 
-     * @throws VelocityException thrown if engine is not configured to load the given template from the default
-     *             {@link StringResourceRepository}
      */
     @Nonnull public static Template fromTemplate(@Nonnull VelocityEngine engine, @Nonnull @NotEmpty String template,
-            @Nonnull Charset encoding) throws VelocityException {
+            @Nonnull Charset encoding) {
         final String trimmedTemplate =
                 Constraint.isNotNull(StringSupport.trimOrNull(template), "Velocity template can not be null or empty");
         Constraint.isNotNull(encoding, "Template encoding character set can not be null");
@@ -166,11 +162,8 @@
      * @param templateName the name, as known to the given engine, of a velocity template
      * 
      * @return an instance of this class that can be used to evaluate the named template using the given engine
-     * 
-     * @throws VelocityException thrown if the template name is not known to the engine
-     */
-    public static Template fromTemplateName(@Nonnull VelocityEngine engine, @Nonnull @NotEmpty String templateName)
-            throws VelocityException {
+     */
+    public static Template fromTemplateName(@Nonnull VelocityEngine engine, @Nonnull @NotEmpty String templateName) {
         return fromTemplateName(engine, templateName, Charsets.US_ASCII);
     }
 
@@ -182,11 +175,9 @@
      * @param encoding the template encoding
      * 
      * @return an instance of this class that can be used to evaluate the named template using the given engine
-     * 
-     * @throws VelocityException thrown if the template name is not known to the engine
      */
     public static Template fromTemplateName(@Nonnull VelocityEngine engine, @Nonnull @NotEmpty String name,
-            @Nonnull Charset encoding) throws VelocityException {
+            @Nonnull Charset encoding) {
         final String trimmedName =
                 Constraint.isNotNull(StringSupport.trimOrNull(name), "Velocity template name can not be null or empty");
         Constraint.isNotNull(encoding, "Template encoding character set can not be null");
@@ -220,24 +211,20 @@
      * @param templateContext current template context
      * 
      * @return the generated output of the template
-     * 
-     * @throws VelocityException thrown if there is a problem evaluating the template
-     */
-    public String merge(Context templateContext) throws VelocityException {
+     */
+    public String merge(Context templateContext) {
         StringWriter output = new StringWriter();
         merge(templateContext, output);
         return output.toString();
     }
 
     /**

[... 15 lines stripped ...]


More information about the commits mailing list