Skip to content

Commit 80a7984

Browse files
committed
Make SQLServerException constructors public so that interfaces like ISQLServerBulk record can be implemented outside of the package.
1 parent abf2e1b commit 80a7984

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java

+39-39
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ final void setDriverErrorCode(int value) {
8282

8383
/**
8484
* Log an exception to the driver log file
85-
*
85+
*
8686
* @param o
8787
* the io buffer that generated the exception
8888
* @param errText
@@ -91,8 +91,8 @@ final void setDriverErrorCode(int value) {
9191
* true to generate the stack trace
9292
*/
9393
/* L0 */ private void logException(Object o,
94-
String errText,
95-
boolean bStack) {
94+
String errText,
95+
boolean bStack) {
9696
String id = "";
9797
if (o != null)
9898
id = o.toString();
@@ -123,7 +123,7 @@ static String getErrString(String errCode) {
123123

124124
/**
125125
* Make a new SQLException
126-
*
126+
*
127127
* @param errText
128128
* the excception message
129129
* @param errState
@@ -133,43 +133,43 @@ static String getErrString(String errCode) {
133133
* The exception that caused this exception
134134
*/
135135
public SQLServerException(String errText,
136-
SQLState sqlState,
137-
DriverError driverError,
138-
Throwable cause) {
136+
SQLState sqlState,
137+
DriverError driverError,
138+
Throwable cause) {
139139
this(errText, sqlState.getSQLStateCode(), driverError.getErrorCode(), cause);
140140
}
141141

142142
public SQLServerException(String errText,
143-
String errState,
144-
int errNum,
145-
Throwable cause) {
143+
String errState,
144+
int errNum,
145+
Throwable cause) {
146146
super(errText, errState, errNum);
147147
initCause(cause);
148148
logException(null, errText, true);
149149
ActivityCorrelator.setCurrentActivityIdSentFlag(); // set the activityid flag so that we don't send the current ActivityId later.
150150
}
151151

152152
public SQLServerException(String errText,
153-
Throwable cause) {
153+
Throwable cause) {
154154
super(errText);
155155
initCause(cause);
156156
logException(null, errText, true);
157157
ActivityCorrelator.setCurrentActivityIdSentFlag();
158158
}
159159

160160
/* L0 */ public SQLServerException(Object obj,
161-
String errText,
162-
String errState,
163-
int errNum,
164-
boolean bStack) {
161+
String errText,
162+
String errState,
163+
int errNum,
164+
boolean bStack) {
165165
super(errText, errState, errNum);
166166
logException(obj, errText, bStack);
167167
ActivityCorrelator.setCurrentActivityIdSentFlag();
168168
}
169169

170170
/**
171171
* Make a new SQLException
172-
*
172+
*
173173
* @param obj
174174
* @param errText
175175
* the exception message
@@ -181,10 +181,10 @@ public SQLServerException(String errText,
181181
* true to generate the stack trace
182182
*/
183183
/* L0 */ public SQLServerException(Object obj,
184-
String errText,
185-
String errState,
186-
StreamError streamError,
187-
boolean bStack) {
184+
String errText,
185+
String errState,
186+
StreamError streamError,
187+
boolean bStack) {
188188
super(errText, errState, streamError.getErrorNumber());
189189

190190
// Log SQL error with info from StreamError.
@@ -195,7 +195,7 @@ public SQLServerException(String errText,
195195

196196
/**
197197
* Build a new SQL Exception from an error detected by the driver.
198-
*
198+
*
199199
* @param con
200200
* the connection
201201
* @param obj
@@ -208,10 +208,10 @@ public SQLServerException(String errText,
208208
* @throws SQLServerException
209209
*/
210210
/* L0 */static void makeFromDriverError(SQLServerConnection con,
211-
Object obj,
212-
String errText,
213-
String state,
214-
boolean bStack) throws SQLServerException {
211+
Object obj,
212+
String errText,
213+
String state,
214+
boolean bStack) throws SQLServerException {
215215
// The sql error code is 0 since the error was not returned from the database
216216
// The state code is supplied by the calling code as XOPEN compliant.
217217
// XOPEN is used as the primary code here since they are published free
@@ -237,7 +237,7 @@ public SQLServerException(String errText,
237237

238238
/**
239239
* Build a new SQL Exception from a streamError detected by the driver.
240-
*
240+
*
241241
* @param con
242242
* the connection
243243
* @param obj
@@ -249,10 +249,10 @@ public SQLServerException(String errText,
249249
* @throws SQLServerException
250250
*/
251251
/* L0 */ static void makeFromDatabaseError(SQLServerConnection con,
252-
Object obj,
253-
String errText,
254-
StreamError streamError,
255-
boolean bStack) throws SQLServerException {
252+
Object obj,
253+
String errText,
254+
StreamError streamError,
255+
boolean bStack) throws SQLServerException {
256256
String state = generateStateCode(con, streamError.getErrorNumber(), streamError.getErrorState());
257257

258258
SQLServerException theException = new SQLServerException(obj, SQLServerException.checkAndAppendClientConnId(errText, con), state, streamError,
@@ -270,9 +270,9 @@ public SQLServerException(String errText,
270270

271271
// This code is same as the conversion logic that previously existed in connecthelper.
272272
static void ConvertConnectExceptionToSQLServerException(String hostName,
273-
int portNumber,
274-
SQLServerConnection conn,
275-
Exception ex) throws SQLServerException {
273+
int portNumber,
274+
SQLServerConnection conn,
275+
Exception ex) throws SQLServerException {
276276
Exception connectException = ex;
277277
// Throw the exception if exception was caught by code above (stored in connectException).
278278
if (connectException != null) {
@@ -287,7 +287,7 @@ static void ConvertConnectExceptionToSQLServerException(String hostName,
287287

288288
/**
289289
* Map XOPEN states.
290-
*
290+
*
291291
* @param state
292292
* the state
293293
* @return the mapped state
@@ -316,7 +316,7 @@ static void ConvertConnectExceptionToSQLServerException(String hostName,
316316

317317
/**
318318
* Generate the JDBC state code based on the error number returned from the database
319-
*
319+
*
320320
* @param con
321321
* the connection
322322
* @param errNum
@@ -326,8 +326,8 @@ static void ConvertConnectExceptionToSQLServerException(String hostName,
326326
* @return the state code
327327
*/
328328
/* L0 */ static String generateStateCode(SQLServerConnection con,
329-
int errNum,
330-
int databaseState) {
329+
int errNum,
330+
int databaseState) {
331331
// Generate a SQL 99 or XOPEN state from a database generated error code
332332
boolean xopenStates = (con != null && con.xopenStates);
333333
if (xopenStates) {
@@ -372,15 +372,15 @@ static void ConvertConnectExceptionToSQLServerException(String hostName,
372372

373373
/**
374374
* Append ClientConnectionId to an error message if applicable
375-
*
375+
*
376376
* @param errMsg
377377
* - the orginal error message.
378378
* @param conn
379379
* - the SQLServerConnection object
380380
* @return error string concated by ClientConnectionId(in string format) if applicable, otherwise, return original error string.
381381
*/
382382
static String checkAndAppendClientConnId(String errMsg,
383-
SQLServerConnection conn) throws SQLServerException {
383+
SQLServerConnection conn) throws SQLServerException {
384384
if (null != conn && conn.attachConnId()) {
385385
UUID clientConnId = conn.getClientConIdInternal();
386386
assert null != clientConnId;

0 commit comments

Comments
 (0)