changing uses of String.isEmpty() so we can compile with Java 5

This commit is contained in:
bjl23 2010-03-09 19:47:17 +00:00
parent edd1ea0a3a
commit 89919ccb2f
3 changed files with 14 additions and 6 deletions

View file

@ -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);
}
}