You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by cj...@apache.org on 2001/04/02 12:53:05 UTC

cvs commit: xml-batik/sources/org/apache/batik/script InterpreterException.java

cjolif      01/04/02 03:53:05

  Modified:    sources/org/apache/batik/script InterpreterException.java
  Log:
  add a getMessage() method to the exception class to better match
  the design guidelines on error handling.
  
  Revision  Changes    Path
  1.3       +17 -1     xml-batik/sources/org/apache/batik/script/InterpreterException.java
  
  Index: InterpreterException.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/InterpreterException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InterpreterException.java	2001/01/24 13:51:55	1.2
  +++ InterpreterException.java	2001/04/02 10:53:04	1.3
  @@ -12,7 +12,7 @@
    * An exception that will be thrown when a problem is encountered in the
    * script by an <code>Interpreter</code> interface implementation.
    * @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
  - * @version $Id: InterpreterException.java,v 1.2 2001/01/24 13:51:55 cjolif Exp $
  + * @version $Id: InterpreterException.java,v 1.3 2001/04/02 10:53:04 cjolif Exp $
    */
   public class InterpreterException extends Exception {
       private int line = -1; // -1 when unknow
  @@ -66,5 +66,21 @@
        */
       public Exception getException() {
           return embedded;
  +    }
  +
  +    /**
  +     * Returns the message of this exception. If an error message has
  +     * been specified, returns that one. Otherwise, return the error message
  +     * of enclosed exception or null if any.
  +     */
  +    public String getMessage() {
  +        String msg = super.getMessage();
  +        if (msg != null) {
  +            return msg;
  +        } else if (embedded != null) {
  +            return embedded.getMessage();
  +        } else {
  +            return null;
  +        }
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org