src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/ComponentContext.java
changeset 52902 e3398b2e1ab0
parent 47216 71c04702a3d5
equal deleted inserted replaced
52901:3ba9ff4d4aaf 52902:e3398b2e1ab0
   103       */
   103       */
   104     protected HeadTail p_parseComponent(Name name, Continuation cont)
   104     protected HeadTail p_parseComponent(Name name, Continuation cont)
   105         throws NamingException {
   105         throws NamingException {
   106         int separator;
   106         int separator;
   107         // if no name to parse, or if we're already at boundary
   107         // if no name to parse, or if we're already at boundary
   108         if (name.isEmpty() ||  name.get(0).equals("")) {
   108         if (name.isEmpty() ||  name.get(0).isEmpty()) {
   109             separator = 0;
   109             separator = 0;
   110         } else {
   110         } else {
   111             separator = 1;
   111             separator = 1;
   112         }
   112         }
   113         Name head, tail;
   113         Name head, tail;
   377         Name head = p.getHead();
   377         Name head = p.getHead();
   378 
   378 
   379         if (tail == null || tail.isEmpty()) {
   379         if (tail == null || tail.isEmpty()) {
   380 //System.out.println("terminal : " + head);
   380 //System.out.println("terminal : " + head);
   381             ret = TERMINAL_COMPONENT;
   381             ret = TERMINAL_COMPONENT;
   382         } else if (!tail.get(0).equals("")) {
   382         } else if (!tail.get(0).isEmpty()) {
   383             // tail does not begin with "/"
   383             // tail does not begin with "/"
   384 /*
   384 /*
   385             if (head.isEmpty()) {
   385             if (head.isEmpty()) {
   386                 // Context could not find name that it can use
   386                 // Context could not find name that it can use
   387                 // illegal syntax error or name not found
   387                 // illegal syntax error or name not found
   466     // is extraneous.  When merging "" and "c.b.a", we want the result
   466     // is extraneous.  When merging "" and "c.b.a", we want the result
   467     // to be "/c.b.a" and so must keep the trailing slash (empty name).
   467     // to be "/c.b.a" and so must keep the trailing slash (empty name).
   468     void checkAndAdjustRemainingName(Name rname) throws InvalidNameException {
   468     void checkAndAdjustRemainingName(Name rname) throws InvalidNameException {
   469         int count;
   469         int count;
   470         if (rname != null && (count=rname.size()) > 1 &&
   470         if (rname != null && (count=rname.size()) > 1 &&
   471             rname.get(count-1).equals("")) {
   471             rname.get(count-1).isEmpty()) {
   472             rname.remove(count-1);
   472             rname.remove(count-1);
   473         }
   473         }
   474     }
   474     }
   475 
   475 
   476     // Returns true if n contains only empty components
   476     // Returns true if n contains only empty components
   477     protected boolean isAllEmpty(Name n) {
   477     protected boolean isAllEmpty(Name n) {
   478         int count = n.size();
   478         int count = n.size();
   479         for (int i =0; i < count; i++ ) {
   479         for (int i =0; i < count; i++ ) {
   480             if (!n.get(i).equals("")) {
   480             if (!n.get(i).isEmpty()) {
   481                 return false;
   481                 return false;
   482             }
   482             }
   483         }
   483         }
   484         return true;
   484         return true;
   485     }
   485     }