Skip to content

Commit

Permalink
[cleanup] erefactor/EclipseJdt - Remove trailing whitespace - All lin…
Browse files Browse the repository at this point in the history
…es (#1752)

EclipseJdt cleanup 'RemoveAllTrailingWhitespace' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.18/jdt.php
For erefactor see https://github.com/cal101/erefactor

Co-authored-by: Leo Bayer <lfbayer@gmail.com>
  • Loading branch information
cal101 and lfbayer committed Sep 15, 2023
1 parent c37074d commit 8c202e4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/zaxxer/hikari/pool/ProxyLeakTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void run()

final var stackTrace = exception.getStackTrace();
final var trace = new StackTraceElement[stackTrace.length - 5];

System.arraycopy(stackTrace, 5, trace, 0, trace.length);

exception.setStackTrace(trace);
Expand Down
22 changes: 11 additions & 11 deletions src/test/java/com/zaxxer/hikari/pool/TestConcurrentBag.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,36 +71,36 @@ public void testConcurrentBag() throws Exception
{
try (ConcurrentBag<PoolEntry> bag = new ConcurrentBag<>(x -> CompletableFuture.completedFuture(Boolean.TRUE))) {
assertEquals(0, bag.values(8).size());

PoolEntry reserved = pool.newPoolEntry();
bag.add(reserved);
bag.reserve(reserved); // reserved

PoolEntry inuse = pool.newPoolEntry();
bag.add(inuse);
bag.borrow(2, MILLISECONDS); // in use

PoolEntry notinuse = pool.newPoolEntry();
bag.add(notinuse); // not in use

bag.dumpState();

ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos, true);
setSlf4jTargetStream(ConcurrentBag.class, ps);

bag.requite(reserved);

bag.remove(notinuse);
assertTrue(new String(baos.toByteArray()).contains("not borrowed or reserved"));

bag.unreserve(notinuse);
assertTrue(new String(baos.toByteArray()).contains("was not reserved"));

bag.remove(inuse);
bag.remove(inuse);
assertTrue(new String(baos.toByteArray()).contains("not borrowed or reserved"));

bag.close();
try {
PoolEntry bagEntry = pool.newPoolEntry();
Expand All @@ -110,7 +110,7 @@ public void testConcurrentBag() throws Exception
catch (IllegalStateException e) {
assertTrue(new String(baos.toByteArray()).contains("ignoring add()"));
}

assertNotNull(notinuse.toString());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ public void testConnectionCloseBlocking() throws SQLException {
long start = currentTime();
try (HikariDataSource ds = new HikariDataSource(config);
Connection connection = ds.getConnection()) {

connection.close();

// Hikari only checks for validity for connections with lastAccess > 1000 ms so we sleep for 1001 ms to force
// Hikari to do a connection validation which will fail and will trigger the connection to be closed
quietlySleep(1100L);

shouldFail = true;

// on physical connection close we sleep 2 seconds
try (Connection connection2 = ds.getConnection()) {
try (Connection connection2 = ds.getConnection()) {
assertTrue("Waited longer than timeout", (elapsedMillis(start) < config.getConnectionTimeout()));
}
} catch (SQLException e) {
Expand Down
22 changes: 11 additions & 11 deletions src/test/java/com/zaxxer/hikari/pool/TestProxies.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,87 +231,87 @@ public void testOtherExceptions() throws SQLException
try (Connection conn = ds.getConnection()) {
StubConnection stubConnection = conn.unwrap(StubConnection.class);
stubConnection.throwException = true;

try {
conn.setTransactionIsolation(Connection.TRANSACTION_NONE);
fail();
}
catch (SQLException e) {
// pass
}

try {
conn.isReadOnly();
fail();
}
catch (SQLException e) {
// pass
}

try {
conn.setReadOnly(false);
fail();
}
catch (SQLException e) {
// pass
}

try {
conn.setCatalog("");
fail();
}
catch (SQLException e) {
// pass
}

try {
conn.setAutoCommit(false);
fail();
}
catch (SQLException e) {
// pass
}

try {
conn.clearWarnings();
fail();
}
catch (SQLException e) {
// pass
}

try {
conn.isValid(0);
fail();
}
catch (SQLException e) {
// pass
}

try {
conn.isWrapperFor(getClass());
fail();
}
catch (SQLException e) {
// pass
}

try {
conn.unwrap(getClass());
fail();
}
catch (SQLException e) {
// pass
}

try {
conn.close();
fail();
}
catch (SQLException e) {
// pass
}

try {
assertFalse(conn.isValid(0));
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/zaxxer/hikari/util/ClockSourceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testClockSourceDisplay()
String ds2 = msSource.elapsedDisplayString0(sTime, eTime2);
Assert.assertEquals("-59m54s795ms", ds2);


ClockSource nsSource = new ClockSource.NanosecondClockSource();

final long sTime2 = DAYS.toNanos(3) + HOURS.toNanos(9) + MINUTES.toNanos(24) + SECONDS.toNanos(18) + MILLISECONDS.toNanos(572) + MICROSECONDS.toNanos(324) + NANOSECONDS.toNanos(823);
Expand Down

0 comments on commit 8c202e4

Please sign in to comment.