diff --git a/pom.xml b/pom.xml index 58aa5d4ab..1caec83f8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java b/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java index 77891c37b..2fa7d0afe 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java @@ -232,7 +232,7 @@ static final Object convertFloatToObject(float floatVal, return new BigDecimal(Float.toString(floatVal)); case FLOAT: case DOUBLE: - return (new Float(floatVal)).doubleValue(); + return ((Float)floatVal).doubleValue(); case BINARY: return convertIntToBytes(Float.floatToRawIntBits(floatVal), 4); default: @@ -275,7 +275,7 @@ static final Object convertDoubleToObject(double doubleVal, case DOUBLE: return doubleVal; case REAL: - return (new Double(doubleVal)).floatValue(); + return ((Double)doubleVal).floatValue(); case INTEGER: return (int) doubleVal; case SMALLINT: // small and tinyint returned as short @@ -439,7 +439,7 @@ private static byte[] convertToBytes(BigDecimal value, } } int offset = numBytes - unscaledBytes.length; - System.arraycopy(unscaledBytes, offset - offset, ret, offset, numBytes - offset); + System.arraycopy(unscaledBytes, 0, ret, offset, numBytes - offset); return ret; } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java b/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java index d87a9cb14..d6b28a14a 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java @@ -670,7 +670,7 @@ void disableSSL() { * The mission: To close the SSLSocket and release everything that it is holding onto other than the TCP/IP socket and streams. * * The challenge: Simply closing the SSLSocket tries to do additional, unnecessary shutdown I/O over the TCP/IP streams that are bound to the - * socket proxy, resulting in a hang and confusing SQL Server. + * socket proxy, resulting in a not responding and confusing SQL Server. * * Solution: Rewire the ProxySocket's input and output streams (one more time) to closed streams. SSLSocket sees that the streams are already * closed and does not attempt to do any further I/O on them before closing itself. @@ -1870,13 +1870,11 @@ private void validateFips(final String trustStoreType, if (isEncryptOn && !isTrustServerCertificate) { isValid = true; - if (isValidTrustStore) { - // In case of valid trust store we need to check TrustStoreType. - if (!isValidTrustStoreType) { - isValid = false; - if (logger.isLoggable(Level.FINER)) - logger.finer(toString() + "TrustStoreType is required alongside with TrustStore."); - } + if (isValidTrustStore && !isValidTrustStoreType) { + // In case of valid trust store we need to check TrustStoreType. + isValid = false; + if (logger.isLoggable(Level.FINER)) + logger.finer(toString() + "TrustStoreType is required alongside with TrustStore."); } } @@ -2547,7 +2545,7 @@ private void findSocketUsingJavaNIO(InetAddress[] inetAddrs, + " occured while processing the channel: " + ch); updateSelectedException(ex, this.toString()); // close the channel pro-actively so that we do not - // hang on to network resources + // rely to network resources ch.close(); } @@ -2894,11 +2892,8 @@ void updateResult(Socket socket, public void updateSelectedException(IOException ex, String traceId) { boolean updatedException = false; - if (selectedException == null) { - selectedException = ex; - updatedException = true; - } - else if ((!(ex instanceof SocketTimeoutException)) && (selectedException instanceof SocketTimeoutException)) { + if (selectedException == null || + (!(ex instanceof SocketTimeoutException)) && (selectedException instanceof SocketTimeoutException)) { selectedException = ex; updatedException = true; } @@ -7553,12 +7548,12 @@ final void checkForInterrupt() throws SQLServerException { * interrupted (0 or more packets sent with no EOM bit). */ final void onRequestComplete() throws SQLServerException { - assert !requestComplete; - - if (logger.isLoggable(Level.FINEST)) - logger.finest(this + ": request complete"); - synchronized (interruptLock) { + assert !requestComplete; + + if (logger.isLoggable(Level.FINEST)) + logger.finest(this + ": request complete"); + requestComplete = true; // If this command was interrupted before its request was complete then @@ -7630,8 +7625,8 @@ final void onResponseEOM() throws SQLServerException { // interrupting threads. Note that it is remotely possible that the call // to readPacket won't actually read anything if the attention ack was // already read by TDSCommand.detach(), in which case this method could - // be called from multiple threads, leading to a benign race to clear the - // readingResponse flag. + // be called from multiple threads, leading to a benign followup process + // to clear the readingResponse flag. if (readAttentionAck) tdsReader.readPacket(); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java index d7e7ab2cf..01ace7365 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/KerbAuthentication.java @@ -312,7 +312,7 @@ public boolean isRealmValid(String realm) { validator = oracleRealmValidator; // As explained here: https://github.com/Microsoft/mssql-jdbc/pull/40#issuecomment-281509304 // The default Oracle Resolution mechanism is not bulletproof - // If it resolves a crappy name, drop it. + // If it resolves a non-existing name, drop it. if (!validator.isRealmValid("this.might.not.exist." + hostnameToTest)) { // Our realm validator is well working, return it authLogger.fine("Kerberos Realm Validator: Using Built-in Oracle Realm Validation method."); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java index 4ff063dab..458801d19 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java @@ -23,7 +23,6 @@ import java.time.OffsetTime; import java.time.format.DateTimeFormatter; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Set; diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java index e883f9a75..a95ce9c9f 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java @@ -1423,7 +1423,7 @@ Connection connectInternal(Properties propsIn, sPropKey = SQLServerDriverIntProperty.STATEMENT_POOLING_CACHE_SIZE.toString(); if (activeConnectionProperties.getProperty(sPropKey) != null && activeConnectionProperties.getProperty(sPropKey).length() > 0) { try { - int n = new Integer(activeConnectionProperties.getProperty(sPropKey)); + int n = Integer.parseInt(activeConnectionProperties.getProperty(sPropKey)); this.setStatementPoolingCacheSize(n); } catch (NumberFormatException e) { @@ -1560,7 +1560,7 @@ Connection connectInternal(Properties propsIn, try { String strPort = activeConnectionProperties.getProperty(sPropKey); if (null != strPort) { - nPort = new Integer(strPort); + nPort = Integer.parseInt(strPort); if ((nPort < 0) || (nPort > 65535)) { MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_invalidPortNumber")); @@ -1640,7 +1640,7 @@ else if (0 == requestedPacketSize) nLockTimeout = defaultLockTimeOut; // Wait forever if (activeConnectionProperties.getProperty(sPropKey) != null && activeConnectionProperties.getProperty(sPropKey).length() > 0) { try { - int n = new Integer(activeConnectionProperties.getProperty(sPropKey)); + int n = Integer.parseInt(activeConnectionProperties.getProperty(sPropKey)); if (n >= defaultLockTimeOut) nLockTimeout = n; else { @@ -1661,7 +1661,7 @@ else if (0 == requestedPacketSize) queryTimeoutSeconds = defaultQueryTimeout; // Wait forever if (activeConnectionProperties.getProperty(sPropKey) != null && activeConnectionProperties.getProperty(sPropKey).length() > 0) { try { - int n = new Integer(activeConnectionProperties.getProperty(sPropKey)); + int n = Integer.parseInt(activeConnectionProperties.getProperty(sPropKey)); if (n >= defaultQueryTimeout) { queryTimeoutSeconds = n; } @@ -1683,7 +1683,7 @@ else if (0 == requestedPacketSize) socketTimeoutMilliseconds = defaultSocketTimeout; // Wait forever if (activeConnectionProperties.getProperty(sPropKey) != null && activeConnectionProperties.getProperty(sPropKey).length() > 0) { try { - int n = new Integer(activeConnectionProperties.getProperty(sPropKey)); + int n = Integer.parseInt(activeConnectionProperties.getProperty(sPropKey)); if (n >= defaultSocketTimeout) { socketTimeoutMilliseconds = n; } @@ -1703,7 +1703,7 @@ else if (0 == requestedPacketSize) sPropKey = SQLServerDriverIntProperty.SERVER_PREPARED_STATEMENT_DISCARD_THRESHOLD.toString(); if (activeConnectionProperties.getProperty(sPropKey) != null && activeConnectionProperties.getProperty(sPropKey).length() > 0) { try { - int n = new Integer(activeConnectionProperties.getProperty(sPropKey)); + int n = Integer.parseInt(activeConnectionProperties.getProperty(sPropKey)); setServerPreparedStatementDiscardThreshold(n); } catch (NumberFormatException e) { @@ -2164,7 +2164,7 @@ ServerPortPlaceHolder primaryPermissionCheck(String primary, connectionlogger.fine(toString() + " SQL Server port returned by SQL Browser: " + instancePort); try { if (null != instancePort) { - primaryPortNumber = new Integer(instancePort); + primaryPortNumber = Integer.parseInt(instancePort); if ((primaryPortNumber < 0) || (primaryPortNumber > 65535)) { MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_invalidPortNumber")); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java index 49a6b25ba..854275214 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java @@ -864,7 +864,7 @@ private void setIntProperty(Properties props, int propValue) { if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) loggerExternal.entering(getClassNameLogging(), "set" + propKey, propValue); - props.setProperty(propKey, new Integer(propValue).toString()); + props.setProperty(propKey, ((Integer)propValue).toString()); loggerExternal.exiting(getClassNameLogging(), "set" + propKey); } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java index d0ac93479..f76c26af1 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java @@ -144,90 +144,90 @@ private void checkClosed() throws SQLServerException { } } - private final static String ASC_OR_DESC = "ASC_OR_DESC"; - private final static String ATTR_NAME = "ATTR_NAME"; - private final static String ATTR_TYPE_NAME = "ATTR_TYPE_NAME"; - private final static String ATTR_SIZE = "ATTR_SIZE"; - private final static String ATTR_DEF = "ATTR_DEF"; - private final static String BASE_TYPE = "BASE_TYPE"; - private final static String BUFFER_LENGTH = "BUFFER_LENGTH"; - private final static String CARDINALITY = "CARDINALITY"; - private final static String CHAR_OCTET_LENGTH = "CHAR_OCTET_LENGTH"; - private final static String CLASS_NAME = "CLASS_NAME"; - private final static String COLUMN_DEF = "COLUMN_DEF"; - private final static String COLUMN_NAME = "COLUMN_NAME"; - private final static String COLUMN_SIZE = "COLUMN_SIZE"; - private final static String COLUMN_TYPE = "COLUMN_TYPE"; - private final static String DATA_TYPE = "DATA_TYPE"; - private final static String DECIMAL_DIGITS = "DECIMAL_DIGITS"; - private final static String DEFERRABILITY = "DEFERRABILITY"; - private final static String DELETE_RULE = "DELETE_RULE"; - private final static String FILTER_CONDITION = "FILTER_CONDITION"; - private final static String FK_NAME = "FK_NAME"; - private final static String FKCOLUMN_NAME = "FKCOLUMN_NAME"; - private final static String FKTABLE_CAT = "FKTABLE_CAT"; - private final static String FKTABLE_NAME = "FKTABLE_NAME"; - private final static String FKTABLE_SCHEM = "FKTABLE_SCHEM"; - private final static String GRANTEE = "GRANTEE"; - private final static String GRANTOR = "GRANTOR"; - private final static String INDEX_NAME = "INDEX_NAME"; - private final static String INDEX_QUALIFIER = "INDEX_QUALIFIER"; - private final static String IS_GRANTABLE = "IS_GRANTABLE"; - private final static String IS_NULLABLE = "IS_NULLABLE"; - private final static String KEY_SEQ = "KEY_SEQ"; - private final static String LENGTH = "LENGTH"; - private final static String NON_UNIQUE = "NON_UNIQUE"; - private final static String NULLABLE = "NULLABLE"; - private final static String NUM_INPUT_PARAMS = "NUM_INPUT_PARAMS"; - private final static String NUM_OUTPUT_PARAMS = "NUM_OUTPUT_PARAMS"; - private final static String NUM_PREC_RADIX = "NUM_PREC_RADIX"; - private final static String NUM_RESULT_SETS = "NUM_RESULT_SETS"; - private final static String ORDINAL_POSITION = "ORDINAL_POSITION"; - private final static String PAGES = "PAGES"; - private final static String PK_NAME = "PK_NAME"; - private final static String PKCOLUMN_NAME = "PKCOLUMN_NAME"; - private final static String PKTABLE_CAT = "PKTABLE_CAT"; - private final static String PKTABLE_NAME = "PKTABLE_NAME"; - private final static String PKTABLE_SCHEM = "PKTABLE_SCHEM"; - private final static String PRECISION = "PRECISION"; - private final static String PRIVILEGE = "PRIVILEGE"; - private final static String PROCEDURE_CAT = "PROCEDURE_CAT"; - private final static String PROCEDURE_NAME = "PROCEDURE_NAME"; - private final static String PROCEDURE_SCHEM = "PROCEDURE_SCHEM"; - private final static String PROCEDURE_TYPE = "PROCEDURE_TYPE"; - private final static String PSEUDO_COLUMN = "PSEUDO_COLUMN"; - private final static String RADIX = "RADIX"; - private final static String REMARKS = "REMARKS"; - private final static String SCALE = "SCALE"; - private final static String SCOPE = "SCOPE"; - private final static String SCOPE_CATALOG = "SCOPE_CATALOG"; - private final static String SCOPE_SCHEMA = "SCOPE_SCHEMA"; - private final static String SCOPE_TABLE = "SCOPE_TABLE"; - private final static String SOURCE_DATA_TYPE = "SOURCE_DATA_TYPE"; - private final static String SQL_DATA_TYPE = "SQL_DATA_TYPE"; - private final static String SQL_DATETIME_SUB = "SQL_DATETIME_SUB"; - private final static String SS_DATA_TYPE = "SS_DATA_TYPE"; - private final static String SUPERTABLE_NAME = "SUPERTABLE_NAME"; - private final static String SUPERTYPE_CAT = "SUPERTYPE_CAT"; - private final static String SUPERTYPE_NAME = "SUPERTYPE_NAME"; - private final static String SUPERTYPE_SCHEM = "SUPERTYPE_SCHEM"; - private final static String TABLE_CAT = "TABLE_CAT"; - private final static String TABLE_NAME = "TABLE_NAME"; - private final static String TABLE_SCHEM = "TABLE_SCHEM"; - private final static String TABLE_TYPE = "TABLE_TYPE"; - private final static String TYPE = "TYPE"; - private final static String TYPE_CAT = "TYPE_CAT"; - private final static String TYPE_NAME = "TYPE_NAME"; - private final static String TYPE_SCHEM = "TYPE_SCHEM"; - private final static String UPDATE_RULE = "UPDATE_RULE"; - private final static String FUNCTION_CAT = "FUNCTION_CAT"; - private final static String FUNCTION_NAME = "FUNCTION_NAME"; - private final static String FUNCTION_SCHEM = "FUNCTION_SCHEM"; - private final static String FUNCTION_TYPE = "FUNCTION_TYPE"; - private final static String SS_IS_SPARSE = "SS_IS_SPARSE"; - private final static String SS_IS_COLUMN_SET = "SS_IS_COLUMN_SET"; - private final static String SS_IS_COMPUTED = "SS_IS_COMPUTED"; - private final static String IS_AUTOINCREMENT = "IS_AUTOINCREMENT"; + private static final String ASC_OR_DESC = "ASC_OR_DESC"; + private static final String ATTR_NAME = "ATTR_NAME"; + private static final String ATTR_TYPE_NAME = "ATTR_TYPE_NAME"; + private static final String ATTR_SIZE = "ATTR_SIZE"; + private static final String ATTR_DEF = "ATTR_DEF"; + private static final String BASE_TYPE = "BASE_TYPE"; + private static final String BUFFER_LENGTH = "BUFFER_LENGTH"; + private static final String CARDINALITY = "CARDINALITY"; + private static final String CHAR_OCTET_LENGTH = "CHAR_OCTET_LENGTH"; + private static final String CLASS_NAME = "CLASS_NAME"; + private static final String COLUMN_DEF = "COLUMN_DEF"; + private static final String COLUMN_NAME = "COLUMN_NAME"; + private static final String COLUMN_SIZE = "COLUMN_SIZE"; + private static final String COLUMN_TYPE = "COLUMN_TYPE"; + private static final String DATA_TYPE = "DATA_TYPE"; + private static final String DECIMAL_DIGITS = "DECIMAL_DIGITS"; + private static final String DEFERRABILITY = "DEFERRABILITY"; + private static final String DELETE_RULE = "DELETE_RULE"; + private static final String FILTER_CONDITION = "FILTER_CONDITION"; + private static final String FK_NAME = "FK_NAME"; + private static final String FKCOLUMN_NAME = "FKCOLUMN_NAME"; + private static final String FKTABLE_CAT = "FKTABLE_CAT"; + private static final String FKTABLE_NAME = "FKTABLE_NAME"; + private static final String FKTABLE_SCHEM = "FKTABLE_SCHEM"; + private static final String GRANTEE = "GRANTEE"; + private static final String GRANTOR = "GRANTOR"; + private static final String INDEX_NAME = "INDEX_NAME"; + private static final String INDEX_QUALIFIER = "INDEX_QUALIFIER"; + private static final String IS_GRANTABLE = "IS_GRANTABLE"; + private static final String IS_NULLABLE = "IS_NULLABLE"; + private static final String KEY_SEQ = "KEY_SEQ"; + private static final String LENGTH = "LENGTH"; + private static final String NON_UNIQUE = "NON_UNIQUE"; + private static final String NULLABLE = "NULLABLE"; + private static final String NUM_INPUT_PARAMS = "NUM_INPUT_PARAMS"; + private static final String NUM_OUTPUT_PARAMS = "NUM_OUTPUT_PARAMS"; + private static final String NUM_PREC_RADIX = "NUM_PREC_RADIX"; + private static final String NUM_RESULT_SETS = "NUM_RESULT_SETS"; + private static final String ORDINAL_POSITION = "ORDINAL_POSITION"; + private static final String PAGES = "PAGES"; + private static final String PK_NAME = "PK_NAME"; + private static final String PKCOLUMN_NAME = "PKCOLUMN_NAME"; + private static final String PKTABLE_CAT = "PKTABLE_CAT"; + private static final String PKTABLE_NAME = "PKTABLE_NAME"; + private static final String PKTABLE_SCHEM = "PKTABLE_SCHEM"; + private static final String PRECISION = "PRECISION"; + private static final String PRIVILEGE = "PRIVILEGE"; + private static final String PROCEDURE_CAT = "PROCEDURE_CAT"; + private static final String PROCEDURE_NAME = "PROCEDURE_NAME"; + private static final String PROCEDURE_SCHEM = "PROCEDURE_SCHEM"; + private static final String PROCEDURE_TYPE = "PROCEDURE_TYPE"; + private static final String PSEUDO_COLUMN = "PSEUDO_COLUMN"; + private static final String RADIX = "RADIX"; + private static final String REMARKS = "REMARKS"; + private static final String SCALE = "SCALE"; + private static final String SCOPE = "SCOPE"; + private static final String SCOPE_CATALOG = "SCOPE_CATALOG"; + private static final String SCOPE_SCHEMA = "SCOPE_SCHEMA"; + private static final String SCOPE_TABLE = "SCOPE_TABLE"; + private static final String SOURCE_DATA_TYPE = "SOURCE_DATA_TYPE"; + private static final String SQL_DATA_TYPE = "SQL_DATA_TYPE"; + private static final String SQL_DATETIME_SUB = "SQL_DATETIME_SUB"; + private static final String SS_DATA_TYPE = "SS_DATA_TYPE"; + private static final String SUPERTABLE_NAME = "SUPERTABLE_NAME"; + private static final String SUPERTYPE_CAT = "SUPERTYPE_CAT"; + private static final String SUPERTYPE_NAME = "SUPERTYPE_NAME"; + private static final String SUPERTYPE_SCHEM = "SUPERTYPE_SCHEM"; + private static final String TABLE_CAT = "TABLE_CAT"; + private static final String TABLE_NAME = "TABLE_NAME"; + private static final String TABLE_SCHEM = "TABLE_SCHEM"; + private static final String TABLE_TYPE = "TABLE_TYPE"; + private static final String TYPE = "TYPE"; + private static final String TYPE_CAT = "TYPE_CAT"; + private static final String TYPE_NAME = "TYPE_NAME"; + private static final String TYPE_SCHEM = "TYPE_SCHEM"; + private static final String UPDATE_RULE = "UPDATE_RULE"; + private static final String FUNCTION_CAT = "FUNCTION_CAT"; + private static final String FUNCTION_NAME = "FUNCTION_NAME"; + private static final String FUNCTION_SCHEM = "FUNCTION_SCHEM"; + private static final String FUNCTION_TYPE = "FUNCTION_TYPE"; + private static final String SS_IS_SPARSE = "SS_IS_SPARSE"; + private static final String SS_IS_COLUMN_SET = "SS_IS_COLUMN_SET"; + private static final String SS_IS_COMPUTED = "SS_IS_COMPUTED"; + private static final String IS_AUTOINCREMENT = "IS_AUTOINCREMENT"; /** * Make a simple query execute and return the result from it. This is to be used only for internal queries without any user input. @@ -421,7 +421,7 @@ public boolean supportsRefCursors() throws SQLException { return "database"; } - private final static String[] getColumnPrivilegesColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ COLUMN_NAME, + private static final String[] getColumnPrivilegesColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ COLUMN_NAME, /* 5 */ GRANTOR, /* 6 */ GRANTEE, /* 7 */ PRIVILEGE, /* 8 */ IS_GRANTABLE}; /* L0 */ public java.sql.ResultSet getColumnPrivileges(String catalog, @@ -447,7 +447,7 @@ public boolean supportsRefCursors() throws SQLException { return getResultSetWithProvidedColumnNames(catalog, CallableHandles.SP_COLUMN_PRIVILEGES, arguments, getColumnPrivilegesColumnNames); } - private final static String[] getTablesColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ TABLE_TYPE, + private static final String[] getTablesColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ TABLE_TYPE, /* 5 */ REMARKS}; /* L0 */ public java.sql.ResultSet getTables(String catalog, @@ -547,14 +547,14 @@ private static String EscapeIDName(String inID) throws SQLServerException { return outID.toString(); } - private final static String[] getColumnsColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ COLUMN_NAME, + private static final String[] getColumnsColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ COLUMN_NAME, /* 5 */ DATA_TYPE, /* 6 */ TYPE_NAME, /* 7 */ COLUMN_SIZE, /* 8 */ BUFFER_LENGTH, /* 9 */ DECIMAL_DIGITS, /* 10 */ NUM_PREC_RADIX, /* 11 */ NULLABLE, /* 12 */ REMARKS, /* 13 */ COLUMN_DEF, /* 14 */ SQL_DATA_TYPE, /* 15 */ SQL_DATETIME_SUB, /* 16 */ CHAR_OCTET_LENGTH, /* 17 */ ORDINAL_POSITION, /* 18 */ IS_NULLABLE}; // SQL10 columns not exahustive we only need to set until the one we want to change // in this case we want to change SS_IS_IDENTITY 22nd column to IS_AUTOINCREMENT // to be inline with JDBC spec - private final static String[] getColumnsColumnNamesKatmai = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ COLUMN_NAME, + private static final String[] getColumnsColumnNamesKatmai = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ COLUMN_NAME, /* 5 */ DATA_TYPE, /* 6 */ TYPE_NAME, /* 7 */ COLUMN_SIZE, /* 8 */ BUFFER_LENGTH, /* 9 */ DECIMAL_DIGITS, /* 10 */ NUM_PREC_RADIX, /* 11 */ NULLABLE, /* 12 */ REMARKS, /* 13 */ COLUMN_DEF, /* 14 */ SQL_DATA_TYPE, /* 15 */ SQL_DATETIME_SUB, /* 16 */ CHAR_OCTET_LENGTH, /* 17 */ ORDINAL_POSITION, /* 18 */ IS_NULLABLE, /* 20 */ SS_IS_SPARSE, /* 20 */ SS_IS_COLUMN_SET, /* 21 */ SS_IS_COMPUTED, @@ -612,7 +612,7 @@ private static String EscapeIDName(String inID) throws SQLServerException { return rs; } - private final static String[] getFunctionsColumnNames = {/* 1 */ FUNCTION_CAT, /* 2 */ FUNCTION_SCHEM, /* 3 */ FUNCTION_NAME, + private static final String[] getFunctionsColumnNames = {/* 1 */ FUNCTION_CAT, /* 2 */ FUNCTION_SCHEM, /* 3 */ FUNCTION_NAME, /* 4 */ NUM_INPUT_PARAMS, /* 5 */ NUM_OUTPUT_PARAMS, /* 6 */ NUM_RESULT_SETS, /* 7 */ REMARKS, /* 8 */ FUNCTION_TYPE}; public java.sql.ResultSet getFunctions(String catalog, @@ -638,7 +638,7 @@ public java.sql.ResultSet getFunctions(String catalog, return getResultSetWithProvidedColumnNames(catalog, CallableHandles.SP_STORED_PROCEDURES, arguments, getFunctionsColumnNames); } - private final static String[] getFunctionsColumnsColumnNames = {/* 1 */ FUNCTION_CAT, /* 2 */ FUNCTION_SCHEM, /* 3 */ FUNCTION_NAME, + private static final String[] getFunctionsColumnsColumnNames = {/* 1 */ FUNCTION_CAT, /* 2 */ FUNCTION_SCHEM, /* 3 */ FUNCTION_NAME, /* 4 */ COLUMN_NAME, /* 5 */ COLUMN_TYPE, /* 6 */ DATA_TYPE, /* 7 */ TYPE_NAME, /* 8 */ PRECISION, /* 9 */ LENGTH, /* 10 */ SCALE, /* 11 */ RADIX, /* 12 */ NULLABLE, /* 13 */ REMARKS, /* 14 */ COLUMN_DEF, /* 15 */ SQL_DATA_TYPE, /* 16 */ SQL_DATETIME_SUB, /* 17 */ CHAR_OCTET_LENGTH, /* 18 */ ORDINAL_POSITION, /* 19 */ IS_NULLABLE}; @@ -695,7 +695,7 @@ public java.sql.ResultSet getClientInfoProperties() throws SQLException { /* 4 */ " cast(NULL as char(1)) as DESCRIPTION " + " where 0 = 1"); } - private final static String[] getBestRowIdentifierColumnNames = {/* 1 */ SCOPE, /* 2 */ COLUMN_NAME, /* 3 */ DATA_TYPE, /* 4 */ TYPE_NAME, + private static final String[] getBestRowIdentifierColumnNames = {/* 1 */ SCOPE, /* 2 */ COLUMN_NAME, /* 3 */ DATA_TYPE, /* 4 */ TYPE_NAME, /* 5 */ COLUMN_SIZE, /* 6 */ BUFFER_LENGTH, /* 7 */ DECIMAL_DIGITS, /* 8 */ PSEUDO_COLUMN}; /* L0 */ public java.sql.ResultSet getBestRowIdentifier(String catalog, @@ -735,7 +735,7 @@ public java.sql.ResultSet getClientInfoProperties() throws SQLException { return rs; } - private final static String[] pkfkColumnNames = {/* 1 */ PKTABLE_CAT, /* 2 */ PKTABLE_SCHEM, /* 3 */ PKTABLE_NAME, /* 4 */ PKCOLUMN_NAME, + private static final String[] pkfkColumnNames = {/* 1 */ PKTABLE_CAT, /* 2 */ PKTABLE_SCHEM, /* 3 */ PKTABLE_NAME, /* 4 */ PKCOLUMN_NAME, /* 5 */ FKTABLE_CAT, /* 6 */ FKTABLE_SCHEM, /* 7 */ FKTABLE_NAME, /* 8 */ FKCOLUMN_NAME, /* 9 */ KEY_SEQ, /* 10 */ UPDATE_RULE, /* 11 */ DELETE_RULE, /* 12 */ FK_NAME, /* 13 */ PK_NAME, /* 14 */ DEFERRABILITY}; @@ -1005,7 +1005,7 @@ private ResultSet getResultSetForForeignKeyInformation(SQLServerResultSet fkeysR + foreign_keys_combined_tableName + " order by FKTABLE_QUALIFIER, FKTABLE_OWNER, FKTABLE_NAME, KEY_SEQ"); } - private final static String[] getIndexInfoColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ NON_UNIQUE, + private static final String[] getIndexInfoColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ NON_UNIQUE, /* 5 */ INDEX_QUALIFIER, /* 6 */ INDEX_NAME, /* 7 */ TYPE, /* 8 */ ORDINAL_POSITION, /* 9 */ COLUMN_NAME, /* 10 */ ASC_OR_DESC, /* 11 */ CARDINALITY, /* 12 */ PAGES, /* 13 */ FILTER_CONDITION}; @@ -1159,7 +1159,7 @@ private ResultSet getResultSetForForeignKeyInformation(SQLServerResultSet fkeysR return "ABS,ACOS,ASIN,ATAN,ATAN2,CEILING,COS,COT,DEGREES,EXP, FLOOR,LOG,LOG10,MOD,PI,POWER,RADIANS,RAND,ROUND,SIGN,SIN,SQRT,TAN,TRUNCATE"; } - private final static String[] getPrimaryKeysColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ COLUMN_NAME, + private static final String[] getPrimaryKeysColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ COLUMN_NAME, /* 5 */ KEY_SEQ, /* 6 */ PK_NAME}; /* L0 */ public java.sql.ResultSet getPrimaryKeys(String cat, @@ -1179,7 +1179,7 @@ private ResultSet getResultSetForForeignKeyInformation(SQLServerResultSet fkeysR return getResultSetWithProvidedColumnNames(cat, CallableHandles.SP_PKEYS, arguments, getPrimaryKeysColumnNames); } - private final static String[] getProcedureColumnsColumnNames = {/* 1 */ PROCEDURE_CAT, /* 2 */ PROCEDURE_SCHEM, /* 3 */ PROCEDURE_NAME, + private static final String[] getProcedureColumnsColumnNames = {/* 1 */ PROCEDURE_CAT, /* 2 */ PROCEDURE_SCHEM, /* 3 */ PROCEDURE_NAME, /* 4 */ COLUMN_NAME, /* 5 */ COLUMN_TYPE, /* 6 */ DATA_TYPE, /* 7 */ TYPE_NAME, /* 8 */ PRECISION, /* 9 */ LENGTH, /* 10 */ SCALE, /* 11 */ RADIX, /* 12 */ NULLABLE, /* 13 */ REMARKS, /* 14 */ COLUMN_DEF, /* 15 */ SQL_DATA_TYPE, /* 16 */ SQL_DATETIME_SUB, /* 17 */ CHAR_OCTET_LENGTH, /* 18 */ ORDINAL_POSITION, /* 19 */ IS_NULLABLE}; @@ -1224,7 +1224,7 @@ private ResultSet getResultSetForForeignKeyInformation(SQLServerResultSet fkeysR return rs; } - private final static String[] getProceduresColumnNames = {/* 1 */ PROCEDURE_CAT, /* 2 */ PROCEDURE_SCHEM, /* 3 */ PROCEDURE_NAME, + private static final String[] getProceduresColumnNames = {/* 1 */ PROCEDURE_CAT, /* 2 */ PROCEDURE_SCHEM, /* 3 */ PROCEDURE_NAME, /* 4 */ NUM_INPUT_PARAMS, /* 5 */ NUM_OUTPUT_PARAMS, /* 6 */ NUM_RESULT_SETS, /* 7 */ REMARKS, /* 8 */ PROCEDURE_TYPE}; /* L0 */ public java.sql.ResultSet getProcedures(String catalog, @@ -1389,7 +1389,7 @@ public java.sql.ResultSet getSchemas(String catalog, return "DATABASE,IFNULL,USER"; // The functions no reinstated after the CTS certification. } - private final static String[] getTablePrivilegesColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ GRANTOR, + private static final String[] getTablePrivilegesColumnNames = {/* 1 */ TABLE_CAT, /* 2 */ TABLE_SCHEM, /* 3 */ TABLE_NAME, /* 4 */ GRANTOR, /* 5 */ GRANTEE, /* 6 */ PRIVILEGE, /* 7 */ IS_GRANTABLE}; /* L0 */ public java.sql.ResultSet getTablePrivileges(String catalog, @@ -1539,7 +1539,7 @@ else if (name.equals(SQLServerDriverIntProperty.PORT_NUMBER.toString())) { return result; } - private final static String[] getVersionColumnsColumnNames = {/* 1 */ SCOPE, /* 2 */ COLUMN_NAME, /* 3 */ DATA_TYPE, /* 4 */ TYPE_NAME, + private static final String[] getVersionColumnsColumnNames = {/* 1 */ SCOPE, /* 2 */ COLUMN_NAME, /* 3 */ DATA_TYPE, /* 4 */ TYPE_NAME, /* 5 */ COLUMN_SIZE, /* 6 */ BUFFER_LENGTH, /* 7 */ DECIMAL_DIGITS, /* 8 */ PSEUDO_COLUMN}; /* L0 */ public java.sql.ResultSet getVersionColumns(String catalog, @@ -1972,10 +1972,7 @@ else if (name.equals(SQLServerDriverIntProperty.PORT_NUMBER.toString())) { case ResultSet.TYPE_SCROLL_INSENSITIVE: // case SQLServerResultSet.TYPE_SS_SCROLL_STATIC: sensitive synonym case SQLServerResultSet.TYPE_SS_DIRECT_FORWARD_ONLY: - if (ResultSet.CONCUR_READ_ONLY == concurrency) - return true; - else - return false; + return (ResultSet.CONCUR_READ_ONLY == concurrency); } // per spec if we do not know we do not support. return false; @@ -1984,60 +1981,48 @@ else if (name.equals(SQLServerDriverIntProperty.PORT_NUMBER.toString())) { /* L0 */ public boolean ownUpdatesAreVisible(int type) throws SQLServerException { checkClosed(); checkResultType(type); - if (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type + return (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type || SQLServerResultSet.TYPE_SCROLL_SENSITIVE == type || SQLServerResultSet.TYPE_SS_SCROLL_KEYSET == type - || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type) - return true; - return false; + || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type); } /* L0 */ public boolean ownDeletesAreVisible(int type) throws SQLServerException { checkClosed(); checkResultType(type); - if (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type + return (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type || SQLServerResultSet.TYPE_SCROLL_SENSITIVE == type || SQLServerResultSet.TYPE_SS_SCROLL_KEYSET == type - || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type) - return true; - return false; + || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type); } /* L0 */ public boolean ownInsertsAreVisible(int type) throws SQLServerException { checkClosed(); checkResultType(type); - if (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type + return (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type || SQLServerResultSet.TYPE_SCROLL_SENSITIVE == type || SQLServerResultSet.TYPE_SS_SCROLL_KEYSET == type - || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type) - return true; - return false; + || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type); } /* L0 */ public boolean othersUpdatesAreVisible(int type) throws SQLServerException { checkClosed(); checkResultType(type); - if (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type + return (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type || SQLServerResultSet.TYPE_SCROLL_SENSITIVE == type || SQLServerResultSet.TYPE_SS_SCROLL_KEYSET == type - || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type) - return true; - return false; + || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type); } /* L0 */ public boolean othersDeletesAreVisible(int type) throws SQLServerException { checkClosed(); checkResultType(type); - if (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type + return (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type || SQLServerResultSet.TYPE_SCROLL_SENSITIVE == type || SQLServerResultSet.TYPE_SS_SCROLL_KEYSET == type - || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type) - return true; - return false; + || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type); } /* L0 */ public boolean othersInsertsAreVisible(int type) throws SQLServerException { checkClosed(); checkResultType(type); - if (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type - || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type) - return true; - return false; + return (type == SQLServerResultSet.TYPE_SS_SCROLL_DYNAMIC || SQLServerResultSet.TYPE_FORWARD_ONLY == type + || SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY == type); } /* L0 */ public boolean updatesAreDetected(int type) throws SQLServerException { @@ -2049,10 +2034,7 @@ else if (name.equals(SQLServerDriverIntProperty.PORT_NUMBER.toString())) { /* L0 */ public boolean deletesAreDetected(int type) throws SQLServerException { checkClosed(); checkResultType(type); - if (SQLServerResultSet.TYPE_SS_SCROLL_KEYSET == type) - return true; - else - return false; + return (SQLServerResultSet.TYPE_SS_SCROLL_KEYSET == type); } // Check the result types to make sure the user does not pass a bad value. @@ -2296,14 +2278,14 @@ public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { // Filter to convert DATA_TYPE column values from the ODBC types // returned by SQL Server to their equivalent JDBC types. final class DataTypeFilter extends IntColumnFilter { - private final static int ODBC_SQL_GUID = -11; - private final static int ODBC_SQL_WCHAR = -8; - private final static int ODBC_SQL_WVARCHAR = -9; - private final static int ODBC_SQL_WLONGVARCHAR = -10; - private final static int ODBC_SQL_FLOAT = 6; - private final static int ODBC_SQL_TIME = -154; - private final static int ODBC_SQL_XML = -152; - private final static int ODBC_SQL_UDT = -151; + private static final int ODBC_SQL_GUID = -11; + private static final int ODBC_SQL_WCHAR = -8; + private static final int ODBC_SQL_WVARCHAR = -9; + private static final int ODBC_SQL_WLONGVARCHAR = -10; + private static final int ODBC_SQL_FLOAT = 6; + private static final int ODBC_SQL_TIME = -154; + private static final int ODBC_SQL_XML = -152; + private static final int ODBC_SQL_UDT = -151; int oneValueToAnother(int odbcType) { switch (odbcType) { diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java index 8181219ba..9ea0c7a5b 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java @@ -474,7 +474,9 @@ String getClassNameLogging() { java.sql.DriverManager.registerDriver(new SQLServerDriver()); } catch (SQLException e) { - e.printStackTrace(); + if (drLogger.isLoggable(Level.FINER) && Util.IsActivityTraceOn()) { + drLogger.finer("Error registering driver: " + e); + } } } @@ -632,7 +634,7 @@ private Properties parseAndMergeProperties(String Url, // put the user properties into the connect properties int nTimeout = DriverManager.getLoginTimeout(); if (nTimeout > 0) { - connectProperties.put(SQLServerDriverIntProperty.LOGIN_TIMEOUT.toString(), new Integer(nTimeout).toString()); + connectProperties.put(SQLServerDriverIntProperty.LOGIN_TIMEOUT.toString(), ((Integer)nTimeout).toString()); } // Merge connectProperties (from URL) and supplied properties from user. diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSetMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSetMetaData.java index 693f3fe0c..93de065ee 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSetMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSetMetaData.java @@ -21,7 +21,6 @@ public final class SQLServerResultSetMetaData implements java.sql.ResultSetMetaData { private SQLServerConnection con; private final SQLServerResultSet rs; - public int nBeforeExecuteCols; static final private java.util.logging.Logger logger = java.util.logging.Logger .getLogger("com.microsoft.sqlserver.jdbc.internals.SQLServerResultSetMetaData"); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SqlVariant.java b/src/main/java/com/microsoft/sqlserver/jdbc/SqlVariant.java index 2d4c13436..63861a49c 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SqlVariant.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SqlVariant.java @@ -62,7 +62,7 @@ static sqlVariantProbBytes valueOf(int intValue) { if (!(0 <= intValue && intValue < valuesTypes.length) || null == (tdsType = valuesTypes[intValue])) { MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_unknownSSType")); - Object[] msgArgs = {new Integer(intValue)}; + Object[] msgArgs = {(Integer)intValue}; throw new IllegalArgumentException(form.format(msgArgs)); } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java index c1d6d81dc..028c5efa0 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java @@ -391,7 +391,8 @@ else if (ch == ':') if (null != name) { if (logger.isLoggable(Level.FINE)) { if (false == name.equals(SQLServerDriverStringProperty.USER.toString())) { - if (!name.toLowerCase(Locale.ENGLISH).contains("password")) { + if (!name.toLowerCase(Locale.ENGLISH).contains("password") && + !name.toLowerCase(Locale.ENGLISH).contains("keystoresecret")) { logger.fine("Property:" + name + " Value:" + value); } else { @@ -785,10 +786,7 @@ static final String readGUID(byte[] inputGUID) throws SQLServerException { static boolean IsActivityTraceOn() { LogManager lm = LogManager.getLogManager(); String activityTrace = lm.getProperty(ActivityIdTraceProperty); - if ("on".equalsIgnoreCase(activityTrace)) - return true; - else - return false; + return ("on".equalsIgnoreCase(activityTrace)); } /** diff --git a/src/main/java/mssql/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java b/src/main/java/mssql/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java index a52c70e7b..10f892497 100644 --- a/src/main/java/mssql/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java +++ b/src/main/java/mssql/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java @@ -1446,9 +1446,9 @@ Object readResolve() { * provides a flexible approach for constructing customized instances with * a named parameter syntax. It can be used in the following manner: *
{@code
-   * ConcurrentMap> graph = new Builder>()
+   * ConcurrentMap> graph = new Builder>()
    *     .maximumWeightedCapacity(5000)
-   *     .weigher(Weighers.set())
+   *     .weigher(Weighers.set())
    *     .build();
    * }
*/ diff --git a/src/samples/resultsets/src/main/java/retrieveRS.java b/src/samples/resultsets/src/main/java/retrieveRS.java index 0a4bcc5f4..2422d099f 100644 --- a/src/samples/resultsets/src/main/java/retrieveRS.java +++ b/src/samples/resultsets/src/main/java/retrieveRS.java @@ -104,7 +104,7 @@ private static void createTable(Connection con) throws SQLException { stmt.execute(sql); - sql = "INSERT Product_JDBC_Sample VALUES ('Adjustable Race','AR-5381','0','0',NULL,'1000','750','0.00','0.00',NULL,NULL,NULL,NULL,'0',NULL,NULL,NULL,NULL,NULL,'2008-04-30 00:00:00.000',NULL,NULL,'694215B7-08F7-4C0D-ACB1-D734BA44C0C8','2014-02-08 10:01:36.827') "; + sql = "INSERT Product_JDBC_Sample VALUES ('Adjustable Time','AR-5381','0','0',NULL,'1000','750','0.00','0.00',NULL,NULL,NULL,NULL,'0',NULL,NULL,NULL,NULL,NULL,'2008-04-30 00:00:00.000',NULL,NULL,'694215B7-08F7-4C0D-ACB1-D734BA44C0C8','2014-02-08 10:01:36.827') "; stmt.execute(sql); sql = "INSERT Product_JDBC_Sample VALUES ('ML Bottom Bracket','BB-8107','0','0',NULL,'1000','750','0.00','0.00',NULL,NULL,NULL,NULL,'0',NULL,NULL,NULL,NULL,NULL,'2008-04-30 00:00:00.000',NULL,NULL,'694215B7-08F7-4C0D-ACB1-D734BA44C0C8','2014-02-08 10:01:36.827') "; diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/callablestatement/CallableStatementTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/callablestatement/CallableStatementTest.java index dad9c195f..2c4c191f2 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/callablestatement/CallableStatementTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/callablestatement/CallableStatementTest.java @@ -133,11 +133,11 @@ public void inputParamsTest() throws SQLException { // the historical way: no leading '@', parameter names respected (not positional) CallableStatement cs1 = connection.prepareCall(call); - cs1.setString("p2", "bar"); - cs1.setString("p1", "foo"); + cs1.setString("p2", "world"); + cs1.setString("p1", "hello"); rs = cs1.executeQuery(); rs.next(); - assertEquals("foobar", rs.getString(1)); + assertEquals("helloworld", rs.getString(1)); // the "new" way: leading '@', parameter names still respected (not positional) CallableStatement cs2 = connection.prepareCall(call); @@ -150,7 +150,7 @@ public void inputParamsTest() throws SQLException { // sanity check: unrecognized parameter name CallableStatement cs3 = connection.prepareCall(call); try { - cs3.setString("@whatever", "junk"); + cs3.setString("@whatever", "test"); fail("SQLServerException should have been thrown"); } catch (SQLServerException sse) { if (!sse.getMessage().startsWith("Parameter @whatever was not defined")) { diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/MergeTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/MergeTest.java index 54ebcdde2..41674e562 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/MergeTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/MergeTest.java @@ -38,7 +38,7 @@ public class MergeTest extends AbstractTest { + " SELECT * FROM CricketTeams IF OBJECT_ID (N'dbo.CricketTeams_UpdatedList', N'U') IS NOT NULL DROP TABLE dbo.CricketTeams_UpdatedList;" + " CREATE TABLE dbo.CricketTeams_UpdatedList ( CricketTeamID tinyint NOT NULL PRIMARY KEY, CricketTeamCountry nvarchar(30), CricketTeamContinent nvarchar(50))" + "INSERT INTO dbo.CricketTeams_UpdatedList VALUES (1, 'Australia', 'Australia'), (2, 'India', 'Asia'), (3, 'Pakistan', 'Asia'), (4, 'Srilanka', 'Asia'), (5, 'Bangaladesh', 'Asia')," - + " (6, 'Hong Kong', 'Asia'), (8, 'England', 'Europe'), (9, 'South Africa', 'Africa'), (10, 'West Indies', 'North America'), (11, 'Zimbabwe', 'Africa');"; + + " (6, 'Thailand', 'Asia'), (8, 'England', 'Europe'), (9, 'South Africa', 'Africa'), (10, 'West Indies', 'North America'), (11, 'Zimbabwe', 'Africa');"; private static final String mergeCmd2 = "MERGE dbo.CricketTeams AS TARGET " + "USING dbo.CricketTeams_UpdatedList AS SOURCE " + "ON (TARGET.CricketTeamID = SOURCE.CricketTeamID) " + "WHEN MATCHED AND TARGET.CricketTeamContinent <> SOURCE.CricketTeamContinent OR " diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/StatementTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/StatementTest.java index afb311ae9..eb105a353 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/StatementTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/StatementTest.java @@ -319,7 +319,7 @@ public void testCancelBlockedResponse() throws Exception { try { // Start a transaction on a second connection that locks the last part of the table - // and leave it hanging for now... + // and leave it non-responsive for now... conLock = DriverManager.getConnection(connectionString); conLock.setAutoCommit(false); stmtLock = conLock.createStatement(); @@ -434,7 +434,7 @@ public void testCancelBlockedResponsePS() throws Exception { try { // Start a transaction on a second connection that locks the last part of the table - // and leave it hanging for now... + // and leave it non-responsive for now... conLock = DriverManager.getConnection(connectionString); conLock.setAutoCommit(false); stmtLock = conLock.createStatement(); @@ -551,7 +551,7 @@ public void testCancelBlockedCursoredResponse() throws Exception { try { // Start a transaction on a second connection that locks the last part of the table - // and leave it hanging for now... + // and leave it non-responsive for now... conLock = DriverManager.getConnection(connectionString); conLock.setAutoCommit(false); stmtLock = conLock.createStatement(); @@ -726,11 +726,11 @@ public void testCancelGetOutParams() throws Exception { /** * Test that tries to flush out cancellation synchronization issues by repeatedly executing and cancelling statements on multiple threads. * - * Typical expected failures would be liveness issues (which would manifest as a test hang), incorrect results, or TDS corruption problems. + * Typical expected failures would be liveness issues (which would manifest as a test being non-responsive), incorrect results, or TDS corruption problems. * * A set of thread pairs runs for 10 seconds. Each pair has one thread repeatedly executing a SELECT statement and one thread repeatedly * cancelling execution of that statement. Nothing is done to validate whether any particular call to cancel had any affect on the statement. - * Liveness issues typically would manifest as a hang in this test. + * Liveness issues typically would manifest as a no response in this test. * * In order to maximize the likelihood of this test finding bugs, it should run on a multi-proc machine with the -server flag specified to the * JVM. Also, the debugging println statements are commented out deliberately to minimize the impact to the test from the diagnostics, which