Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge pull from master to dev #3

Merged
merged 10 commits into from
Apr 11, 2017
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ We hope you enjoy using the Microsoft JDBC Driver for SQL Server.

SQL Server Team

## Take our survey

Let us know more about your how you program with Java.

<a href="https://www.surveymonkey.com/r/RS29KQ8"><img style="float: right;" height="67" width="156" src="https://meetsstorenew.blob.core.windows.net/contianerhd/survey.png?st=2017-02-17T22%3A03%3A00Z&se=2100-02-18T22%3A03%3A00Z&sp=rl&sv=2015-12-11&sr=b&sig=DJSFoihBptSvO%2BjvWzwpHecf8o5yfAbJoD2qW5oB8tc%3D"></a>

## Status of Most Recent Builds
| AppVeyor (Windows) | Travis CI (Linux) |
|--------------------------|--------------------------|
Expand Down
88 changes: 44 additions & 44 deletions src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ final void setDriverErrorCode(int value) {

/**
* Log an exception to the driver log file
*
*
* @param o
* the io buffer that generated the exception
* @param errText
Expand All @@ -91,8 +91,8 @@ final void setDriverErrorCode(int value) {
* true to generate the stack trace
*/
/* L0 */ private void logException(Object o,
String errText,
boolean bStack) {
String errText,
boolean bStack) {
String id = "";
if (o != null)
id = o.toString();
Expand Down Expand Up @@ -123,7 +123,7 @@ static String getErrString(String errCode) {

/**
* Make a new SQLException
*
*
* @param errText
* the excception message
* @param errState
Expand All @@ -132,44 +132,44 @@ static String getErrString(String errCode) {
* @param cause
* The exception that caused this exception
*/
SQLServerException(String errText,
SQLState sqlState,
DriverError driverError,
Throwable cause) {
public SQLServerException(String errText,
SQLState sqlState,
DriverError driverError,
Throwable cause) {
this(errText, sqlState.getSQLStateCode(), driverError.getErrorCode(), cause);
}

SQLServerException(String errText,
String errState,
int errNum,
Throwable cause) {
public SQLServerException(String errText,
String errState,
int errNum,
Throwable cause) {
super(errText, errState, errNum);
initCause(cause);
logException(null, errText, true);
ActivityCorrelator.setCurrentActivityIdSentFlag(); // set the activityid flag so that we don't send the current ActivityId later.
}

SQLServerException(String errText,
Throwable cause) {
public SQLServerException(String errText,
Throwable cause) {
super(errText);
initCause(cause);
logException(null, errText, true);
ActivityCorrelator.setCurrentActivityIdSentFlag();
}

/* L0 */ SQLServerException(Object obj,
String errText,
String errState,
int errNum,
boolean bStack) {
/* L0 */ public SQLServerException(Object obj,
String errText,
String errState,
int errNum,
boolean bStack) {
super(errText, errState, errNum);
logException(obj, errText, bStack);
ActivityCorrelator.setCurrentActivityIdSentFlag();
}

/**
* Make a new SQLException
*
*
* @param obj
* @param errText
* the exception message
Expand All @@ -180,11 +180,11 @@ static String getErrString(String errCode) {
* @param bStack
* true to generate the stack trace
*/
/* L0 */ SQLServerException(Object obj,
String errText,
String errState,
StreamError streamError,
boolean bStack) {
/* L0 */ public SQLServerException(Object obj,
String errText,
String errState,
StreamError streamError,
boolean bStack) {
super(errText, errState, streamError.getErrorNumber());

// Log SQL error with info from StreamError.
Expand All @@ -195,7 +195,7 @@ static String getErrString(String errCode) {

/**
* Build a new SQL Exception from an error detected by the driver.
*
*
* @param con
* the connection
* @param obj
Expand All @@ -208,10 +208,10 @@ static String getErrString(String errCode) {
* @throws SQLServerException
*/
/* L0 */static void makeFromDriverError(SQLServerConnection con,
Object obj,
String errText,
String state,
boolean bStack) throws SQLServerException {
Object obj,
String errText,
String state,
boolean bStack) throws SQLServerException {
// The sql error code is 0 since the error was not returned from the database
// The state code is supplied by the calling code as XOPEN compliant.
// XOPEN is used as the primary code here since they are published free
Expand All @@ -237,7 +237,7 @@ static String getErrString(String errCode) {

/**
* Build a new SQL Exception from a streamError detected by the driver.
*
*
* @param con
* the connection
* @param obj
Expand All @@ -249,10 +249,10 @@ static String getErrString(String errCode) {
* @throws SQLServerException
*/
/* L0 */ static void makeFromDatabaseError(SQLServerConnection con,
Object obj,
String errText,
StreamError streamError,
boolean bStack) throws SQLServerException {
Object obj,
String errText,
StreamError streamError,
boolean bStack) throws SQLServerException {
String state = generateStateCode(con, streamError.getErrorNumber(), streamError.getErrorState());

SQLServerException theException = new SQLServerException(obj, SQLServerException.checkAndAppendClientConnId(errText, con), state, streamError,
Expand All @@ -270,9 +270,9 @@ static String getErrString(String errCode) {

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

/**
* Map XOPEN states.
*
*
* @param state
* the state
* @return the mapped state
Expand Down Expand Up @@ -316,7 +316,7 @@ static void ConvertConnectExceptionToSQLServerException(String hostName,

/**
* Generate the JDBC state code based on the error number returned from the database
*
*
* @param con
* the connection
* @param errNum
Expand All @@ -326,8 +326,8 @@ static void ConvertConnectExceptionToSQLServerException(String hostName,
* @return the state code
*/
/* L0 */ static String generateStateCode(SQLServerConnection con,
int errNum,
int databaseState) {
int errNum,
int databaseState) {
// Generate a SQL 99 or XOPEN state from a database generated error code
boolean xopenStates = (con != null && con.xopenStates);
if (xopenStates) {
Expand Down Expand Up @@ -372,15 +372,15 @@ static void ConvertConnectExceptionToSQLServerException(String hostName,

/**
* Append ClientConnectionId to an error message if applicable
*
*
* @param errMsg
* - the orginal error message.
* @param conn
* - the SQLServerConnection object
* @return error string concated by ClientConnectionId(in string format) if applicable, otherwise, return original error string.
*/
static String checkAndAppendClientConnId(String errMsg,
SQLServerConnection conn) throws SQLServerException {
SQLServerConnection conn) throws SQLServerException {
if (null != conn && conn.attachConnId()) {
UUID clientConnId = conn.getClientConIdInternal();
assert null != clientConnId;
Expand Down