Save This Page
Home » openjdk-7 » javax » xml » parsers » [javadoc | source]
    1   /*
    2    * Copyright 2000-2005 Sun Microsystems, Inc.  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.  Sun designates this
    8    * particular file as subject to the "Classpath" exception as provided
    9    * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   22    * CA 95054 USA or visit www.sun.com if you need additional information or
   23    * have any questions.
   24    */
   25   
   26   package javax.xml.parsers;
   27   
   28   /**
   29    * Thrown when a problem with configuration with the Parser Factories
   30    * exists. This error will typically be thrown when the class of a
   31    * parser factory specified in the system properties cannot be found
   32    * or instantiated.
   33    *
   34    * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
   35    */
   36   
   37   public class FactoryConfigurationError extends Error {
   38   
   39       /**
   40        *<code>Exception</code> that represents the error.
   41        */
   42       private Exception exception;
   43   
   44       /**
   45        * Create a new <code>FactoryConfigurationError</code> with no
   46        * detail mesage.
   47        */
   48   
   49       public FactoryConfigurationError() {
   50           super();
   51           this.exception = null;
   52       }
   53   
   54       /**
   55        * Create a new <code>FactoryConfigurationError</code> with
   56        * the <code>String </code> specified as an error message.
   57        *
   58        * @param msg The error message for the exception.
   59        */
   60   
   61       public FactoryConfigurationError(String msg) {
   62           super(msg);
   63           this.exception = null;
   64       }
   65   
   66   
   67       /**
   68        * Create a new <code>FactoryConfigurationError</code> with a
   69        * given <code>Exception</code> base cause of the error.
   70        *
   71        * @param e The exception to be encapsulated in a
   72        * FactoryConfigurationError.
   73        */
   74   
   75       public FactoryConfigurationError(Exception e) {
   76           super(e.toString());
   77           this.exception = e;
   78       }
   79   
   80       /**
   81        * Create a new <code>FactoryConfigurationError</code> with the
   82        * given <code>Exception</code> base cause and detail message.
   83        *
   84        * @param e The exception to be encapsulated in a
   85        * FactoryConfigurationError
   86        * @param msg The detail message.
   87        */
   88   
   89       public FactoryConfigurationError(Exception e, String msg) {
   90           super(msg);
   91           this.exception = e;
   92       }
   93   
   94   
   95       /**
   96        * Return the message (if any) for this error . If there is no
   97        * message for the exception and there is an encapsulated
   98        * exception then the message of that exception, if it exists will be
   99        * returned. Else the name of the encapsulated exception will be
  100        * returned.
  101        *
  102        * @return The error message.
  103        */
  104   
  105       public String getMessage () {
  106           String message = super.getMessage ();
  107   
  108           if (message == null && exception != null) {
  109               return exception.getMessage();
  110           }
  111   
  112           return message;
  113       }
  114   
  115       /**
  116        * Return the actual exception (if any) that caused this exception to
  117        * be raised.
  118        *
  119        * @return The encapsulated exception, or null if there is none.
  120        */
  121   
  122       public Exception getException () {
  123           return exception;
  124       }
  125   }

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