src/java.naming/share/classes/javax/naming/NameImpl.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 153             } else if (isA(name, i, syntaxEscape)) {
 154                 if (isMeta(name, i + syntaxEscape.length())) {
 155                     // if escape precedes meta, consume escape and let
 156                     // meta through
 157                     i += syntaxEscape.length();
 158                     if (escapingStyle == STYLE_NONE) {
 159                         escapingStyle = STYLE_ESCAPE;
 160                     }
 161                 } else if (i + syntaxEscape.length() >= len) {
 162                     throw (new InvalidNameException(name +
 163                         ": unescaped " + syntaxEscape + " at end of component"));
 164                 }
 165             } else if (isA(name, i, syntaxTypevalSeparator) &&
 166         ((one = isA(name, i+syntaxTypevalSeparator.length(), syntaxBeginQuote1)) ||
 167             isA(name, i+syntaxTypevalSeparator.length(), syntaxBeginQuote2))) {
 168                 // Handle quote occurring after typeval separator
 169                 beginQuote = one ? syntaxBeginQuote1 : syntaxBeginQuote2;
 170                 endQuote = one ? syntaxEndQuote1 : syntaxEndQuote2;
 171 
 172                 i += syntaxTypevalSeparator.length();
 173                 answer.append(syntaxTypevalSeparator+beginQuote); // add back
 174 
 175                 // consume string until matching quote
 176                 for (i += beginQuote.length();
 177                      ((i < len) && !name.startsWith(endQuote, i));
 178                      i++) {
 179                     // skip escape character if it is escaping ending quote
 180                     // otherwise leave as is.
 181                     if (isA(name, i, syntaxEscape) &&
 182                         isA(name, i + syntaxEscape.length(), endQuote)) {
 183                         i += syntaxEscape.length();
 184                     }
 185                     answer.append(name.charAt(i));  // copy char
 186                 }
 187 
 188                 // no ending quote found
 189                 if (i >= len)
 190                     throw
 191                         new InvalidNameException(name + ": typeval no close quote");
 192 
 193                 i += endQuote.length();




 153             } else if (isA(name, i, syntaxEscape)) {
 154                 if (isMeta(name, i + syntaxEscape.length())) {
 155                     // if escape precedes meta, consume escape and let
 156                     // meta through
 157                     i += syntaxEscape.length();
 158                     if (escapingStyle == STYLE_NONE) {
 159                         escapingStyle = STYLE_ESCAPE;
 160                     }
 161                 } else if (i + syntaxEscape.length() >= len) {
 162                     throw (new InvalidNameException(name +
 163                         ": unescaped " + syntaxEscape + " at end of component"));
 164                 }
 165             } else if (isA(name, i, syntaxTypevalSeparator) &&
 166         ((one = isA(name, i+syntaxTypevalSeparator.length(), syntaxBeginQuote1)) ||
 167             isA(name, i+syntaxTypevalSeparator.length(), syntaxBeginQuote2))) {
 168                 // Handle quote occurring after typeval separator
 169                 beginQuote = one ? syntaxBeginQuote1 : syntaxBeginQuote2;
 170                 endQuote = one ? syntaxEndQuote1 : syntaxEndQuote2;
 171 
 172                 i += syntaxTypevalSeparator.length();
 173                 answer.append(syntaxTypevalSeparator).append(beginQuote); // add back
 174 
 175                 // consume string until matching quote
 176                 for (i += beginQuote.length();
 177                      ((i < len) && !name.startsWith(endQuote, i));
 178                      i++) {
 179                     // skip escape character if it is escaping ending quote
 180                     // otherwise leave as is.
 181                     if (isA(name, i, syntaxEscape) &&
 182                         isA(name, i + syntaxEscape.length(), endQuote)) {
 183                         i += syntaxEscape.length();
 184                     }
 185                     answer.append(name.charAt(i));  // copy char
 186                 }
 187 
 188                 // no ending quote found
 189                 if (i >= len)
 190                     throw
 191                         new InvalidNameException(name + ": typeval no close quote");
 192 
 193                 i += endQuote.length();