diff --git a/pom.xml b/pom.xml index 5b39cdd77..f1f5dd160 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.microsoft.sqlserver mssql-jdbc - 6.5.3-SNAPSHOT.${jreVersion}-preview + 6.5.3-SNAPSHOT jar Microsoft JDBC Driver for SQL Server @@ -130,12 +130,8 @@ build42 - - - jre8 - - + ${project.artifactId}-${project.version}.jre8-preview maven-compiler-plugin @@ -166,13 +162,9 @@ build43 true - - - - jre9 - - + + ${project.artifactId}-${project.version}.jre9-preview maven-compiler-plugin @@ -328,6 +320,7 @@ org.codehaus.mojo versions-maven-plugin + 2.5 true outdated-dependencies.txt diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java index 27c608d30..c5ad97c9a 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java @@ -3348,7 +3348,7 @@ private byte[] normalizedValue(JDBCType destJdbcType, longValue = (long) (short) value; break; default: - longValue = new Long((Integer) value); + longValue = Long.valueOf((Integer) value); } return ByteBuffer.allocate(Long.SIZE / Byte.SIZE).order(ByteOrder.LITTLE_ENDIAN).putLong(longValue).array(); @@ -3362,7 +3362,7 @@ private byte[] normalizedValue(JDBCType destJdbcType, longValue = (long) (short) value; break; case INTEGER: - longValue = new Long((Integer) value); + longValue = Long.valueOf((Integer) value); break; default: longValue = (long) value; diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/CallableStatementTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/CallableStatementTest.java index bc0c8f173..bb9ef457d 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/CallableStatementTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/CallableStatementTest.java @@ -1904,25 +1904,25 @@ else if (coercion == String.class) { return callableStatement.getString(ordinal); } else if (coercion == Boolean.class) { - return new Boolean(callableStatement.getBoolean(ordinal)); + return Boolean.valueOf(callableStatement.getBoolean(ordinal)); } else if (coercion == Byte.class) { - return new Byte(callableStatement.getByte(ordinal)); + return Byte.valueOf(callableStatement.getByte(ordinal)); } else if (coercion == Short.class) { - return new Short(callableStatement.getShort(ordinal)); + return Short.valueOf(callableStatement.getShort(ordinal)); } else if (coercion == Integer.class) { - return new Integer(callableStatement.getInt(ordinal)); + return Integer.valueOf(callableStatement.getInt(ordinal)); } else if (coercion == Long.class) { - return new Long(callableStatement.getLong(ordinal)); + return Long.valueOf(callableStatement.getLong(ordinal)); } else if (coercion == Float.class) { - return new Float(callableStatement.getFloat(ordinal)); + return Float.valueOf(callableStatement.getFloat(ordinal)); } else if (coercion == Double.class) { - return new Double(callableStatement.getDouble(ordinal)); + return Double.valueOf(callableStatement.getDouble(ordinal)); } else if (coercion == BigDecimal.class) { return callableStatement.getBigDecimal(ordinal); diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyTestUtil.java b/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyTestUtil.java index 0b902587e..bfdd83cb5 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyTestUtil.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyTestUtil.java @@ -380,7 +380,7 @@ static void validateValues( if(srcValue.getClass().getName().equalsIgnoreCase("java.lang.Double")){ // in case of SQL Server type Float (ie java type double), in float(n) if n is <=24 ie precsion is <=7 SQL Server type Real is returned(ie java type float) if(destMeta.getPrecision(i) <8) - srcValue = new Float(((Double)srcValue)); + srcValue = ((Double)srcValue).floatValue(); } dstValue = dstResultSet.getObject(i); int dstType = destMeta.getColumnType(i); diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionDriverTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionDriverTest.java index 3de43f7c1..64a982e6a 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionDriverTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/connection/ConnectionDriverTest.java @@ -68,7 +68,7 @@ public void testConnectionDriver() throws SQLException { for (DriverPropertyInfo anInfoArray1 : infoArray) { logger.fine(anInfoArray1.name); logger.fine(anInfoArray1.description); - logger.fine(new Boolean(anInfoArray1.required).toString()); + logger.fine(Boolean.valueOf(anInfoArray1.required).toString()); logger.fine(anInfoArray1.value); } diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/LimitEscapeTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/LimitEscapeTest.java index 6e3563101..0453b5df1 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/LimitEscapeTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/LimitEscapeTest.java @@ -115,16 +115,13 @@ public void verifyTranslation() throws Exception { cArg[0] = String.class; Class innerClass = Class.forName("com.microsoft.sqlserver.jdbc.JDBCSyntaxTranslator"); Constructor ctor = innerClass.getDeclaredConstructor(); - if (!ctor.isAccessible()) { - ctor.setAccessible(true); - } + ctor.setAccessible(true); Object innerInstance = ctor.newInstance(); Method method = innerClass.getDeclaredMethod("translate", cArg); - if (!method.isAccessible()) { - method.setAccessible(true); - } + + method.setAccessible(true); Object str = method.invoke(innerInstance, inputSql); assertEquals(str, outputSql, "Syntax tyranslation does not match for query: " + queryID); } diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/PreparedStatementTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/PreparedStatementTest.java index e4e0d09f0..f64e6d570 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/PreparedStatementTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/PreparedStatementTest.java @@ -317,7 +317,7 @@ public void testStatementPoolingEviction() throws SQLException { // Add new statements to fill up the statement pool. for (int i = 0; i < cacheSize; ++i) { - try (SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement)con.prepareStatement(query + new Integer(i).toString())) { + try (SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement)con.prepareStatement(query + String.valueOf(i))) { pstmt.execute(); // sp_executesql pstmt.execute(); // sp_prepexec, actual handle created and cached. } @@ -332,7 +332,7 @@ public void testStatementPoolingEviction() throws SQLException { // (new statement pushes existing statement from pool into discard // action queue). for (int i = cacheSize; i < cacheSize + 5; ++i) { - try (SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement)con.prepareStatement(query + new Integer(i).toString())) { + try (SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement)con.prepareStatement(query + String.valueOf(i))) { pstmt.execute(); // sp_executesql pstmt.execute(); // sp_prepexec, actual handle created and cached. } diff --git a/src/test/java/com/microsoft/sqlserver/testframework/util/ComparisonUtil.java b/src/test/java/com/microsoft/sqlserver/testframework/util/ComparisonUtil.java index b297a3924..b251e92bd 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/util/ComparisonUtil.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/util/ComparisonUtil.java @@ -11,6 +11,7 @@ import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; +import java.util.Calendar; import com.microsoft.sqlserver.jdbc.SQLServerResultSetMetaData; import com.microsoft.sqlserver.testframework.DBConnection; @@ -143,7 +144,11 @@ public static void compareExpectedAndActual(int dataType, break; case java.sql.Types.DATE: - assertTrue((((Date) expectedValue).getDate() == (((Date) actualValue).getDate())), "Unexpected datetime value"); + Calendar expC = Calendar.getInstance(); + expC.setTime((Date)expectedValue); + Calendar actC = Calendar.getInstance(); + actC.setTime((Date)actualValue); + assertTrue(expC.get(Calendar.DAY_OF_MONTH) == actC.get(Calendar.DAY_OF_MONTH), "Unexpected datetime value"); break; case java.sql.Types.TIME: diff --git a/src/test/java/com/microsoft/sqlserver/testframework/util/RandomData.java b/src/test/java/com/microsoft/sqlserver/testframework/util/RandomData.java index 21e12991b..e32061109 100644 --- a/src/test/java/com/microsoft/sqlserver/testframework/util/RandomData.java +++ b/src/test/java/com/microsoft/sqlserver/testframework/util/RandomData.java @@ -2,6 +2,7 @@ import java.math.BigDecimal; import java.math.BigInteger; +import java.math.RoundingMode; import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; @@ -168,7 +169,7 @@ public static BigDecimal generateDecimalNumeric(int precision, if (r.nextBoolean()) { n = BigInteger.TEN.pow(precision); if (scale > 0) - return new BigDecimal(n, scale).subtract(new BigDecimal("" + Math.pow(10, -scale)).setScale(scale, BigDecimal.ROUND_HALF_UP)) + return new BigDecimal(n, scale).subtract(new BigDecimal("" + Math.pow(10, -scale)).setScale(scale, RoundingMode.HALF_UP)) .negate(); else return new BigDecimal(n, scale).subtract(new BigDecimal("1")).negate(); @@ -176,7 +177,7 @@ public static BigDecimal generateDecimalNumeric(int precision, else { n = BigInteger.TEN.pow(precision); if (scale > 0) - return new BigDecimal(n, scale).subtract(new BigDecimal("" + Math.pow(10, -scale)).setScale(scale, BigDecimal.ROUND_HALF_UP)) + return new BigDecimal(n, scale).subtract(new BigDecimal("" + Math.pow(10, -scale)).setScale(scale, RoundingMode.HALF_UP)) .negate(); else return new BigDecimal(n, scale).subtract(new BigDecimal("1")).negate(); @@ -226,7 +227,7 @@ public static Double generateFloat(Integer n, } if (returnZero) { - return new Double(0); + return Double.valueOf(0); } // only 2 options: 24 or 53