Package freemarker.template

Examples of freemarker.template.TemplateModelException


 
  @SuppressWarnings("unchecked")
  public Object exec(List args) throws TemplateModelException {
    if(args.size() < 1 || args.size() > 3){
      throw new TemplateModelException("Wrong number of arguments");
    }
    SimpleHash tagCloudHash = new SimpleHash(new HashMap<String,Integer>())
   
    List<TagLabel> tags = getTagLabelFromArg1(args.get(0));
    int numOfFontSize = 6;
View Full Code Here


   */
  @SuppressWarnings("unchecked")
  public Object exec(List args) throws TemplateModelException {
    if(args.size() != 1){
      logger.error("Received wrong number of arguments.");
      throw new TemplateModelException("Wrong number of arguments. Expected args size of 1, but received " + args.size());
    }
    String htmlCode = null;
    if(args.get(0) instanceof StringModel){ 
      htmlCode = ((StringModel)args.get(0)).getAsString();           
    }else if(args.get(0) instanceof SimpleScalar){
      htmlCode = ((SimpleScalar)args.get(0)).getAsString();
    }else{
      logger.error("Not a StringModel or SimpleScalar");
      throw new TemplateModelException("Argument is not an instance of StringModel or SimpleScalar");
    }
    if(htmlCode == null){
      logger.error("Can't scrape text from html code because the input is null");
      throw new NullPointerException("htmlCode is null");
    }
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  public Object exec(List args) throws TemplateModelException {
    if(args.size() != 1){
      logger.error("Received wrong number of arguments.");
      throw new TemplateModelException("Wrong number of arguments. Expected args size of 1, but received " + args.size());
    }
    String htmlCode = null;
    if(args.get(0) instanceof StringModel){ 
      htmlCode = ((StringModel)args.get(0)).getAsString();           
    }else if(args.get(0) instanceof SimpleScalar){
      htmlCode = ((SimpleScalar)args.get(0)).getAsString();
    }else{
      logger.error("Not a StringModel or SimpleScalar");
      throw new TemplateModelException("Argument is not an instance of StringModel or SimpleScalar");
    }
    if(htmlCode == null){
      logger.error("Can't tidy html code because the input is null");
      throw new NullPointerException("htmlCode is null");
    }
View Full Code Here

  private static final Logger logger = Logger.getLogger(HighlightTextMethod.class);
 
  @SuppressWarnings("unchecked")
  public Object exec(List args) throws TemplateModelException {
    if(args.size() != 3 && args.size() != 4){
      throw new TemplateModelException("Wrong number of arguments");
    }
    String content = "";
    if(args.get(0) instanceof SimpleScalar){
      content = ((SimpleScalar)args.get(0)).getAsString();
    }else if(args.get(0) instanceof StringModel){
View Full Code Here

                }
                catch(RuntimeException e) {
                    throw e;
                }
                catch(Exception e) {
                    throw new TemplateModelException(e);
                }
            }
        }
    }
View Full Code Here

    {
        try {
            return new DomXPathEx(xpathString);
        }
        catch(Exception e) {
            throw new TemplateModelException(e);
        }
    }
View Full Code Here

                (HttpRequestParametersHashModel) request.getAttribute(
                    ATTR_REQUEST_PARAMETERS_MODEL);
            params.putUnlistedModel(KEY_REQUEST_PARAMETERS, requestParametersModel);
            return params;
        } catch (ServletException e) {
            throw new TemplateModelException(e);
        } catch (IOException e) {
            throw new TemplateModelException(e);
        }
    }
View Full Code Here

            context.getContextSupport().setNamespaceContext(namespaces);
            try {
                return selectNodesForContext(context);
            }
            catch(Exception e) {
                throw new TemplateModelException(e);
            }
        }
View Full Code Here

        }  
    }
   
    public Object exec(List arguments) throws TemplateModelException {
        if (arguments.size() != 2) {
            throw new TemplateModelException("_registerNamespace(prefix, uri) requires two arguments");
        }
        registerNamespace((String)arguments.get(0), (String)arguments.get(1));
        return TemplateScalarModel.EMPTY_STRING;
    }
View Full Code Here

            }
            else if (node instanceof EntityRef) {
                OUTPUT.output((EntityRef)node, sw);
            }
            else {
                throw new TemplateModelException(node.getClass().getName() + " is not a core JDOM class");
            }
        }
        catch(IOException e) {
            throw new TemplateModelException(e);
        }
    }
View Full Code Here

TOP

Related Classes of freemarker.template.TemplateModelException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.