< prev index next >
src/java.management/share/classes/javax/management/MBeanPermission.java
Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad
*** 254,264 ****
int mask;
if (actions == null)
throw new IllegalArgumentException("MBeanPermission: " +
"actions can't be null");
! if (actions.equals(""))
throw new IllegalArgumentException("MBeanPermission: " +
"actions can't be empty");
mask = getMask(actions);
--- 254,264 ----
int mask;
if (actions == null)
throw new IllegalArgumentException("MBeanPermission: " +
"actions can't be null");
! if (actions.isEmpty())
throw new IllegalArgumentException("MBeanPermission: " +
"actions can't be empty");
mask = getMask(actions);
*** 277,287 ****
if (name == null)
throw new IllegalArgumentException("MBeanPermission name " +
"cannot be null");
! if (name.equals(""))
throw new IllegalArgumentException("MBeanPermission name " +
"cannot be empty");
/* The name looks like "class#member[objectname]". We subtract
elements from the right as we parse, so after parsing the
--- 277,287 ----
if (name == null)
throw new IllegalArgumentException("MBeanPermission name " +
"cannot be null");
! if (name.isEmpty())
throw new IllegalArgumentException("MBeanPermission name " +
"cannot be empty");
/* The name looks like "class#member[objectname]". We subtract
elements from the right as we parse, so after parsing the
*** 308,318 ****
try {
// If "[]" then ObjectName("*:*")
//
String on = name.substring(openingBracket + 1,
name.length() - 1);
! if (on.equals(""))
objectName = ObjectName.WILDCARD;
else if (on.equals("-"))
objectName = null;
else
objectName = new ObjectName(on);
--- 308,318 ----
try {
// If "[]" then ObjectName("*:*")
//
String on = name.substring(openingBracket + 1,
name.length() - 1);
! if (on.isEmpty())
objectName = ObjectName.WILDCARD;
else if (on.equals("-"))
objectName = null;
else
objectName = new ObjectName(on);
*** 357,367 ****
private void setClassName(String className) {
if (className == null || className.equals("-")) {
classNamePrefix = null;
classNameExactMatch = false;
! } else if (className.equals("") || className.equals("*")) {
classNamePrefix = "";
classNameExactMatch = false;
} else if (className.endsWith(".*")) {
// Note that we include the "." in the required prefix
classNamePrefix = className.substring(0, className.length() - 1);
--- 357,367 ----
private void setClassName(String className) {
if (className == null || className.equals("-")) {
classNamePrefix = null;
classNameExactMatch = false;
! } else if (className.isEmpty() || className.equals("*")) {
classNamePrefix = "";
classNameExactMatch = false;
} else if (className.endsWith(".*")) {
// Note that we include the "." in the required prefix
classNamePrefix = className.substring(0, className.length() - 1);
*** 373,383 ****
}
private void setMember(String member) {
if (member == null || member.equals("-"))
this.member = null;
! else if (member.equals(""))
this.member = "*";
else
this.member = member;
}
--- 373,383 ----
}
private void setMember(String member) {
if (member == null || member.equals("-"))
this.member = null;
! else if (member.isEmpty())
this.member = "*";
else
this.member = member;
}
< prev index next >