~ubuntu-branches/ubuntu/gutsy/libjaxp1.3-java/gutsy

« back to all changes in this revision

Viewing changes to javax/xml/transform/TransformerFactoryConfigurationError.java

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2006-08-03 10:30:58 UTC
  • Revision ID: james.westby@ubuntu.com-20060803103058-7jwwiqv9g8w9094d
Tags: upstream-1.3.03
ImportĀ upstreamĀ versionĀ 1.3.03

Show diffs side-by-side

added added

removed removed

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