< prev index next >

src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/ComponentContext.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad

@@ -103,11 +103,11 @@
       */
     protected HeadTail p_parseComponent(Name name, Continuation cont)
         throws NamingException {
         int separator;
         // if no name to parse, or if we're already at boundary
-        if (name.isEmpty() ||  name.get(0).equals("")) {
+        if (name.isEmpty() ||  name.get(0).isEmpty()) {
             separator = 0;
         } else {
             separator = 1;
         }
         Name head, tail;

@@ -377,11 +377,11 @@
         Name head = p.getHead();
 
         if (tail == null || tail.isEmpty()) {
 //System.out.println("terminal : " + head);
             ret = TERMINAL_COMPONENT;
-        } else if (!tail.get(0).equals("")) {
+        } else if (!tail.get(0).isEmpty()) {
             // tail does not begin with "/"
 /*
             if (head.isEmpty()) {
                 // Context could not find name that it can use
                 // illegal syntax error or name not found

@@ -466,20 +466,20 @@
     // is extraneous.  When merging "" and "c.b.a", we want the result
     // to be "/c.b.a" and so must keep the trailing slash (empty name).
     void checkAndAdjustRemainingName(Name rname) throws InvalidNameException {
         int count;
         if (rname != null && (count=rname.size()) > 1 &&
-            rname.get(count-1).equals("")) {
+            rname.get(count-1).isEmpty()) {
             rname.remove(count-1);
         }
     }
 
     // Returns true if n contains only empty components
     protected boolean isAllEmpty(Name n) {
         int count = n.size();
         for (int i =0; i < count; i++ ) {
-            if (!n.get(i).equals("")) {
+            if (!n.get(i).isEmpty()) {
                 return false;
             }
         }
         return true;
     }
< prev index next >