8067801: Enforce null check for underlying I/O streams

Reviewed-by: lancea
This commit is contained in:
Brian Burkhalter 2019-07-17 14:24:37 -07:00
parent 60530bae7c
commit a7016e3b5d
3 changed files with 86 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2019, 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
@ -59,6 +59,9 @@ class FilterInputStream extends InputStream {
* this instance is to be created without an underlying stream.
*/
protected FilterInputStream(InputStream in) {
if (in == null) {
throw new NullPointerException();
}
this.in = in;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2019, 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
@ -67,6 +67,10 @@ public class FilterOutputStream extends OutputStream {
* created without an underlying stream.
*/
public FilterOutputStream(OutputStream out) {
if (out == null) {
throw new NullPointerException();
}
this.out = out;
}