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

File reading code in tutorial Security -- Gen/Verify Signatures trail is faulty.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7-pool
    • 5.0
    • docs
    • a
    • x86
    • windows_xp
    • Not verified

      A DESCRIPTION OF THE PROBLEM :
      The file reading code in the exmple, here:

      FileInputStream fis = new FileInputStream(args[0]);
      BufferedInputStream bufin = new BufferedInputStream(fis);
      byte[] buffer = new byte[1024];
      int len;
      while (bufin.available() != 0) {
          len = bufin.read(buffer);
          dsa.update(buffer, 0, len);
      };
      bufin.close();

      is invalid -- .available() is used incorrectly and as such the entire file may not be read. A reader may in fact encounter a problem with this code.


      URL OF FAULTY DOCUMENTATION :
      http://java.sun.com/docs/books/tutorial/security1.2/apisign/step3.html
      ###@###.### 2005-1-04 18:46:50 GMT

            sharonz Sharon Zakhour (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: