mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8286503: Enhance security classes
Reviewed-by: rhalade, mullan, skoivu, weijun
This commit is contained in:
parent
195c9b2c48
commit
adca97b659
39 changed files with 931 additions and 149 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -25,6 +25,9 @@
|
|||
|
||||
package javax.security.auth.callback;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
|
||||
/**
|
||||
* <p> Underlying security services instantiate and pass a
|
||||
* {@code ConfirmationCallback} to the {@code handle}
|
||||
|
@ -147,7 +150,7 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
|
|||
* @serial
|
||||
* @since 1.4
|
||||
*/
|
||||
private final String[] options;
|
||||
private String[] options;
|
||||
/**
|
||||
* @serial
|
||||
* @since 1.4
|
||||
|
@ -252,16 +255,16 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
|
|||
defaultOption < 0 || defaultOption >= options.length)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
this.prompt = null;
|
||||
this.messageType = messageType;
|
||||
this.optionType = UNSPECIFIED_OPTION;
|
||||
this.defaultOption = defaultOption;
|
||||
|
||||
this.options = options.clone();
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
if (options[i] == null || options[i].isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
this.prompt = null;
|
||||
this.messageType = messageType;
|
||||
this.optionType = UNSPECIFIED_OPTION;
|
||||
this.options = options.clone();
|
||||
this.defaultOption = defaultOption;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -372,16 +375,16 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
|
|||
defaultOption < 0 || defaultOption >= options.length)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
this.prompt = prompt;
|
||||
this.messageType = messageType;
|
||||
this.optionType = UNSPECIFIED_OPTION;
|
||||
this.defaultOption = defaultOption;
|
||||
|
||||
this.options = options.clone();
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
if (options[i] == null || options[i].isEmpty())
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
this.prompt = prompt;
|
||||
this.messageType = messageType;
|
||||
this.optionType = UNSPECIFIED_OPTION;
|
||||
this.options = options.clone();
|
||||
this.defaultOption = defaultOption;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -487,4 +490,20 @@ public class ConfirmationCallback implements Callback, java.io.Serializable {
|
|||
public int getSelectedIndex() {
|
||||
return selection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the state of this object from the stream.
|
||||
*
|
||||
* @param stream the {@code ObjectInputStream} from which data is read
|
||||
* @throws IOException if an I/O error occurs
|
||||
* @throws ClassNotFoundException if a serialized class cannot be loaded
|
||||
*/
|
||||
@java.io.Serial
|
||||
private void readObject(ObjectInputStream stream)
|
||||
throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
if (options != null) {
|
||||
options = options.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue