< prev index next >
src/java.base/share/classes/javax/security/auth/callback/NameCallback.java
Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
*** 60,70 ****
*
* @exception IllegalArgumentException if {@code prompt} is null
* or if {@code prompt} has a length of 0.
*/
public NameCallback(String prompt) {
! if (prompt == null || prompt.length() == 0)
throw new IllegalArgumentException();
this.prompt = prompt;
}
/**
--- 60,70 ----
*
* @exception IllegalArgumentException if {@code prompt} is null
* or if {@code prompt} has a length of 0.
*/
public NameCallback(String prompt) {
! if (prompt == null || prompt.isEmpty())
throw new IllegalArgumentException();
this.prompt = prompt;
}
/**
*** 80,91 ****
* if {@code prompt} has a length of 0,
* if {@code defaultName} is null,
* or if {@code defaultName} has a length of 0.
*/
public NameCallback(String prompt, String defaultName) {
! if (prompt == null || prompt.length() == 0 ||
! defaultName == null || defaultName.length() == 0)
throw new IllegalArgumentException();
this.prompt = prompt;
this.defaultName = defaultName;
}
--- 80,91 ----
* if {@code prompt} has a length of 0,
* if {@code defaultName} is null,
* or if {@code defaultName} has a length of 0.
*/
public NameCallback(String prompt, String defaultName) {
! if (prompt == null || prompt.isEmpty() ||
! defaultName == null || defaultName.isEmpty())
throw new IllegalArgumentException();
this.prompt = prompt;
this.defaultName = defaultName;
}
< prev index next >