Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CountDownLatch;

import static org.elasticsearch.bootstrap.BootstrapInfo.SERVER_READY_MARKER;
Expand Down Expand Up @@ -84,8 +84,20 @@ void drain() {
nonInterruptibleVoid(this::join);
}

/** List of messages / lines to filter from the output. */
List<String> filter = List.of("WARNING: Using incubator modules: jdk.incubator.vector");
/** Set of messages / lines to filter from the output. */
private static Set<String> filter = Set.of("WARNING: Using incubator modules: jdk.incubator.vector");

private static boolean isFilteredOut(String line) {
if (filter.contains(line)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about making the filter a predicate? then we can still have one set of filters, instead of some in the set and some in here manually

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjernst how about just using the Regex util? Or do you have concerns using something that eventually depends on Lucene? Alternatively the simple predicate below?

  /** Messages / lines predicate to filter from the output. */
  private static Predicate<String> filter = line -> {
      return "WARNING: Using incubator modules: jdk.incubator.vector".equals(line)
          || (line.startsWith("WARNING: Use of the three-letter time zone ID")
              && line.endsWith("is deprecated and it will be removed in a future release"));
  };

return true;
}
// requires log4j2 upgrade, see https://github.com/elastic/elasticsearch/issues/132035
if (line.startsWith("WARNING: Use of the three-letter time zone ID")
&& line.endsWith("is deprecated and it will be removed in a future release")) {
return true;
}
return false;
}

@Override
public void run() {
Expand All @@ -95,7 +107,7 @@ public void run() {
if (line.isEmpty() == false && line.charAt(0) == SERVER_READY_MARKER) {
ready = true;
readyOrDead.countDown();
} else if (filter.contains(line) == false) {
} else if (isFilteredOut(line) == false) {
terminal.errorPrintln(Verbosity.SILENT, line, false);
}
}
Expand Down