Skip to content

Commit

Permalink
Release | Fix issues reported by CredScanner (#1237)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulvii authored Jan 27, 2020
1 parent f5f582d commit 22279fc
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void testDefaultLoginTimeout() {

long timerStart = System.currentTimeMillis();
// Try a non existing server and see if the default timeout is 15 seconds
try (Connection con = PrepUtil.getConnection("jdbc:sqlserver://" + randomServer + ";user=sa;password=pwd;")) {
try (Connection con = PrepUtil.getConnection("jdbc:sqlserver://" + randomServer)) {
fail(TestResource.getResource("R_shouldNotConnect"));
} catch (Exception e) {
assertTrue(e.getMessage().contains(TestResource.getResource("R_tcpipConnectionToHost")));
Expand All @@ -61,7 +61,7 @@ public void testURLLoginTimeout() {
long timerStart = System.currentTimeMillis();

try (Connection con = PrepUtil
.getConnection("jdbc:sqlserver://" + randomServer + ";user=sa;password=pwd;logintimeout=" + timeout)) {
.getConnection("jdbc:sqlserver://" + randomServer + ";logintimeout=" + timeout)) {
fail(TestResource.getResource("R_shouldNotConnect"));
} catch (Exception e) {
assertTrue(e.getMessage().contains(TestResource.getResource("R_tcpipConnectionToHost")));
Expand All @@ -79,7 +79,7 @@ public void testDMLoginTimeoutApplied() {
DriverManager.setLoginTimeout(timeout);
long timerStart = System.currentTimeMillis();

try (Connection con = PrepUtil.getConnection("jdbc:sqlserver://" + randomServer + ";user=sa;password=pwd")) {
try (Connection con = PrepUtil.getConnection("jdbc:sqlserver://" + randomServer)) {
fail(TestResource.getResource("R_shouldNotConnect"));
} catch (Exception e) {
assertTrue(e.getMessage().contains(TestResource.getResource("R_tcpipConnectionToHost")));
Expand All @@ -98,7 +98,7 @@ public void testDMLoginTimeoutNotApplied() {
long timerStart = System.currentTimeMillis();

try (Connection con = PrepUtil.getConnection(
"jdbc:sqlserver://" + randomServer + ";user=sa;password=pwd;loginTimeout=" + timeout)) {
"jdbc:sqlserver://" + randomServer + ";loginTimeout=" + timeout)) {
fail(TestResource.getResource("R_shouldNotConnect"));
} catch (Exception e) {
assertTrue(e.getMessage().contains(TestResource.getResource("R_tcpipConnectionToHost")));
Expand Down

0 comments on commit 22279fc

Please sign in to comment.