NameImpl.java revision 0
2362N/A * Copyright 1999-2002 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2362N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * The implementation class for CompoundName and CompositeName. 0N/A * This class is package private. 0N/A * @author Rosanna Lee 0N/A * @author Scott Seligman 0N/A * @author Aravindan Ranganathan 0N/A private static final byte FLAT =
0;
0N/A // escapingStyle gives the method used at creation time for 0N/A // quoting or escaping characters in the name. It is set to the 0N/A // first style of quote or escape encountered if and when the name 0N/A // Returns true if "match" is not null, and n contains "match" at 0N/A // handle quoted strings 0N/A // record choice of quote chars being used 0N/A // consume string until matching quote 0N/A // skip escape character if it is escaping ending quote 0N/A // otherwise leave as is. 0N/A // no ending quote found 0N/A// new Exception("no close quote"); 0N/A // verify that end-quote occurs at separator or end of string 0N/A// throw (new Exception( 0N/A ": close quote appears before end of component"));
0N/A // if escape precedes meta, consume escape and let 0N/A // Handle quote occurring after typeval separator 0N/A // consume string until matching quote 0N/A // skip escape character if it is escaping ending quote 0N/A // otherwise leave as is. 0N/A // no ending quote found 0N/A // verify that end-quote occurs at separator or end of string 0N/A ": typeval close quote appears before end of component"));
"is not a valid value for the jndi.syntax.direction property");
"jndi.syntax.separator property required for non-flat syntax");
for (
int i =
0; i <
len; ) {
// Trailing separator found. Add an empty component. // %% comps could shrink in the middle. // Determines whether this component needs any escaping. private final boolean escapingNeeded(String comp) { for (int i = 0; i < len; i++) { if (isA(comp, 0, syntaxBeginQuote1) || isA(comp, 0, syntaxBeginQuote2)) { if (isSeparator(comp, i)) { if (isA(comp, i, syntaxEscape)) { i += syntaxEscape.length(); if (i >= len || isMeta(comp, i)) { // determine whether there are any separators; if so escape // start string off with opening quote // component is being quoted, so we only need to worry about // escaping end quotes that occur in component for (
int i =
0; i <
len; ) {
// end-quotes must be escaped when inside a quoted string // no special treatment required // end with closing quote // When component is not quoted, add escape for: // 2. an escape preceding any meta char // 3. an escape at the end of a component // go through characters in component and escape where necessary for (
int i =
0; i <
len; ) {
// leading quote must be escaped // Escape an escape preceding meta characters, or at end. // Other escapes pass through. // escape an ending escape // escape unescaped separator // no special treatment required for (
int i =
0; i <
size; i++) {
// %% comps could shrink in the middle. * Compares obj to this NameImpl to determine ordering. * Takes into account syntactic properties such as * elimination of blanks, case-ignore, etc, if relevant. * Note: using syntax of this NameImpl and ignoring * that of comparison target. // normalize according to syntax // posn is number of elements in suffix // startIndex is the starting position in this name // at which to start the comparison. It is calculated by // subtracting 'posn' from size() "A flat name can only have a single component");
break;
// "comps" has shrunk. "A flat name can only have a single component");
break;
// "comps" has shrunk. "A flat name can only have a single component");
"A flat name can only zero or one component");