01: /*
02:
03: Derby - Class org.apache.derby.client.am.BatchUpdateException
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.derby.client.am;
23:
24: import org.apache.derby.iapi.services.info.JVMInfo;
25: import org.apache.derby.shared.common.i18n.MessageUtil;
26: import org.apache.derby.shared.common.error.ExceptionUtil;
27:
28: public class BatchUpdateException extends java.sql.BatchUpdateException {
29:
30: /**
31: * The message utility instance we use to find messages
32: * It's primed with the name of the client message bundle so that
33: * it knows to look there if the message isn't found in the
34: * shared message bundle.
35: */
36: private static MessageUtil msgutil_ = SqlException.getMessageUtil();
37:
38: public BatchUpdateException(LogWriter logWriter,
39: ClientMessageId msgid, Object[] args, int[] updateCounts) {
40: super (msgutil_.getCompleteMessage(msgid.msgid, args),
41: ExceptionUtil.getSQLStateFromIdentifier(msgid.msgid),
42: ExceptionUtil.getSeverityFromIdentifier(msgid.msgid),
43: updateCounts);
44:
45: if (logWriter != null) {
46: logWriter.traceDiagnosable(this );
47: }
48: }
49:
50: // Syntactic sugar constructors to make it easier to create
51: // a BatchUpdateException with substitution parameters
52: public BatchUpdateException(LogWriter logWriter,
53: ClientMessageId msgid, int[] updateCounts) {
54: this (logWriter, msgid, (Object[]) null, updateCounts);
55: }
56:
57: public BatchUpdateException(LogWriter logWriter,
58: ClientMessageId msgid, Object arg1, int[] updateCounts) {
59: this (logWriter, msgid, new Object[] { arg1 }, updateCounts);
60: }
61:
62: //-----------------old constructors - to be removed when i18n is complete
63: //-----------------------------------------------
64:
65: // Temporary constructor until all error keys are defined.
66: public BatchUpdateException(LogWriter logWriter) {
67: this (logWriter, null, null, SqlException.DEFAULT_ERRCODE, null);
68: }
69:
70: // Temporary constructor until all error keys are defined.
71: public BatchUpdateException(LogWriter logWriter, int[] updateCounts) {
72: this (logWriter, null, null, SqlException.DEFAULT_ERRCODE,
73: updateCounts);
74: }
75:
76: // Temporary constructor until all error keys are defined.
77: public BatchUpdateException(LogWriter logWriter, String reason,
78: int[] updateCounts) {
79: this (logWriter, reason, null, SqlException.DEFAULT_ERRCODE,
80: updateCounts);
81: }
82:
83: // Temporary constructor until all error keys are defined.
84: public BatchUpdateException(LogWriter logWriter, String reason,
85: String sqlState, int[] updateCounts) {
86: this (logWriter, reason, sqlState, SqlException.DEFAULT_ERRCODE,
87: updateCounts);
88: }
89:
90: // Temporary constructor until all error keys are defined.
91: public BatchUpdateException(LogWriter logWriter, String reason,
92: String sqlState, int errorCode, int[] updateCounts) {
93: super(reason, sqlState, errorCode, updateCounts);
94: if (logWriter != null) {
95: logWriter.traceDiagnosable(this);
96: }
97: }
98: }
|