< prev index next >

src/java.naming/share/classes/com/sun/jndi/ldap/LdapURL.java

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


 180             }
 181             String p = (port != -1) ? (":" + port) : "";
 182             String d = (dn != null) ? ("/" + UrlUtil.encode(dn, "UTF8")) : "";
 183 
 184             return useSsl ? "ldaps://" + h + p + d : "ldap://" + h + p + d;
 185         } catch (UnsupportedEncodingException e) {
 186             // UTF8 should always be supported
 187             throw new IllegalStateException("UTF-8 encoding unavailable");
 188         }
 189     }
 190 
 191     /*
 192      * Parses the path and query components of an URL and sets this
 193      * object's fields accordingly.
 194      */
 195     private void parsePathAndQuery() throws MalformedURLException,
 196         UnsupportedEncodingException {
 197 
 198         // path begins with a '/' or is empty
 199 
 200         if (path.equals("")) {
 201             return;
 202         }
 203 
 204         DN = path.startsWith("/") ? path.substring(1) : path;
 205         if (DN.length() > 0) {
 206             DN = UrlUtil.decode(DN, "UTF8");
 207         }
 208 
 209         // query begins with a '?' or is null
 210 
 211         if (query == null || query.length() < 2) {
 212             return;
 213         }
 214 
 215         int currentIndex = 1;
 216         int nextQmark;
 217         int endIndex;
 218 
 219         // attributes:
 220         nextQmark = query.indexOf('?', currentIndex);




 180             }
 181             String p = (port != -1) ? (":" + port) : "";
 182             String d = (dn != null) ? ("/" + UrlUtil.encode(dn, "UTF8")) : "";
 183 
 184             return useSsl ? "ldaps://" + h + p + d : "ldap://" + h + p + d;
 185         } catch (UnsupportedEncodingException e) {
 186             // UTF8 should always be supported
 187             throw new IllegalStateException("UTF-8 encoding unavailable");
 188         }
 189     }
 190 
 191     /*
 192      * Parses the path and query components of an URL and sets this
 193      * object's fields accordingly.
 194      */
 195     private void parsePathAndQuery() throws MalformedURLException,
 196         UnsupportedEncodingException {
 197 
 198         // path begins with a '/' or is empty
 199 
 200         if (path.isEmpty()) {
 201             return;
 202         }
 203 
 204         DN = path.startsWith("/") ? path.substring(1) : path;
 205         if (DN.length() > 0) {
 206             DN = UrlUtil.decode(DN, "UTF8");
 207         }
 208 
 209         // query begins with a '?' or is null
 210 
 211         if (query == null || query.length() < 2) {
 212             return;
 213         }
 214 
 215         int currentIndex = 1;
 216         int nextQmark;
 217         int endIndex;
 218 
 219         // attributes:
 220         nextQmark = query.indexOf('?', currentIndex);


< prev index next >