8325304: Several classes in java.util.jar and java.util.zip don't specify the behaviour for null arguments

Reviewed-by: lancea, alanb
This commit is contained in:
Jaikiran Pai 2024-02-08 06:35:47 +00:00
parent 9cccf0515e
commit 1fb9e3d674
14 changed files with 57 additions and 27 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, 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
@ -58,6 +58,7 @@ public class JarEntry extends ZipEntry {
* specified {@code ZipEntry} object.
* @param ze the {@code ZipEntry} object to create the
* {@code JarEntry} from
* @throws NullPointerException if {@code ze} is null
*/
public JarEntry(ZipEntry ze) {
super(ze);
@ -68,6 +69,7 @@ public class JarEntry extends ZipEntry {
* specified {@code JarEntry} object.
*
* @param je the {@code JarEntry} to copy
* @throws NullPointerException if {@code je} is null
*/
public JarEntry(JarEntry je) {
this((ZipEntry)je);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, 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
@ -36,7 +36,11 @@ import sun.security.util.ManifestEntryVerifier;
* <a href="{@docRoot}/../specs/jar/jar.html#jar-manifest">Manifest</a>
* entry. The {@code Manifest} can be used to store
* meta-information about the JAR file and its entries.
*
* <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.
* </p>
* <h2>Accessing the Manifest</h2>
* <p>
* The {@link #getManifest() getManifest} method is used to return the
@ -242,7 +246,6 @@ public class JarInputStream extends ZipInputStream {
* @param len the maximum number of bytes to read
* @return the actual number of bytes read, or -1 if the end of the
* entry is reached
* @throws NullPointerException If {@code b} is {@code null}.
* @throws IndexOutOfBoundsException If {@code off} is negative,
* {@code len} is negative, or {@code len} is greater than
* {@code b.length - off}

View file

@ -35,7 +35,9 @@ import java.io.*;
* for writing an optional {@code Manifest} entry. The
* {@code Manifest} can be used to specify meta-information about
* the JAR file and its entries.
*
* <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 David Connelly
* @see Manifest
* @see java.util.zip.ZipOutputStream

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, 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
@ -43,6 +43,9 @@ import sun.security.util.SecurityProperties;
* see the
* <a href="{@docRoot}/../specs/jar/jar.html">
* Manifest format specification</a>.
* <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.
*
* @spec jar/jar.html JAR File Specification
* @author David Connelly
@ -82,7 +85,8 @@ public class Manifest implements Cloneable {
* Constructs a new Manifest from the specified input stream.
*
* @param is the input stream containing manifest data
* @param jarFilename the name of the corresponding jar archive if available
* @param jarFilename the name of the corresponding jar archive
* if available, else null
* @throws IOException if an I/O error has occurred
*/
Manifest(InputStream is, String jarFilename) throws IOException {
@ -93,7 +97,7 @@ public class Manifest implements Cloneable {
* Constructs a new Manifest from the specified input stream
* and associates it with a JarVerifier.
*
* @param jv the JarVerifier to use
* @param jv the JarVerifier to use if any, else null
* @param is the input stream containing manifest data
* @param jarFilename the name of the corresponding jar archive if available
* @throws IOException if an I/O error has occurred