Package org.apache.velocity.exception

Examples of org.apache.velocity.exception.VelocityException


            else
            {
                String msg = directiveClass + " does not implement "
                    + Directive.class.getName() + "; it cannot be loaded.";
                log.error(msg);
                throw new VelocityException(msg);
            }
        }
        // The ugly threesome:  ClassNotFoundException,
        // IllegalAccessException, InstantiationException.
        // Ignore Findbugs complaint for now.
        catch (Exception e)
        {
            String msg = "Failed to load Directive: " + directiveClass;
            log.error(msg, e);
            throw new VelocityException(msg, e);
        }
    }
View Full Code Here


            {
                String err = "The specified class for ParserPool ("
                    + pp
                    + ") does not exist (or is not accessible to the current classloader.";
                log.error(err);
                throw new VelocityException(err, cnfe);
            }
            catch (InstantiationException ie)
            {
              throw new VelocityException("Could not instantiate class '" + pp + "'", ie);
            }
            catch (IllegalAccessException ae)
            {
              throw new VelocityException("Cannot access class '" + pp + "'", ae);
            }

            if (!(o instanceof ParserPool))
            {
                String err = "The specified class for ParserPool ("
                    + pp + ") does not implement " + ParserPool.class
                    + " Velocity not initialized correctly.";

                log.error(err);
                throw new VelocityException(err);
            }

            parserPool = (ParserPool) o;

            parserPool.initialize(this);
        }
        else
        {
            /*
             *  someone screwed up.  Lets not fool around...
             */

            String err = "It appears that no class was specified as the"
                + " ParserPool.  Please ensure that all configuration"
                + " information is correct.";

            log.error(err);
            throw new VelocityException( err );
        }

    }
View Full Code Here

            }
            catch(Exception e)
            {
                String msg = "RuntimeInstance.render(): init exception for tag = "+logTag;
                getLog().error(msg, e);
                throw new VelocityException(msg, e);
            }

            try
            {
                if (provideEvaluateScope)
                {
                    Object previous = ica.get(evaluateScopeName);
                    context.put(evaluateScopeName, new Scope(this, previous));
                }
                nodeTree.render(ica, writer);
            }
            catch (StopCommand stop)
            {
                if (!stop.isFor(this))
                {
                    throw stop;
                }
                else if (getLog().isDebugEnabled())
                {
                    getLog().debug(stop.getMessage());
                }
            }
            catch (IOException e)
            {
                throw new VelocityException("IO Error in writer: " + e.getMessage(), e);
            }
        }
        finally
        {
            ica.popCurrentTemplateName();
View Full Code Here

        if (!isVelocimacro(vmName, logTag))
        {
            String msg = "RuntimeInstance.invokeVelocimacro() : VM '" + vmName
                         + "' is not registered.";
            getLog().error(msg);
            throw new VelocityException(msg);
        }

        /* now just create the VM call, and use evaluate */
        StrBuilder template = new StrBuilder("#");
        template.append(vmName);
View Full Code Here

        {
            throw new ResourceNotFoundException( "Template not found. ( " + templateDirectory + "/" + template + " )" );
        }
        catch ( VelocityException ve )
        {
            throw new VelocityException( ve.toString() );
        }

        catch ( Exception e )
        {
            if ( e.getCause() != null )
View Full Code Here

    catch (RuntimeException ex) {
      throw ex;
    }
    catch (Exception ex) {
      logger.error("Why does VelocityEngine throw a generic checked exception, after all?", ex);
      throw new VelocityException(ex.toString());
    }
  }
View Full Code Here

    catch (RuntimeException ex) {
      throw ex;
    }
    catch (Exception ex) {
      logger.error("Why does VelocityEngine throw a generic checked exception, after all?", ex);
      throw new VelocityException(ex.toString());
    }
  }
View Full Code Here

      final VelocityContext velocityContext = new VelocityContext(mergeObjects);
      try {
        velocityEngine.mergeTemplate(templatePath, "ISO-8859-1", velocityContext, text);
      }
      catch(final Exception e) {
        throw new VelocityException(e);
      }

      // set the subject
      if(mergeObjects.containsKey(SUBJECT_KEY)) {
        helper.setSubject((String) mergeObjects.get(SUBJECT_KEY));
View Full Code Here

      final VelocityContext velocityContext = new VelocityContext(mergeObjects);
      try {
        velocityEngine.mergeTemplate(templatePath, "ISO-8859-1", velocityContext, text);
      }
      catch(final Exception e) {
        throw new VelocityException(e);
      }

      // set the subject
      if(mergeObjects.containsKey(SUBJECT_KEY)) {
        helper.setSubject((String) mergeObjects.get(SUBJECT_KEY));
View Full Code Here

    catch (RuntimeException ex) {
      throw ex;
    }
    catch (Exception ex) {
      logger.error("Why does VelocityEngine throw a generic checked exception, after all?", ex);
      throw new VelocityException(ex.toString());
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.velocity.exception.VelocityException

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.