Repository: microsoft/mssql-jdbc
Pull request #1676 (2021-10-29 06:45:44)

Java 17 support


Patch:
diff --git a/build.gradle b/build.gradle
index 2c631ddb..a33bb3c5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,10 +3,7 @@
  ****************************************************************
  * Instruction for Building JDBC Driver:
  * For building particular version of the driver, use commands:
- * jre16 - - PS> gradle build
-			 PS> gradle build -PbuildProfile=jre16
- * jre11 - - PS> gradle build -PbuildProfile=jre11
- * jre8  - - PS> gradle build -PbuildProfile=jre8
+ * jreXX - - PS> gradle build -PbuildProfile=jreXX
  *
  * For Excluding Groups in command line:
  * PS> gradle build -PbuildProfile=jre11 "-PexcludedGroups=['xSQLv15','xGradle']"
@@ -35,17 +32,17 @@ test {
     }
 }
 
-if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile == "jre16")){
+if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile == "jre17")){
 	
-	jreVersion = "jre16"
+	jreVersion = "jre17"
 	excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
 	jar {
 		manifest {
 			attributes 'Automatic-Module-Name': 'com.microsoft.sqlserver.jdbc'
 		}
 	}
-	sourceCompatibility = 16
-	targetCompatibility = 16
+	sourceCompatibility = 17
+	targetCompatibility = 17
 }
 
 if (hasProperty('buildProfile') && buildProfile == "jre11"){
diff --git a/pom.xml b/pom.xml
index 807ff434..1693e75b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -329,12 +329,12 @@
 			</build>
 		</profile>
 		<profile>
-			<id>jre16</id>
+			<id>jre17</id>
 			<activation>
 				<activeByDefault>true</activeByDefault>
 			</activation>
 			<build>
-				<finalName>${project.artifactId}-${project.version}.jre16${releaseExt}</finalName>
+				<finalName>${project.artifactId}-${project.version}.jre17${releaseExt}</finalName>
 				<plugins>
 					<plugin>
 						<groupId>org.apache.maven.plugins</groupId>
@@ -344,8 +344,8 @@
 							<excludes>
 								<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java</exclude>
 							</excludes>
-							<source>16</source>
-							<target>16</target>
+							<source>17</source>
+							<target>17</target>
 						</configuration>
 					</plugin>
 					<plugin>
@@ -429,8 +429,7 @@
 				<configuration>
 					<forkCount>3</forkCount>
 					<reuseForks>true</reuseForks>
-					<argLine>${argLine} --illegal-access=permit -Xmx1024m
-						-XX:MaxPermSize=256m -Djava.library.path=${dllPath}
+					<argLine>${argLine} -Xmx1024m -Djava.library.path=${dllPath}
 					</argLine>
 					<excludedGroups>${excludedGroups}</excludedGroups>
 				</configuration>
@@ -506,7 +505,7 @@
 			<plugin>
 				<groupId>org.jacoco</groupId>
 				<artifactId>jacoco-maven-plugin</artifactId>
-				<version>0.8.6</version>
+				<version>0.8.7</version>
 				<executions>
 					<execution>
 						<id>pre-test</id>


Test patch:
diff --git a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlFloat.java b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlFloat.java
index cdf227df..656cd48e 100644
--- a/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlFloat.java
+++ b/src/test/java/com/microsoft/sqlserver/testframework/sqlType/SqlFloat.java
@@ -26,10 +26,13 @@ public class SqlFloat extends SqlType {
 
     public Object createdata() {
         // for float in SQL Server, any precision <=24 is considered as real so the value must be within
-        // SqlTypeValue.REAL.minValue/maxValue
+        // SqlTypeValue.REAL.minValue/maxValue however this needs to be bounded for nextDouble origin and bound params
         if (precision > 24) {
+            minvalue = ((Double) minvalue < Double.MIN_VALUE) ? Double.MIN_VALUE : minvalue;
+            maxvalue = ((Double) maxvalue > Double.MAX_VALUE) ? Double.MAX_VALUE : maxvalue;
             return ThreadLocalRandom.current().nextDouble(((Double) minvalue), ((Double) maxvalue));
         } else {
+
             return ThreadLocalRandom.current().nextDouble((Float) SqlTypeValue.REAL.minValue,
                     (Float) SqlTypeValue.REAL.maxValue);
         }