[jira] Updated: (VELOCITY-414) Extend the MethodInvocation exception to be able to give the velocity macro writer a usefull error page

2006-01-03 Thread Will Glass-Husain (JIRA)
 [ http://issues.apache.org/jira/browse/VELOCITY-414?page=all ]

Will Glass-Husain updated VELOCITY-414:
---

Fix Version: 1.5

 Extend the MethodInvocation exception to be able to give the velocity macro 
 writer a usefull error page
 ---

  Key: VELOCITY-414
  URL: http://issues.apache.org/jira/browse/VELOCITY-414
  Project: Velocity
 Type: Improvement
   Components: Source
 Versions: 1.5, 1.4
 Reporter: Matthijs Lambooy
  Fix For: 1.5


 We use velocity macros that invoke methods in a java written web engine.
 When an invoked method fails because of an exception,  it is not
 possible to use the
 MethodInvocation exception to give the velocity macro writer a usefull
 error page since the MethodInvocation Exception has not cause set.
 So to be short the reason why the method invocation failed can not be
 routed back to the veloticy macro writer on a running system.
 I extended the MethodInvocationException.java and the method execute in
 ASTMethod.java 
 proposed changes in MethodInvocationException.java : 
 ===
 package org.apache.velocity.exception; 
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.parser.Token;
 /*
  * Copyright 2001,2004 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  *  http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 /**
  *  Application-level exception thrown when a reference method is 
  *  invoked and an exception is thrown.
  *  br
  *  When this exception is thrown, a best effort will be made to have
  *  useful information in the exception's message.  For complete 
  *  information, consult the runtime log.
  *
  * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
  * @version $Id: MethodInvocationException.java,v 1.2.14.1 2004/03/03 
 23:22:54 geirm Exp $
  */
 public class MethodInvocationException extends VelocityException
 {
 private String methodName = ;
 private String referenceName = ;
 private Throwable wrapped = null;
 private int line; // Added by CX
 private int column; // Added by CX
 /**
  *  CTOR - wraps the passed in exception for
  *  examination later
  *
  *  @param message 
  *  @param e Throwable that we are wrapping
  *  @param methodName name of method that threw the exception
  */
 public MethodInvocationException( String message, Throwable e, String 
 methodName )
 {
 super(message);
 this.wrapped = e;
 this.methodName = methodName;
 }   
 /**
  *  Returns the name of the method that threw the
  *  exception
  *
  *  @return String name of method
  */
 public String getMethodName()
 {
 return methodName;
 }
 /**
  *  returns the wrapped Throwable that caused this
  *  MethodInvocationException to be thrown
  *  
  *  @return Throwable thrown by method invocation
  */
 public Throwable getWrappedThrowable()
 {
 return wrapped;
 }
 /**
  *  Sets the reference name that threw this exception
  *
  *  @param reference name of reference
  */
 public void setReferenceName( String ref )
 {
 referenceName = ref;
 }
 /**
  *  Retrieves the name of the reference that caused the 
  *  exception
  *
  *  @return name of reference
  */
 public String getReferenceName()
 {
 return referenceName;
 }
 /**
  *  Retrieves the line number where the error occured
  * 
  * @return line number
  */
   public int getLine() 
   {
   return line;
   }
   
 /**
  *  Sets the line number where the error occured
  *
  *  @param line
  */
   public void setLine(int line) 
   {
   this.line = line;
   }
   /**
* Retrieves the line number where the error occured
* 
* @return column number
*/
   public int getColumn() 
   {
   return column;
   }
   /**
*  Sets the column number where the error occured
*  
* @param column
*/
   public void setColumn(int column) 
   {
   this.column = column;
   }
 
 }
 

[jira] Updated: (VELOCITY-414) Extend the MethodInvocation exception to be able to give the velocity macro writer a usefull error page

2005-11-21 Thread Matthijs Lambooy (JIRA)
 [ http://issues.apache.org/jira/browse/VELOCITY-414?page=all ]

Matthijs Lambooy updated VELOCITY-414:
--

Version: 1.5

 Extend the MethodInvocation exception to be able to give the velocity macro 
 writer a usefull error page
 ---

  Key: VELOCITY-414
  URL: http://issues.apache.org/jira/browse/VELOCITY-414
  Project: Velocity
 Type: Improvement
   Components: Source
 Versions: 1.5, 1.4
 Reporter: Matthijs Lambooy


 We use velocity macros that invoke methods in a java written web engine.
 When an invoked method fails because of an exception,  it is not
 possible to use the
 MethodInvocation exception to give the velocity macro writer a usefull
 error page since the MethodInvocation Exception has not cause set.
 So to be short the reason why the method invocation failed can not be
 routed back to the veloticy macro writer on a running system.
 I extended the MethodInvocationException.java and the method execute in
 ASTMethod.java 
 proposed changes in MethodInvocationException.java : 
 ===
 package org.apache.velocity.exception; 
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.parser.Token;
 /*
  * Copyright 2001,2004 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  *  http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 /**
  *  Application-level exception thrown when a reference method is 
  *  invoked and an exception is thrown.
  *  br
  *  When this exception is thrown, a best effort will be made to have
  *  useful information in the exception's message.  For complete 
  *  information, consult the runtime log.
  *
  * @author a href=mailto:[EMAIL PROTECTED]Geir Magnusson Jr./a
  * @version $Id: MethodInvocationException.java,v 1.2.14.1 2004/03/03 
 23:22:54 geirm Exp $
  */
 public class MethodInvocationException extends VelocityException
 {
 private String methodName = ;
 private String referenceName = ;
 private Throwable wrapped = null;
 private int line; // Added by CX
 private int column; // Added by CX
 /**
  *  CTOR - wraps the passed in exception for
  *  examination later
  *
  *  @param message 
  *  @param e Throwable that we are wrapping
  *  @param methodName name of method that threw the exception
  */
 public MethodInvocationException( String message, Throwable e, String 
 methodName )
 {
 super(message);
 this.wrapped = e;
 this.methodName = methodName;
 }   
 /**
  *  Returns the name of the method that threw the
  *  exception
  *
  *  @return String name of method
  */
 public String getMethodName()
 {
 return methodName;
 }
 /**
  *  returns the wrapped Throwable that caused this
  *  MethodInvocationException to be thrown
  *  
  *  @return Throwable thrown by method invocation
  */
 public Throwable getWrappedThrowable()
 {
 return wrapped;
 }
 /**
  *  Sets the reference name that threw this exception
  *
  *  @param reference name of reference
  */
 public void setReferenceName( String ref )
 {
 referenceName = ref;
 }
 /**
  *  Retrieves the name of the reference that caused the 
  *  exception
  *
  *  @return name of reference
  */
 public String getReferenceName()
 {
 return referenceName;
 }
 /**
  *  Retrieves the line number where the error occured
  * 
  * @return line number
  */
   public int getLine() 
   {
   return line;
   }
   
 /**
  *  Sets the line number where the error occured
  *
  *  @param line
  */
   public void setLine(int line) 
   {
   this.line = line;
   }
   /**
* Retrieves the line number where the error occured
* 
* @return column number
*/
   public int getColumn() 
   {
   return column;
   }
   /**
*  Sets the column number where the error occured
*  
* @param column
*/
   public void setColumn(int column) 
   {
   this.column = column;
   }
 
 }
 ===
 Proposed