Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8073481

Some ZipEntry setters do the wrong null checks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • core-libs
    • None
    • generic
    • generic

      in java.util.zip.ZipEntry:

           * @throws NullPointerException if the {@code time} is null
          public ZipEntry setLastAccessTime(FileTime time) {
              Objects.requireNonNull(name, "time");
              this.atime = time;
              return this;
          }

      time should be checked, not name. Same issue in setCreationTime, setLastModifiedTime

      Could be written:

          public ZipEntry setLastAccessTime(FileTime time) {
              this.atime = Objects.requireNonNull(time, "time");;
              return this;
          }

            Unassigned Unassigned
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: