Save This Page
Home » openjdk-7 » javax » xml » crypto » dsig » [javadoc | source]
    1   /*
    2    * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
    3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    4    *
    5    * This code is free software; you can redistribute it and/or modify it
    6    * under the terms of the GNU General Public License version 2 only, as
    7    * published by the Free Software Foundation.  Oracle designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Oracle in the LICENSE file that accompanied this code.
   10    *
   11    * This code is distributed in the hope that it will be useful, but WITHOUT
   12    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14    * version 2 for more details (a copy is included in the LICENSE file that
   15    * accompanied this code).
   16    *
   17    * You should have received a copy of the GNU General Public License version
   18    * 2 along with this work; if not, write to the Free Software Foundation,
   19    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20    *
   21    * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22    * or visit www.oracle.com if you need additional information or have any
   23    * questions.
   24    */
   25   /*
   26    * $Id: TransformException.java,v 1.3 2005/05/10 16:03:48 mullan Exp $
   27    */
   28   package javax.xml.crypto.dsig;
   29   
   30   import java.io.PrintStream;
   31   import java.io.PrintWriter;
   32   
   33   /**
   34    * Indicates an exceptional condition that occured while executing a
   35    * transform algorithm.
   36    *
   37    * <p>A <code>TransformException</code> can contain a cause: another
   38    * throwable that caused this <code>TransformException</code> to get thrown.
   39    *
   40    * @see Transform#transform
   41    * @author Sean Mullan
   42    * @author JSR 105 Expert Group
   43    * @since 1.6
   44    */
   45   public class TransformException extends Exception {
   46   
   47       private static final long serialVersionUID = 5082634801360427800L;
   48   
   49       /**
   50        * The throwable that caused this exception to get thrown, or null if this
   51        * exception was not caused by another throwable or if the causative
   52        * throwable is unknown.
   53        *
   54        * @serial
   55        */
   56       private Throwable cause;
   57   
   58       /**
   59        * Constructs a new <code>TransformException</code> with
   60        * <code>null</code> as its detail message.
   61        */
   62       public TransformException() {
   63           super();
   64       }
   65   
   66       /**
   67        * Constructs a new <code>TransformException</code> with the specified
   68        * detail message.
   69        *
   70        * @param message the detail message
   71        */
   72       public TransformException(String message) {
   73           super(message);
   74       }
   75   
   76       /**
   77        * Constructs a new <code>TransformException</code> with the
   78        * specified detail message and cause.
   79        * <p>Note that the detail message associated with
   80        * <code>cause</code> is <i>not</i> automatically incorporated in
   81        * this exception's detail message.
   82        *
   83        * @param message the detail message
   84        * @param cause the cause (A <tt>null</tt> value is permitted, and
   85        *        indicates that the cause is nonexistent or unknown.)
   86        */
   87       public TransformException(String message, Throwable cause) {
   88           super(message);
   89           this.cause = cause;
   90       }
   91   
   92       /**
   93        * Constructs a new <code>TransformException</code> with the specified
   94        * cause and a detail message of
   95        * <code>(cause==null ? null : cause.toString())</code>
   96        * (which typically contains the class and detail message of
   97        * <code>cause</code>).
   98        *
   99        * @param cause the cause (A <tt>null</tt> value is permitted, and
  100        *        indicates that the cause is nonexistent or unknown.)
  101        */
  102       public TransformException(Throwable cause) {
  103           super(cause==null ? null : cause.toString());
  104           this.cause = cause;
  105       }
  106   
  107       /**
  108        * Returns the cause of this <code>TransformException</code> or
  109        * <code>null</code> if the cause is nonexistent or unknown.  (The
  110        * cause is the throwable that caused this
  111        * <code>TransformException</code> to get thrown.)
  112        *
  113        * @return the cause of this <code>TransformException</code> or
  114        *         <code>null</code> if the cause is nonexistent or unknown.
  115        */
  116       public Throwable getCause() {
  117           return cause;
  118       }
  119   
  120       /**
  121        * Prints this <code>TransformException</code>, its backtrace and
  122        * the cause's backtrace to the standard error stream.
  123        */
  124       public void printStackTrace() {
  125           super.printStackTrace();
  126           if (cause != null) {
  127               cause.printStackTrace();
  128           }
  129       }
  130   
  131       /**
  132        * Prints this <code>TransformException</code>, its backtrace and
  133        * the cause's backtrace to the specified print stream.
  134        *
  135        * @param s <code>PrintStream</code> to use for output
  136        */
  137       public void printStackTrace(PrintStream s) {
  138           super.printStackTrace(s);
  139           if (cause != null) {
  140               cause.printStackTrace(s);
  141           }
  142       }
  143   
  144       /**
  145        * Prints this <code>TransformException</code>, its backtrace and
  146        * the cause's backtrace to the specified print writer.
  147        *
  148        * @param s <code>PrintWriter</code> to use for output
  149        */
  150       public void printStackTrace(PrintWriter s) {
  151           super.printStackTrace(s);
  152           if (cause != null) {
  153               cause.printStackTrace(s);
  154           }
  155       }
  156   }

Save This Page
Home » openjdk-7 » javax » xml » crypto » dsig » [javadoc | source]