Skip to content

Commit

Permalink
Fix | Changed property verification logic to throw error on invalid v…
Browse files Browse the repository at this point in the history
…alue even if its not being used by driver | GitHub issue microsoft#525
  • Loading branch information
cheenamalhotra committed May 3, 2018
1 parent b60068c commit d235018
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit d235018

Please sign in to comment.