Package org.apache.velocity.exception

Examples of org.apache.velocity.exception.VelocityException


                }
                catch (Exception e)
                {
                    String msg = "ProxyVMContext.get() : error rendering reference";
                    rsvc.getLog().error(msg, e);
                    throw new VelocityException(msg, e);
                }
            }
            else
            {
                // use value method to render other dynamic nodes
View Full Code Here


                    {
                        return (Iterator)iter.invoke(obj, null);
                    }
                    catch (Exception e)
                    {
                        throw new VelocityException("Error invoking the method 'iterator' on class '"
                            + obj.getClass().getName() +"'", e);
                    }
                }
                else
                {
View Full Code Here

            catch (IOException e)
            {
                String msg = "Error in interpolating string literal";
                log.error(msg, e);
                throw new VelocityException(msg, e);
            }

        }

        /*
 
View Full Code Here

        }
        catch(Exception e)
        {
            String msg = "ASTIdentifier.execute() : identifier = "+identifier;
            log.error(msg, e);
            throw new VelocityException(msg, e);
        }

        /*
         *  we have no getter... punt...
         */

        if (vg == null)
        {
            if (strictRef)
            {
                throw new MethodInvocationException("Object '" + o.getClass().getName() +             
                    "' does not contain property '" + identifier + "'", null, identifier,
                    uberInfo.getTemplateName(), uberInfo.getLine(), uberInfo.getColumn());
            }
            else
            {
                return null;
            }
        }

        /*
         *  now try and execute.  If we get a MIE, throw that
         *  as the app wants to get these.  If not, log and punt.
         */
        try
        {
            return vg.invoke(o);
        }
        catch(InvocationTargetException ite)
        {
            /*
             *  if we have an event cartridge, see if it wants to veto
             *  also, let non-Exception Throwables go...
             */

            Throwable t = ite.getTargetException();
            if (t instanceof Exception)
            {
                try
                {
                    return EventHandlerUtil.methodException(rsvc, context, o.getClass(), vg.getMethodName(),
                            (Exception) t);
                }

                /**
                 * If the event handler throws an exception, then wrap it
                 * in a MethodInvocationException.  Don't pass through RuntimeExceptions like other
                 * similar catchall code blocks.
                 */
                catch( Exception e )
                {
                    throw new MethodInvocationException(
                      "Invocation of method '" + vg.getMethodName() + "'"
                      + " in  " + o.getClass()
                      + " threw exception "
                      + ite.getTargetException().toString(),
                      ite.getTargetException(), vg.getMethodName(), getTemplateName(), this.getLine(), this.getColumn());
                }
            }
            else
            {
                /*
                 * no event cartridge to override. Just throw
                 */

                throw  new MethodInvocationException(
                "Invocation of method '" + vg.getMethodName() + "'"
                + " in  " + o.getClass()
                + " threw exception "
                + ite.getTargetException().toString(),
                ite.getTargetException(), vg.getMethodName(), getTemplateName(), this.getLine(), this.getColumn());


            }
        }
        catch(IllegalArgumentException iae)
        {
            return null;
        }
        /**
         * pass through application level runtime exceptions
         */
        catch( RuntimeException e )
        {
            throw e;
        }
        catch(Exception e)
        {
            String msg = "ASTIdentifier() : exception invoking method "
                        + "for identifier '" + identifier + "' in "
                        + o.getClass();
            log.error(msg, e);
            throw new VelocityException(msg, e);
        }
    }
View Full Code Here

        catch (Exception e)
        {
            isCachingOn = false;
            String msg = "Exception parsing cache setting: "+configuration.getString("cache");
            log.error(msg, e);
            throw new VelocityException(msg, e);
        }
        try
        {
            modificationCheckInterval = configuration.getLong("modificationCheckInterval", 0);
        }
        catch (Exception e)
        {
            modificationCheckInterval = 0;
            String msg = "Exception parsing modificationCheckInterval setting: "+configuration.getString("modificationCheckInterval");
            log.error(msg, e);
            throw new VelocityException(msg, e);
        }

        /*
         * this is a must!
         */
        className = ResourceCacheImpl.class.getName();
        try
        {
            className = configuration.getString("class", className);
        }
        catch (Exception e)
        {
            String msg = "Exception retrieving resource cache class name";
            log.error(msg, e);
            throw new VelocityException(msg, e);
        }
    }
View Full Code Here

                if (log.isErrorEnabled())
                {
                    String msg = "While closing InputStream for resource '" + resourceName
                        + "' from ResourceLoader "+this.getClass().getName();
                    log.error(msg, e);
                    throw new VelocityException(msg, e);
                }
            }
        }
        return (is != null);
    }
View Full Code Here

        {
            String msg = "Problem instantiating the template loader: "+loaderClassName+".\n" +
                         "Look at your properties file and make sure the\n" +
                         "name of the template loader is correct.";
            rs.getLog().error(msg, e);
            throw new VelocityException(msg, e);
        }
    }
View Full Code Here

                String msg = "invalid #include() argument '"
                  + n.toString() + "' at " + Log.formatFileString(this);
                rsvc.getLog().error(msg);
                outputErrorToStream( writer, "error with arg " + i
                    + " please see log.");
                throw new VelocityException(msg);
            }
        }

        return true;
    }
View Full Code Here

        catch (Exception e)
        {
            String msg = "#include(): arg = '" + arg +
                        "', called at " + Log.formatFileString(this);
            rsvc.getLog().error(msg, e);
            throw new VelocityException(msg, e);
        }


        /*
         *    note - a blocked input is still a successful operation as this is
View Full Code Here

            }
            catch (IOException ioe)
            {
                String msg = "Exception while loading Template " + template;
                log.error(msg, ioe);
                throw new VelocityException(msg, ioe);
            }

            if (inputStream != null)
            {
                /*
 
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.