Home » xml-commons-external-1.4.01-src » javax » xml » parsers » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   
   18   // $Id: FactoryConfigurationError.java 569980 2007-08-27 03:58:15Z mrglavas $
   19   
   20   package javax.xml.parsers;
   21   
   22   /**
   23    * Thrown when a problem with configuration with the Parser Factories
   24    * exists. This error will typically be thrown when the class of a
   25    * parser factory specified in the system properties cannot be found
   26    * or instantiated.
   27    *
   28    * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
   29    * @version $Revision: 569980 $, $Date: 2007-08-26 23:58:15 -0400 (Sun, 26 Aug 2007) $
   30    */
   31   
   32   public class FactoryConfigurationError extends Error {
   33   
   34       /**
   35        *<code>Exception</code> that represents the error.
   36        */
   37       private Exception exception;
   38   
   39       /**
   40        * Create a new <code>FactoryConfigurationError</code> with no
   41        * detail message.
   42        */
   43   
   44       public FactoryConfigurationError() {
   45           super();
   46           this.exception = null;
   47       }
   48   
   49       /**
   50        * Create a new <code>FactoryConfigurationError</code> with
   51        * the <code>String </code> specified as an error message.
   52        *
   53        * @param msg The error message for the exception.
   54        */
   55       
   56       public FactoryConfigurationError(String msg) {
   57           super(msg);
   58           this.exception = null;
   59       }
   60   
   61   
   62       /**
   63        * Create a new <code>FactoryConfigurationError</code> with a
   64        * given <code>Exception</code> base cause of the error.
   65        *
   66        * @param e The exception to be encapsulated in a
   67        * FactoryConfigurationError.
   68        */
   69       
   70       public FactoryConfigurationError(Exception e) {
   71           super(e.toString());
   72           this.exception = e;
   73       }
   74   
   75       /**
   76        * Create a new <code>FactoryConfigurationError</code> with the
   77        * given <code>Exception</code> base cause and detail message.
   78        *
   79        * @param e The exception to be encapsulated in a
   80        * FactoryConfigurationError
   81        * @param msg The detail message.
   82        */
   83       
   84       public FactoryConfigurationError(Exception e, String msg) {
   85           super(msg);
   86           this.exception = e;
   87       }
   88   
   89   
   90       /**
   91        * Return the message (if any) for this error . If there is no
   92        * message for the exception and there is an encapsulated
   93        * exception then the message of that exception, if it exists will be 
   94        * returned. Else the name of the encapsulated exception will be
   95        * returned.
   96        *
   97        * @return The error message.
   98        */
   99       
  100       public String getMessage () {
  101           String message = super.getMessage ();
  102     
  103           if (message == null && exception != null) {
  104               return exception.getMessage();
  105           }
  106   
  107           return message;
  108       }
  109     
  110       /**
  111        * Return the actual exception (if any) that caused this exception to
  112        * be raised.
  113        *
  114        * @return The encapsulated exception, or null if there is none.
  115        */
  116       
  117       public Exception getException () {
  118           return exception;
  119       }
  120   }

Home » xml-commons-external-1.4.01-src » javax » xml » parsers » [javadoc | source]