Skip to content
Permalink
Browse files
8274621: NullPointerException because listenAddress[0] is null
Reviewed-by: sspitsyn, lmesnik, cjplummer
  • Loading branch information
Alex Menkov committed Oct 29, 2021
1 parent 5021a12 commit 5bbc8d3cb2ce487b367ee1a621d78699c9b30100
Showing with 14 additions and 10 deletions.
  1. +14 −10 test/lib/jdk/test/lib/process/ProcessTools.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -116,12 +116,12 @@ public static Process startProcess(String name,
* <span>The default redirects of STDOUT and STDERR are started</span>
* <p>
* It is possible to wait for the process to get to a warmed-up state
* via {@linkplain Predicate} condition on the STDOUT
* via {@linkplain Predicate} condition on the STDOUT/STDERR
* </p>
*
* @param name The process name
* @param processBuilder The process builder
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT and STDERR.
* Used to determine the moment the target app is
* properly warmed-up.
* It can be null - in that case the warmup is skipped.
@@ -146,14 +146,14 @@ public static Process startProcess(String name,
* <span>The default redirects of STDOUT and STDERR are started</span>
* <p>
* It is possible to wait for the process to get to a warmed-up state
* via {@linkplain Predicate} condition on the STDOUT and monitor the
* via {@linkplain Predicate} condition on the STDOUT/STDERR and monitor the
* in-streams via the provided {@linkplain Consumer}
* </p>
*
* @param name The process name
* @param processBuilder The process builder
* @param lineConsumer The {@linkplain Consumer} the lines will be forwarded to
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT and STDERR.
* Used to determine the moment the target app is
* properly warmed-up.
* It can be null - in that case the warmup is skipped.
@@ -193,10 +193,14 @@ protected void processLine(String line) {
CountDownLatch latch = new CountDownLatch(1);
if (linePredicate != null) {
StreamPumper.LinePump pump = new StreamPumper.LinePump() {
// synchronization between stdout and stderr pumps
private final Object sync = new Object();
@Override
protected void processLine(String line) {
if (latch.getCount() > 0 && linePredicate.test(line)) {
latch.countDown();
synchronized (sync) {
if (latch.getCount() > 0 && linePredicate.test(line)) {
latch.countDown();
}
}
}
};
@@ -241,13 +245,13 @@ protected void processLine(String line) {
* <span>The default redirects of STDOUT and STDERR are started</span>
* <p>
* It is possible to wait for the process to get to a warmed-up state
* via {@linkplain Predicate} condition on the STDOUT. The warm-up will
* wait indefinitely.
* via {@linkplain Predicate} condition on the STDOUT/STDERR.
* The warm-up will wait indefinitely.
* </p>
*
* @param name The process name
* @param processBuilder The process builder
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT and STDERR.
* Used to determine the moment the target app is
* properly warmed-up.
* It can be null - in that case the warmup is skipped.

1 comment on commit 5bbc8d3

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 5bbc8d3 Oct 29, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.