Package org.apache.velocity.exception

Examples of org.apache.velocity.exception.MethodInvocationException


                    Object obj = innerContext.get(ref.getRootString());
                    if (obj == null && ref.strictRef)
                    {
                        if (!innerContext.containsKey(ref.getRootString()))
                        {
                            throw new MethodInvocationException("Parameter '" + ref.getRootString()
                                + "' not defined", null, key, ref.getTemplateName(),
                                ref.getLine(), ref.getColumn());
                        }
                    }
                    return obj;
View Full Code Here


        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());
View Full Code Here

                {
                    return ec.methodException( o.getClass(), methodUsed, (Exception)ite.getTargetException() );
                }
                catch( Exception e )
                {
                    throw new MethodInvocationException(
                      "Invocation of method '" + methodUsed + "'"
                      + " in  " + o.getClass()
                      + " threw exception "
                      + ite.getTargetException().getClass(),
                      ite.getTargetException(), methodUsed );
                }
            }
            else
            {
                /*
                 * no event cartridge to override. Just throw
                 */

                throw  new MethodInvocationException(
                "Invocation of method '" + methodUsed + "'"
                + " in  " + o.getClass()
                + " threw exception "
                + ite.getTargetException().getClass(),
                ite.getTargetException(), methodUsed );
View Full Code Here

                {
                    return ec.methodException( o.getClass(), methodName, (Exception)ite.getTargetException() );
                }
                catch( Exception e )
                {
                    throw new MethodInvocationException(
                        "Invocation of method '"
                        + methodName + "' in  " + o.getClass()
                        + " threw exception "
                        + e.getClass(), e, methodName );
                }
            }
            else
            {
                /*
                 * no event cartridge to override. Just throw
                 */

                throw new MethodInvocationException(
                "Invocation of method '"
                + methodName + "' in  " + o.getClass()
                + " threw exception "
                + ite.getTargetException().getClass(),
                ite.getTargetException(), methodName );
View Full Code Here

            /*
             *  the method we invoked threw an exception.
             *  package and pass it up
             */

            throw  new MethodInvocationException(
                "Invocation of method 'get(\"" + args[0] + "\")'"
                + " in  " + o.getClass()
                + " threw exception "
                + ite.getTargetException().getClass(),
                ite.getTargetException(), "get" );
View Full Code Here

        {
            /*
             *  this is possible
             */

            throw  new MethodInvocationException(
                "ASTReference : Invocation of method '"
                + identifier + "' in  " + result.getClass()
                + " threw exception "
                + ite.getTargetException().getClass(),
               ite.getTargetException(), identifier );
View Full Code Here

                    Object obj = innerContext.get(ref.getRootString());
                    if (obj == null && ref.strictRef)
                    {
                        if (!innerContext.containsKey(ref.getRootString()))
                        {
                            throw new MethodInvocationException("Parameter '" + ref.getRootString()
                                + "' not defined", null, key, ref.getTemplateName(),
                                ref.getLine(), ref.getColumn());
                        }
                    }
                    return obj;
View Full Code Here

                {
                    return ec.methodException( o.getClass(), methodUsed, (Exception)ite.getTargetException() );
                }
                catch( Exception e )
                {
                    throw new MethodInvocationException(
                      "Invocation of method '" + methodUsed + "'"
                      + " in  " + o.getClass()
                      + " threw exception "
                      + ite.getTargetException().getClass() + " : "
                      + ite.getTargetException().getMessage(),
                      ite.getTargetException(), methodUsed );
                }
            }
            else
            {
                /*
                 * no event cartridge to override. Just throw
                 */

                throw  new MethodInvocationException(
                "Invocation of method '" + methodUsed + "'"
                + " in  " + o.getClass()
                + " threw exception "
                + ite.getTargetException().getClass() + " : "
                + ite.getTargetException().getMessage(),
View Full Code Here

                {
                    return ec.methodException( o.getClass(), methodName, (Exception)ite.getTargetException() );
                }
                catch( Exception e )
                {
                    throw new MethodInvocationException(
                        "Invocation of method '"
                        + methodName + "' in  " + o.getClass()
                        + " threw exception "
                        + e.getClass() + " : " + e.getMessage(),
                        e, methodName );
                }
            }
            else
            {
                /*
                 * no event cartridge to override. Just throw
                 */

                throw new MethodInvocationException(
                "Invocation of method '"
                + methodName + "' in  " + o.getClass()
                + " threw exception "
                + ite.getTargetException().getClass() + " : "
                + ite.getTargetException().getMessage(),
View Full Code Here

            /*
             *  the method we invoked threw an exception.
             *  package and pass it up
             */

            throw  new MethodInvocationException(
                "Invocation of method 'get(\"" + args[0] + "\")'"
                + " in  " + o.getClass()
                + " threw exception "
                + ite.getTargetException().getClass(),
                ite.getTargetException(), "get" );
View Full Code Here

TOP

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

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.