From d6080c8ef4b141c48539f568fc22049f6580ee00 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Tue, 16 Jan 2018 18:22:16 -0800 Subject: [PATCH 1/2] Added XML header --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index c2c3276f44..af345be667 100644 --- a/pom.xml +++ b/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 From 7a7a8b4ad2e51bb50b3eb51d0da8b415e68a7661 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Wed, 17 Jan 2018 16:31:01 -0800 Subject: [PATCH 2/2] Policheck issue fixes --- .../java/com/microsoft/sqlserver/jdbc/IOBuffer.java | 8 ++++---- .../microsoft/sqlserver/jdbc/KerbAuthentication.java | 2 +- .../ConcurrentLinkedHashMap.java | 4 ++-- src/samples/resultsets/src/main/java/retrieveRS.java | 2 +- .../jdbc/callablestatement/CallableStatementTest.java | 8 ++++---- .../sqlserver/jdbc/unit/statement/MergeTest.java | 2 +- .../sqlserver/jdbc/unit/statement/StatementTest.java | 10 +++++----- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java b/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java index d87a9cb144..773327f0b6 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. @@ -2547,7 +2547,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(); } @@ -7630,8 +7630,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 d7e7ab2cf8..01ace73651 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/mssql/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java b/src/main/java/mssql/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java index a52c70e7b5..10f8924979 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 0a4bcc5f48..2422d099fb 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 dad9c195fc..2c4c191f27 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 54ebcdde21..41674e562f 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 afb311ae91..eb105a3532 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