mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-03 12:40:10 +00:00
8058464: (process spec) ProcessBuilder.redirectXXX throws unspecified NPE
Add a class level spec for null arguments throwing NPE in ProcessBuilder Reviewed-by: martin, alanb
This commit is contained in:
parent
71d53d5bb7
commit
367a429ff4
@ -171,6 +171,11 @@ import java.util.Map;
|
||||
* variables, first call {@link java.util.Map#clear() Map.clear()}
|
||||
* before adding environment variables.
|
||||
*
|
||||
* <p>
|
||||
* Unless otherwise noted, passing a {@code null} argument to a constructor
|
||||
* or method in this class will cause a {@link NullPointerException} to be
|
||||
* thrown.
|
||||
*
|
||||
* @author Martin Buchholz
|
||||
* @since 1.5
|
||||
*/
|
||||
@ -193,7 +198,6 @@ public final class ProcessBuilder
|
||||
* command.
|
||||
*
|
||||
* @param command the list containing the program and its arguments
|
||||
* @throws NullPointerException if the argument is null
|
||||
*/
|
||||
public ProcessBuilder(List<String> command) {
|
||||
if (command == null)
|
||||
@ -228,8 +232,6 @@ public final class ProcessBuilder
|
||||
*
|
||||
* @param command the list containing the program and its arguments
|
||||
* @return this process builder
|
||||
*
|
||||
* @throws NullPointerException if the argument is null
|
||||
*/
|
||||
public ProcessBuilder command(List<String> command) {
|
||||
if (command == null)
|
||||
@ -554,7 +556,6 @@ public final class ProcessBuilder
|
||||
* }</pre>
|
||||
*
|
||||
* @param file The {@code File} for the {@code Redirect}.
|
||||
* @throws NullPointerException if the specified file is null
|
||||
* @return a redirect to read from the specified file
|
||||
*/
|
||||
public static Redirect from(final File file) {
|
||||
@ -581,7 +582,6 @@ public final class ProcessBuilder
|
||||
* }</pre>
|
||||
*
|
||||
* @param file The {@code File} for the {@code Redirect}.
|
||||
* @throws NullPointerException if the specified file is null
|
||||
* @return a redirect to write to the specified file
|
||||
*/
|
||||
public static Redirect to(final File file) {
|
||||
@ -612,7 +612,6 @@ public final class ProcessBuilder
|
||||
* }</pre>
|
||||
*
|
||||
* @param file The {@code File} for the {@code Redirect}.
|
||||
* @throws NullPointerException if the specified file is null
|
||||
* @return a redirect to append to the specified file
|
||||
*/
|
||||
public static Redirect appendTo(final File file) {
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
* @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689
|
||||
* 5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313
|
||||
* 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958
|
||||
* 4947220 7018606 7034570 4244896 5049299 8003488 8054494
|
||||
* 4947220 7018606 7034570 4244896 5049299 8003488 8054494 8058464
|
||||
* @summary Basic tests for Process and Environment Variable code
|
||||
* @run main/othervm/timeout=300 Basic
|
||||
* @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic
|
||||
@ -941,6 +941,14 @@ public class Basic {
|
||||
() -> pb.redirectOutput(Redirect.from(ifile)),
|
||||
() -> pb.redirectError(Redirect.from(ifile)));
|
||||
|
||||
THROWS(NullPointerException.class,
|
||||
() -> pb.redirectInput((File)null),
|
||||
() -> pb.redirectOutput((File)null),
|
||||
() -> pb.redirectError((File)null),
|
||||
() -> pb.redirectInput((Redirect)null),
|
||||
() -> pb.redirectOutput((Redirect)null),
|
||||
() -> pb.redirectError((Redirect)null));
|
||||
|
||||
THROWS(IOException.class,
|
||||
// Input file does not exist
|
||||
() -> pb.start());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user