src/java.base/share/classes/javax/security/auth/callback/ChoiceCallback.java
changeset 53018 8bf9268df0e2
parent 47216 71c04702a3d5
child 57950 4612a3cfb927
equal deleted inserted replaced
53017:e10a1f7aaa13 53018:8bf9268df0e2
    96      *                  {@code choices}.
    96      *                  {@code choices}.
    97      */
    97      */
    98     public ChoiceCallback(String prompt, String[] choices,
    98     public ChoiceCallback(String prompt, String[] choices,
    99                 int defaultChoice, boolean multipleSelectionsAllowed) {
    99                 int defaultChoice, boolean multipleSelectionsAllowed) {
   100 
   100 
   101         if (prompt == null || prompt.length() == 0 ||
   101         if (prompt == null || prompt.isEmpty() ||
   102             choices == null || choices.length == 0 ||
   102             choices == null || choices.length == 0 ||
   103             defaultChoice < 0 || defaultChoice >= choices.length)
   103             defaultChoice < 0 || defaultChoice >= choices.length)
   104             throw new IllegalArgumentException();
   104             throw new IllegalArgumentException();
   105 
   105 
   106         for (int i = 0; i < choices.length; i++) {
   106         for (int i = 0; i < choices.length; i++) {
   107             if (choices[i] == null || choices[i].length() == 0)
   107             if (choices[i] == null || choices[i].isEmpty())
   108                 throw new IllegalArgumentException();
   108                 throw new IllegalArgumentException();
   109         }
   109         }
   110 
   110 
   111         this.prompt = prompt;
   111         this.prompt = prompt;
   112         this.choices = choices;
   112         this.choices = choices;