Skip to content

Commit

Permalink
Exclude JDBC 43 tests from Java 8 build
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Engel committed Jul 29, 2021
1 parent 8a65c61 commit a5af949
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions pom.xml
Expand Up @@ -254,6 +254,10 @@
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java</exclude>
<exclude>**/com/microsoft/sqlserver/jdbc/SQLServerConnection43.java</exclude>
</excludes>
<testExcludes>
<exclude>**/com/microsoft/sqlserver/jdbc/connection/ConnectionWrapper43Test.java</exclude>
<exclude>**/com/microsoft/sqlserver/jdbc/JDBC43Test.java</exclude>
</testExcludes>
<source>1.8</source>
<target>1.8</target>
</configuration>
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java
Expand Up @@ -30,20 +30,22 @@ static final void throwBatchUpdateException(SQLServerException lastError,
updateCounts, new Throwable(lastError.getMessage()));
}

private static double jvmVersion = Double.parseDouble(Util.SYSTEM_SPEC_VERSION);

static SQLServerConnection getSQLServerConnection(String parentInfo) throws SQLServerException {
return jvmVersion >= 9 ? new SQLServerConnection43(parentInfo) : new SQLServerConnection(parentInfo);
}

private static double jvmVersion = Double.parseDouble(Util.SYSTEM_SPEC_VERSION);

/** Client process ID sent during login */
private static int pid = 0;

static {
if (jvmVersion >= 9) {
long pidLong = ProcessHandle.current().pid();
pid = (pidLong > Integer.MAX_VALUE) ? 0 : (int) pidLong;
long pidLong = 0;
try {
pidLong = ProcessHandle.current().pid();
} catch (NoClassDefFoundError e) { // ProcessHandle is Java 9+
}
pid = (pidLong > Integer.MAX_VALUE) ? 0 : (int) pidLong;
}

static int getProcessId() {
Expand Down

0 comments on commit a5af949

Please sign in to comment.