Skip to content

Commit 5023971

Browse files
author
Mark Powers
committed
8267068: Incomplete @throws javadoc for various javax.crypto.spec classes
Reviewed-by: valeriep, jnimeh
1 parent 08bc59d commit 5023971

File tree

4 files changed

+32
-30
lines changed

4 files changed

+32
-30
lines changed

src/java.base/share/classes/javax/crypto/spec/IvParameterSpec.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -47,30 +47,30 @@ public class IvParameterSpec implements AlgorithmParameterSpec {
4747
*
4848
* @param iv the buffer with the IV. The contents of the
4949
* buffer are copied to protect against subsequent modification.
50-
* @throws NullPointerException if <code>iv</code> is <code>null</code>
50+
* @throws NullPointerException if {@code iv} is {@code null}
5151
*/
5252
public IvParameterSpec(byte[] iv) {
5353
this(iv, 0, iv.length);
5454
}
5555

5656
/**
57-
* Creates an IvParameterSpec object using the first <code>len</code>
58-
* bytes in <code>iv</code>, beginning at <code>offset</code>
57+
* Creates an IvParameterSpec object using the first {@code len}
58+
* bytes in {@code iv}, beginning at {@code offset}
5959
* inclusive, as the IV.
6060
*
6161
* <p> The bytes that constitute the IV are those between
62-
* <code>iv[offset]</code> and <code>iv[offset+len-1]</code> inclusive.
62+
* {@code iv[offset]} and {@code iv[offset+len-1]} inclusive.
6363
*
64-
* @param iv the buffer with the IV. The first <code>len</code>
65-
* bytes of the buffer beginning at <code>offset</code> inclusive
64+
* @param iv the buffer with the IV. The first {@code len}
65+
* bytes of the buffer beginning at {@code offset} inclusive
6666
* are copied to protect against subsequent modification.
67-
* @param offset the offset in <code>iv</code> where the IV
67+
* @param offset the offset in {@code iv} where the IV
6868
* starts.
6969
* @param len the number of IV bytes.
70-
* @throws IllegalArgumentException if <code>iv</code> is <code>null</code>
70+
* @throws IllegalArgumentException if {@code iv} is {@code null}
7171
* or {@code (iv.length - offset < len)}
72-
* @throws ArrayIndexOutOfBoundsException is thrown if <code>offset</code>
73-
* or <code>len</code> index bytes outside the <code>iv</code>.
72+
* @throws ArrayIndexOutOfBoundsException if {@code offset}
73+
* or {@code len} are negative.
7474
*/
7575
public IvParameterSpec(byte[] iv, int offset, int len) {
7676
if (iv == null) {

src/java.base/share/classes/javax/crypto/spec/RC2ParameterSpec.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -91,7 +91,10 @@ public RC2ParameterSpec(int effectiveKeyBits, byte[] iv) {
9191
* are copied to protect against subsequent modification.
9292
* @param offset the offset in {@code iv} where the 8-byte IV
9393
* starts.
94-
* @exception IllegalArgumentException if {@code iv} is null.
94+
* @exception IllegalArgumentException if {@code iv} is {@code null}
95+
* or {@code iv.length - offset < 8}.
96+
* @exception ArrayIndexOutOfBoundsException if
97+
* {@code offset} is negative.
9598
*/
9699
public RC2ParameterSpec(int effectiveKeyBits, byte[] iv, int offset) {
97100
this.effectiveKeyBits = effectiveKeyBits;

src/java.base/share/classes/javax/crypto/spec/RC5ParameterSpec.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -106,9 +106,9 @@ public RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv) {
106106
* bytes of the buffer beginning at {@code offset}
107107
* inclusive are copied to protect against subsequent modification.
108108
* @param offset the offset in {@code iv} where the IV starts.
109-
* @exception IllegalArgumentException if {@code iv} is
110-
* {@code null} or
111-
* {@code (iv.length - offset < 2 * (wordSize / 8))}
109+
* @exception ArrayIndexOutOfBoundsException if {@code offset} is negative.
110+
* @exception IllegalArgumentException if {@code iv} is {@code null}
111+
* or {@code (iv.length - offset < 2 * (wordSize / 8))}
112112
*/
113113
public RC5ParameterSpec(int version, int rounds, int wordSize,
114114
byte[] iv, int offset) {

src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,27 +113,27 @@ public SecretKeySpec(byte[] key, String algorithm) {
113113

114114
/**
115115
* Constructs a secret key from the given byte array, using the first
116-
* <code>len</code> bytes of <code>key</code>, starting at
117-
* <code>offset</code> inclusive.
116+
* {@code len} bytes of {@code key}, starting at
117+
* {@code offset} inclusive.
118118
*
119119
* <p> The bytes that constitute the secret key are
120-
* those between <code>key[offset]</code> and
121-
* <code>key[offset+len-1]</code> inclusive.
120+
* those between {@code key[offset]} and
121+
* {@code key[offset+len-1]} inclusive.
122122
*
123123
* <p>This constructor does not check if the given bytes indeed specify a
124124
* secret key of the specified algorithm. For example, if the algorithm is
125-
* DES, this constructor does not check if <code>key</code> is 8 bytes
125+
* DES, this constructor does not check if {@code key} is 8 bytes
126126
* long, and also does not check for weak or semi-weak keys.
127127
* In order for those checks to be performed, an algorithm-specific key
128128
* specification class (in this case:
129129
* {@link DESKeySpec DESKeySpec})
130130
* must be used.
131131
*
132132
* @param key the key material of the secret key. The first
133-
* <code>len</code> bytes of the array beginning at
134-
* <code>offset</code> inclusive are copied to protect
133+
* {@code len} bytes of the array beginning at
134+
* {@code offset} inclusive are copied to protect
135135
* against subsequent modification.
136-
* @param offset the offset in <code>key</code> where the key material
136+
* @param offset the offset in {@code key} where the key material
137137
* starts.
138138
* @param len the length of the key material.
139139
* @param algorithm the name of the secret key algorithm to be associated
@@ -142,12 +142,11 @@ public SecretKeySpec(byte[] key, String algorithm) {
142142
* <a href="{@docRoot}/../specs/security/standard-names.html#secretkey-algorithms">
143143
* Java Security Standard Algorithm Names Specification</a>
144144
* for information about standard secret key algorithm names.
145-
* @exception IllegalArgumentException if <code>algorithm</code>
146-
* is null or <code>key</code> is null, empty, or too short,
145+
* @exception IllegalArgumentException if {@code algorithm}
146+
* is {@code null} or {@code key} is {@code null}, empty, or too short,
147147
* i.e. {@code key.length-offset<len}.
148-
* @exception ArrayIndexOutOfBoundsException is thrown if
149-
* <code>offset</code> or <code>len</code> index bytes outside the
150-
* <code>key</code>.
148+
* @exception ArrayIndexOutOfBoundsException if
149+
* {@code offset} or {@code len} are negative.
151150
*
152151
* @spec security/standard-names.html Java Security Standard Algorithm Names
153152
*/

0 commit comments

Comments
 (0)