changing uses of String.isEmpty() so we can compile with Java 5
This commit is contained in:
parent
edd1ea0a3a
commit
89919ccb2f
3 changed files with 14 additions and 6 deletions
|
@ -207,7 +207,7 @@ public class BasicValidation {
|
|||
}
|
||||
|
||||
private static boolean isEmpty(String value) {
|
||||
return (value == null || value.trim().isEmpty());
|
||||
return (value == null || value.trim().length() == 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ContextStub implements Context {
|
|||
if (name == null) {
|
||||
throw new NullPointerException("ContextStub: name may not be null.");
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
if (isEmpty(name)) {
|
||||
throw new NamingException("ContextStub: name may not be empty.");
|
||||
}
|
||||
parent.rebind(contextPath + "/" + name, obj);
|
||||
|
@ -76,7 +76,7 @@ public class ContextStub implements Context {
|
|||
if (name == null) {
|
||||
throw new NamingException("ContextStub: name may not be null.");
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
if (isEmpty(name)) {
|
||||
return this;
|
||||
}
|
||||
return parent.lookup(contextPath + "/" + name);
|
||||
|
@ -212,4 +212,8 @@ public class ContextStub implements Context {
|
|||
throw new RuntimeException("ContextStub.unbind() not implemented.");
|
||||
}
|
||||
|
||||
private boolean isEmpty(String string) {
|
||||
return (string == null || string.trim().length() == 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,13 +80,17 @@ public class InitialContextStub extends InitialContext {
|
|||
return ContextStub.getInstance("", this);
|
||||
}
|
||||
|
||||
private boolean isEmpty(String string) {
|
||||
return (string == null || string.trim().length() == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(String name, Object obj) throws NamingException {
|
||||
if (name == null) {
|
||||
throw new NullPointerException(
|
||||
"InitialContextStub: name may not be null.");
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
if (isEmpty(name)) {
|
||||
throw new NamingException(
|
||||
"InitialContextStub: name may not be empty.");
|
||||
}
|
||||
|
@ -104,7 +108,7 @@ public class InitialContextStub extends InitialContext {
|
|||
throw new NullPointerException(
|
||||
"InitialContextStub: name may not be null.");
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
if (isEmpty(name)) {
|
||||
throw new NamingException(
|
||||
"InitialContextStub: name may not be empty.");
|
||||
}
|
||||
|
@ -118,7 +122,7 @@ public class InitialContextStub extends InitialContext {
|
|||
throw new NullPointerException(
|
||||
"InitialContextStub: name may not be null");
|
||||
}
|
||||
if (name.isEmpty()) {
|
||||
if (isEmpty(name)) {
|
||||
return this;
|
||||
}
|
||||
if (bindings.containsKey(name)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue