- 
    Type:
Bug
 - 
    Resolution: Fixed
 - 
    Priority:
  P4                     
     - 
    Affects Version/s: 5.0
 - 
    Component/s: 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
            
---------------------------------
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
- csr for
 - 
                    
JDK-8292299 (spec) javax.crypto.MacSpi.engineUpdate(ByteBuffer input): NPE should be specified
-         
     - Closed
 
 -