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

typo in doc for ZipEntry.setExtra()

    Details

    • Subcomponent:
    • Resolved In Build:
      hopper
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description



      Name: sdC67446 Date: 02/14/2000


      The doc for 'java.util.zip.ZipEntry' says that
      setExtra(byte[] extra) should throw IllegalArgumentException if
      'extra'.length>(0xFFFFF). In fact the method throws IAE if
      'extra'.length>(0xFFFF).
      It must be a typo..

      The java-doc says:
      ------------------------------------------------------------

          /**
           * Sets the optional extra field data for the entry.
           * @param extra the extra field data bytes
           * @exception IllegalArgumentException if the length of the specified
           * extra field data is greater than 0xFFFFF bytes
           * @see #getExtra()
           */
          public void setExtra(byte[] extra)


      The demo:
      ------------------------------------------------------------
      import java.util.zip.*;
      public class Test {
          public static void main(String[] args) {
              ZipEntry ze = new ZipEntry("Big Bog Bug!");
              ze.setExtra(new byte[0xFFFF+1]);
          }
      }


      The output:
      ------------------------------------------------------------
      Exception in thread "main" java.lang.IllegalArgumentException: invalid extra field length
              at java.util.zip.ZipEntry.setExtra(ZipEntry.java:235)
              at Test.main(Test.java:5)

      ------------------------------------------------------------
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              shommel Scott Hommel (Inactive)
              Reporter:
              dsvsunw Dsv Dsv (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: