Ignore:
Timestamp:
2009-07-02 15:06:52 (3 years ago)
Author:
bruno
Message:

Introduce a TemplateException? class, and use that in the template code instead of a generic RuntimeException?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/universe/kauri-template/src/main/java/org/kauriproject/template/el/TemplateFunctionMapper.java

    r1020 r1346  
    1616package org.kauriproject.template.el; 
    1717 
    18 import org.apache.commons.logging.Log; 
    19 import org.apache.commons.logging.LogFactory; 
     18import org.kauriproject.template.TemplateException; 
    2019 
    2120import javax.el.FunctionMapper; 
     
    2625public class TemplateFunctionMapper extends FunctionMapper { 
    2726    private Map<String, Method> functions = new HashMap<String, Method>(); 
    28     private Log log = LogFactory.getLog(getClass()); 
    2927 
    3028    public TemplateFunctionMapper(FunctionRegistry functionRegistry) { 
     
    5250            addFunction(prefix, "max", Math.class.getMethod("max", double.class, double.class)); 
    5351            addFunction(prefix, "min", Math.class.getMethod("min", double.class, double.class)); 
    54             // add additional math functions 
    55             Method[] methods = MathFunctions.class.getDeclaredMethods(); 
    56             for (Method method : methods) { 
    57                 addFunction(prefix, method.getName(), method); 
    58             } 
    5952        } catch (NoSuchMethodException nex) { 
    60             log.error("Error adding math functions to the EL: " + nex); 
     53            throw new TemplateException("Error registering math functions with EL", nex); 
     54        } 
     55 
     56        // add additional math functions 
     57        Method[] methods = MathFunctions.class.getDeclaredMethods(); 
     58        for (Method method : methods) { 
     59            addFunction(prefix, method.getName(), method); 
    6160        } 
    6261    } 
Note: See TracChangeset for help on using the changeset viewer.