Skip to content

Commit

Permalink
8274621: NullPointerException because listenAddress[0] is null
Browse files Browse the repository at this point in the history
Reviewed-by: sspitsyn, lmesnik, cjplummer
  • Loading branch information
Alex Menkov committed Oct 29, 2021
1 parent 5021a12 commit 5bbc8d3
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions test/lib/jdk/test/lib/process/ProcessTools.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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();
}
}
}
};
Expand Down Expand Up @@ -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.
Expand Down

5 comments on commit 5bbc8d3

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 5bbc8d3 Dec 21, 2023

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 5bbc8d3 Dec 21, 2023

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch backport-GoeLin-5bbc8d3c in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 5bbc8d3c from the openjdk/jdk repository.

The commit being backported was authored by Alex Menkov on 29 Oct 2021 and was reviewed by Serguei Spitsyn, Leonid Mesnik and Chris Plummer.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git backport-GoeLin-5bbc8d3c:backport-GoeLin-5bbc8d3c
$ git checkout backport-GoeLin-5bbc8d3c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git backport-GoeLin-5bbc8d3c

@luchenlin
Copy link

Choose a reason for hiding this comment

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

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 5bbc8d3 Jan 9, 2024

Choose a reason for hiding this comment

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

@luchenlin the backport was successfully created on the branch backport-luchenlin-5bbc8d3c in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 5bbc8d3c from the openjdk/jdk repository.

The commit being backported was authored by Alex Menkov on 29 Oct 2021 and was reviewed by Serguei Spitsyn, Leonid Mesnik and Chris Plummer.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev.git backport-luchenlin-5bbc8d3c:backport-luchenlin-5bbc8d3c
$ git checkout backport-luchenlin-5bbc8d3c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev.git backport-luchenlin-5bbc8d3c

Please sign in to comment.