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

CertificateFactory javadoc contains broken example code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • security-libs
    • beta
    • generic
    • generic



      Name: boT120536 Date: 11/09/2000


      Not applicable - documentation error.

        From the javadoc for java.security.cert.CertificateFactory

      > FileInputStream fis = new FileInputStream(filename);
      > DataInputStream dis = new DataInputStream(fis);
      >
      > CertificateFactory cf = CertificateFactory.getInstance("X.509");
      >
      > byte[] bytes = new byte[dis.available()];
      > dis.readFully(bytes);
      > ByteArrayInputStream bais = new ByteArrayInputStream(bytes);

      This code is broken, dis.avaliable() does not equal length of fis. Please
      don't include broken code in javadoc as inexperienced programmers, foolishly
      I'll admit, think examples should be correct. No liability assumed, but you
      would probably save a few other people out there a bit of pain if you fix this.
      (Review ID: 110798)
      ======================================================================

            mullan Sean Mullan
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: