mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8296143: CertAttrSet's set/get mechanism is not type-safe
Reviewed-by: mullan
This commit is contained in:
parent
d04d6566b0
commit
671f84bd86
66 changed files with 643 additions and 2902 deletions
|
@ -44,13 +44,9 @@ import sun.security.util.*;
|
|||
* @see CertAttrSet
|
||||
*/
|
||||
public class CRLNumberExtension extends Extension
|
||||
implements CertAttrSet<String> {
|
||||
implements CertAttrSet {
|
||||
|
||||
/**
|
||||
* Attribute name.
|
||||
*/
|
||||
public static final String NAME = "CRLNumber";
|
||||
public static final String NUMBER = "value";
|
||||
|
||||
private static final String LABEL = "CRL Number";
|
||||
|
||||
|
@ -135,31 +131,10 @@ implements CertAttrSet<String> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the attribute value.
|
||||
* Get the crlNumber value.
|
||||
*/
|
||||
public void set(String name, Object obj) throws IOException {
|
||||
if (name.equalsIgnoreCase(NUMBER)) {
|
||||
if (!(obj instanceof BigInteger)) {
|
||||
throw new IOException("Attribute must be of type BigInteger.");
|
||||
}
|
||||
crlNumber = (BigInteger)obj;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by" +
|
||||
" CertAttrSet:" + extensionName + '.');
|
||||
}
|
||||
encodeThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attribute value.
|
||||
*/
|
||||
public BigInteger get(String name) throws IOException {
|
||||
if (name.equalsIgnoreCase(NUMBER)) {
|
||||
return crlNumber;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by" +
|
||||
" CertAttrSet:" + extensionName + '.');
|
||||
}
|
||||
public BigInteger getCrlNumber() {
|
||||
return crlNumber;
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,10 +181,10 @@ implements CertAttrSet<String> {
|
|||
|
||||
|
||||
/**
|
||||
* Return the name of this attribute.
|
||||
* Return the name of this extension.
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return (extensionName);
|
||||
return extensionName;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue