2362N/A * Copyright (c) 1999, 2002, Oracle and/or its affiliates. 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. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 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"));
0N/A "is not a valid value for the jndi.syntax.direction property");
0N/A "jndi.syntax.separator property required for non-flat syntax");
0N/A // Trailing separator found. Add an empty component. 0N/A // %% comps could shrink in the middle. 0N/A // Determines whether this component needs any escaping. 0N/A private final boolean escapingNeeded(String comp) { 0N/A int len = comp.length(); 0N/A for (int i = 0; i < len; i++) { 0N/A if (isA(comp, 0, syntaxBeginQuote1) || 0N/A isA(comp, 0, syntaxBeginQuote2)) { 0N/A if (isSeparator(comp, i)) { 0N/A if (isA(comp, i, syntaxEscape)) { 0N/A i += syntaxEscape.length(); 0N/A if (i >= len || isMeta(comp, i)) { 0N/A // determine whether there are any separators; if so escape 0N/A // if quoting component, 0N/A // start string off with opening quote 0N/A // component is being quoted, so we only need to worry about 0N/A // escaping end quotes that occur in component 0N/A // end-quotes must be escaped when inside a quoted string 0N/A // no special treatment required 0N/A // end with closing quote 0N/A // When component is not quoted, add escape for: 0N/A // 2. an escape preceding any meta char 0N/A // 3. an escape at the end of a component 0N/A // go through characters in component and escape where necessary 0N/A // leading quote must be escaped 0N/A // Escape an escape preceding meta characters, or at end. 0N/A // Other escapes pass through. 0N/A // escape an ending escape 0N/A // escape meta strings 0N/A // escape unescaped separator 0N/A // escape separator2 0N/A // no special treatment required 0N/A // %% comps could shrink in the middle. 0N/A * Compares obj to this NameImpl to determine ordering. 0N/A * Takes into account syntactic properties such as 0N/A * elimination of blanks, case-ignore, etc, if relevant. 0N/A * Note: using syntax of this NameImpl and ignoring 0N/A * that of comparison target. 0N/A // normalize according to syntax 0N/A // posn is number of elements in suffix 0N/A // startIndex is the starting position in this name 0N/A // at which to start the comparison. It is calculated by 0N/A // subtracting 'posn' from size() 0N/A "A flat name can only have a single component");
0N/A break;
// "comps" has shrunk. 0N/A "A flat name can only have a single component");
0N/A break;
// "comps" has shrunk. 0N/A "A flat name can only have a single component");
0N/A "A flat name can only zero or one component");