< prev index next >

src/java.base/share/classes/javax/security/auth/callback/PasswordCallback.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD


  50     /**
  51      * @serial
  52      * @since 1.4
  53      */
  54     private char[] inputPassword;
  55 
  56     /**
  57      * Construct a {@code PasswordCallback} with a prompt
  58      * and a boolean specifying whether the password should be displayed
  59      * as it is being typed.
  60      *
  61      * @param prompt the prompt used to request the password.
  62      *
  63      * @param echoOn true if the password should be displayed
  64      *                  as it is being typed.
  65      *
  66      * @exception IllegalArgumentException if {@code prompt} is null or
  67      *                  if {@code prompt} has a length of 0.
  68      */
  69     public PasswordCallback(String prompt, boolean echoOn) {
  70         if (prompt == null || prompt.length() == 0)
  71             throw new IllegalArgumentException();
  72 
  73         this.prompt = prompt;
  74         this.echoOn = echoOn;
  75     }
  76 
  77     /**
  78      * Get the prompt.
  79      *
  80      * @return the prompt.
  81      */
  82     public String getPrompt() {
  83         return prompt;
  84     }
  85 
  86     /**
  87      * Return whether the password
  88      * should be displayed as it is being typed.
  89      *
  90      * @return the whether the password




  50     /**
  51      * @serial
  52      * @since 1.4
  53      */
  54     private char[] inputPassword;
  55 
  56     /**
  57      * Construct a {@code PasswordCallback} with a prompt
  58      * and a boolean specifying whether the password should be displayed
  59      * as it is being typed.
  60      *
  61      * @param prompt the prompt used to request the password.
  62      *
  63      * @param echoOn true if the password should be displayed
  64      *                  as it is being typed.
  65      *
  66      * @exception IllegalArgumentException if {@code prompt} is null or
  67      *                  if {@code prompt} has a length of 0.
  68      */
  69     public PasswordCallback(String prompt, boolean echoOn) {
  70         if (prompt == null || prompt.isEmpty())
  71             throw new IllegalArgumentException();
  72 
  73         this.prompt = prompt;
  74         this.echoOn = echoOn;
  75     }
  76 
  77     /**
  78      * Get the prompt.
  79      *
  80      * @return the prompt.
  81      */
  82     public String getPrompt() {
  83         return prompt;
  84     }
  85 
  86     /**
  87      * Return whether the password
  88      * should be displayed as it is being typed.
  89      *
  90      * @return the whether the password


< prev index next >