RFR: JDK-8265496: improve null check in DeflaterOutputStream/InflaterInputStream

Hamlin Li mli at openjdk.java.net
Mon Apr 26 01:23:46 UTC 2021


code like below will create Deflater before null check, although it's not a real mem leak, but it's better to do null check before new Deflater.

        try {
            DeflaterOutputStream dos = new DeflaterOutputStream(null);
        } catch (NullPointerException e) {
            passed = true;
        }
Similar issues exist in several other classes.

-------------

Commit messages:
 - JDK-8265496: improve null check in DeflaterOutputStream/InflaterInputStream

Changes: https://git.openjdk.java.net/jdk/pull/3681/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3681&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8265496
  Stats: 7 lines in 7 files changed: 0 ins; 0 del; 7 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3681.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3681/head:pull/3681

PR: https://git.openjdk.java.net/jdk/pull/3681


More information about the core-libs-dev mailing list