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
Prev Previous commit
per review, protect other constructors
  • Loading branch information
ottobackwards committed Apr 14, 2020
commit 2dcd21b60c8a6929d5fb312e9f585b4f622a2c8b
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public String getDefaultEncoding() {
* @throws IOException thrown if there is a problem reading the file.
*/
public XmlStreamReader(final File file) throws IOException {
this(new FileInputStream(file));
this(new FileInputStream(Objects.requireNonNull(file)));
}

/**
Expand Down Expand Up @@ -240,7 +240,7 @@ public XmlStreamReader(final InputStream inputStream, final boolean lenient, fin
* the URL.
*/
public XmlStreamReader(final URL url) throws IOException {
this(url.openConnection(), null);
this(Objects.requireNonNull(url, "url").openConnection(), null);
}

/**
Expand All @@ -263,6 +263,7 @@ public XmlStreamReader(final URL url) throws IOException {
* the URLConnection.
*/
public XmlStreamReader(final URLConnection conn, final String defaultEncoding) throws IOException {
Objects.requireNonNull(conn, "conm");
this.defaultEncoding = defaultEncoding;
final boolean lenient = true;
final String contentType = conn.getContentType();
Expand Down Expand Up @@ -335,6 +336,7 @@ public XmlStreamReader(final InputStream inputStream, final String httpContentTy
*/
public XmlStreamReader(final InputStream inputStream, final String httpContentType,
final boolean lenient, final String defaultEncoding) throws IOException {
Objects.requireNonNull(inputStream, "inputStream");
this.defaultEncoding = defaultEncoding;
final BOMInputStream bom = new BOMInputStream(new BufferedInputStream(inputStream, BUFFER_SIZE), false, BOMS);
final BOMInputStream pis = new BOMInputStream(bom, true, XML_GUESS_BYTES);
Expand Down