From d235018a97dfe2c3bc8ad21e54e042d37ee93f78 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Thu, 3 May 2018 12:06:19 -0700 Subject: [PATCH] Fix | Changed property verification logic to throw error on invalid value even if its not being used by driver | GitHub issue #525 --- .../com/microsoft/sqlserver/jdbc/SQLServerConnection.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java index 3737eefef..56415b7e0 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java @@ -1703,12 +1703,14 @@ else if (0 == requestedPacketSize) sPropKey = SQLServerDriverIntProperty.CANCEL_QUERY_TIMEOUT.toString(); int cancelQueryTimeout = SQLServerDriverIntProperty.CANCEL_QUERY_TIMEOUT.getDefaultValue(); - // use cancelQueryTimeout only if queryTimeout is set. - if (activeConnectionProperties.getProperty(sPropKey) != null && activeConnectionProperties.getProperty(sPropKey).length() > 0 && queryTimeoutSeconds > defaultQueryTimeout) { + + if (activeConnectionProperties.getProperty(sPropKey) != null && activeConnectionProperties.getProperty(sPropKey).length() > 0) { try { int n = Integer.parseInt(activeConnectionProperties.getProperty(sPropKey)); if (n >= cancelQueryTimeout) { - cancelQueryTimeoutSeconds = n; + // use cancelQueryTimeout only if queryTimeout is set. + if(queryTimeoutSeconds > defaultQueryTimeout) + cancelQueryTimeoutSeconds = n; } else { MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_invalidCancelQueryTimeout"));