01: /*
02:
03: Derby - Class org.apache.derbyTesting.unitTests.services.T_StandardException
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to You under the Apache License, Version 2.0
09: (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;
27:
28: /**
29: A standard exception for testing.
30:
31: The messages for this exception are not localized or stored
32: with the product.
33: */
34: public class T_StandardException extends StandardException {
35: String msgText = "Message text not set";
36:
37: protected T_StandardException(String messageID, String msgText) {
38: super (messageID);
39: myConstructorCommon(messageID, msgText);
40: }
41:
42: protected T_StandardException(String messageID, String msgText,
43: Throwable t) {
44: super (messageID, t, (Object[]) null);
45: myConstructorCommon(messageID, msgText);
46: }
47:
48: protected T_StandardException(String messageID, String msgText,
49: Throwable t, Object[] args) {
50: super (messageID, t, args);
51: myConstructorCommon(messageID, msgText);
52: }
53:
54: protected void myConstructorCommon(String messageID, String msgText) {
55: this .msgText = msgText;
56: }
57:
58: public static StandardException newT_StandardException(
59: String messageID, Throwable t, String msgText) {
60: return new T_StandardException(messageID, msgText, t);
61: }
62:
63: public static StandardException newT_StandardException(
64: String messageID, String msgText) {
65: return new T_StandardException(messageID, msgText);
66: }
67:
68: public String getMessage() {
69: return MessageFormat.format(msgText, getArguments());
70: }
71:
72: public String getErrorProperty() {
73: throw new Error("method not supported");
74: }
75: }
|