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

(spec) javax.crypto.MacSpi.engineUpdate(ByteBuffer input): NPE should be specified

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 5.0
    • security-libs
    • b13
    • generic
    • generic
    • Verified

      Method javax.crypto.MacSpi.engineUpdate(ByteBuffer input) throws NullPointerException if input paramter is null. Such behavior is not specified and should be documented. Here is an example:
      ---------------------------------
      import javax.crypto.MacSpi;
      import java.nio.ByteBuffer;
      import java.security.spec.AlgorithmParameterSpec;
      import java.security.Key;

      public class B {
          public static void main(String[] args) {
              try {
                  new MacSpiImpl().engineUpdate(null);
              } catch (NullPointerException e) {
                  System.out.println("NPE was thrown");
              }
          }
      }

      class MacSpiImpl extends MacSpi {
          protected byte[] engineDoFinal() {
              byte[] b = null;
              return b;
          }

          protected int engineGetMacLength() {
              return 0;
          }

          protected void engineInit(Key key, AlgorithmParameterSpec params) {}

          protected void engineReset() {}

          protected void engineUpdate(byte input) {}

          protected void engineUpdate(byte[] input, int offset, int len) {}

          public void engineUpdate(ByteBuffer input) {
              super.engineUpdate(input);
          }
      }
      -------------------------------
      aag@gaff:~/work/bugs/doc> javac B.java;java B
      NPE was thrown

      ###@###.### 2004-12-08 10:39:49 GMT

            kdriver Kevin Driver
            agavrilosunw Alexey Gavrilov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: