KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > unitTests > services > T_StandardException


1 /*
2
3    Derby - Class org.apache.derbyTesting.unitTests.services.T_StandardException
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derbyTesting.unitTests.services;
23
24 import org.apache.derby.iapi.error.StandardException;
25
26 import java.text.MessageFormat JavaDoc;
27 /**
28   A standard exception for testing.
29
30   The messages for this exception are not localized or stored
31   with the product.
32  */

33 public class T_StandardException extends StandardException
34 {
35     String JavaDoc msgText = "Message text not set";
36
37     protected T_StandardException(String JavaDoc messageID, String JavaDoc msgText)
38     {
39         super(messageID);
40         myConstructorCommon( messageID, msgText );
41     }
42     protected T_StandardException(String JavaDoc messageID, String JavaDoc msgText, Throwable JavaDoc t)
43     {
44         super(messageID, t, (Object JavaDoc[]) null);
45         myConstructorCommon( messageID, msgText );
46     }
47     protected T_StandardException(String JavaDoc messageID, String JavaDoc msgText, Throwable JavaDoc t, Object JavaDoc[] args)
48     {
49         super(messageID, t, args);
50         myConstructorCommon( messageID, msgText );
51     }
52
53     protected void myConstructorCommon( String JavaDoc messageID, String JavaDoc msgText )
54     {
55         this.msgText = msgText;
56     }
57
58     public static
59     StandardException newT_StandardException(String JavaDoc messageID, Throwable JavaDoc t, String JavaDoc msgText)
60     {
61         return new T_StandardException(messageID,msgText,t);
62     }
63
64     public static
65     StandardException newT_StandardException(String JavaDoc messageID, String JavaDoc msgText)
66     {
67         return new T_StandardException(messageID,msgText);
68     }
69
70     public String JavaDoc getMessage() {return MessageFormat.format(msgText, getArguments());}
71     public String JavaDoc getErrorProperty() {throw new Error JavaDoc("method not supported");}
72 }
73
Popular Tags