Skip to content

Commit

Permalink
pmd fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hgschmie committed Sep 12, 2024
1 parent cac00ee commit dd45a92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public DatabaseManager start() throws IOException, SQLException {
dataSource = pg.createDefaultDataSource();

// always return a reference to the default database.
this.instanceProvider = () -> pg.createDefaultDatabaseInfo();
this.instanceProvider = pg::createDefaultDatabaseInfo;
}

for (EmbeddedPostgresPreparer<DataSource> databasePreparer : databasePreparers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ private boolean waitForServerStartup() throws IOException {
throw new IOException("Gave up waiting for server to start after " + serverStartupWait.toMillis() + "ms", lastCause);
}

@SuppressWarnings("PMD.CheckResultSet") // see https://github.com/pmd/pmd/issues/5209 / https://github.com/pmd/pmd/issues/5031
private boolean verifyReady() throws IOException, SQLException {
// check TCP connection
final InetAddress localhost = InetAddress.getLoopbackAddress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* <p>
* The use of the input stream is thread safe since it's used only in a single thread&mdash;the one launched by this code.
*/
class ProcessOutputLogger implements Closeable {
final class ProcessOutputLogger implements Closeable {

private final Logger logger;
private final ListeningExecutorService executorService;
Expand All @@ -63,7 +63,7 @@ StreamCapture captureStreamAsConsumer(Consumer<String> consumer) {
}


class StreamCapture implements BiConsumer<String, InputStream> {
final class StreamCapture implements BiConsumer<String, InputStream> {

private final Consumer<String> consumer;
private volatile Future<?> completionFuture = null;
Expand All @@ -82,7 +82,7 @@ public Future<?> getCompletion() {
}
}

private class LogRunnable implements Runnable {
private final class LogRunnable implements Runnable {

private final InputStream inputStream;
private final String name;
Expand All @@ -101,7 +101,7 @@ public void run() {
try (InputStreamReader isr = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
BufferedReader reader = new BufferedReader(isr)) {
try {
reader.lines().forEach(consumer::accept);
reader.lines().forEach(consumer);
} catch (final UncheckedIOException e) {
logger.error("while reading output:", e);
}
Expand Down

0 comments on commit dd45a92

Please sign in to comment.