gt:         return ((name != null) && name.toLowerCase().equals("true"));
context: /*
   * Copyright 1999-2002 Sun Microsystems, Inc.  All Rights Reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Sun designates this
   * particular file as subject to the "Classpath" exception as provided
   * by Sun in the LICENSE file that accompanied this code.
   *
   * This code is distributed in the hope that it will be useful, but WITHOUT
   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   * version 2 for more details (a copy is included in the LICENSE file that
   * accompanied this code).
   *
   * You should have received a copy of the GNU General Public License version
   * 2 along with this work; if not, write to the Free Software Foundation,
   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   *
   * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   * CA 95054 USA or visit www.sun.com if you need additional information or
   * have any questions.
   */
  
  package javax.naming;
  
  import java.util.Vector;
  import java.util.Enumeration;
  import java.util.Properties;
  import java.util.NoSuchElementException;
  
  /**
    * The implementation class for CompoundName and CompositeName.
    * This class is package private.
    *
    * @author Rosanna Lee
    * @author Scott Seligman
    * @author Aravindan Ranganathan
    * @since 1.3
    */
  
  class NameImpl {
      private static final byte LEFT_TO_RIGHT = 1;
      private static final byte RIGHT_TO_LEFT = 2;
      private static final byte FLAT = 0;
  
      private Vector components;
  
      private byte syntaxDirection = LEFT_TO_RIGHT;
      private String syntaxSeparator = "/";
      private String syntaxSeparator2 = null;
      private boolean syntaxCaseInsensitive = false;
      private boolean syntaxTrimBlanks = false;
      private String syntaxEscape = "\\";
      private String syntaxBeginQuote1 = "\"";
      private String syntaxEndQuote1 = "\"";
      private String syntaxBeginQuote2 = "'";
      private String syntaxEndQuote2 = "'";
      private String syntaxAvaSeparator = null;
      private String syntaxTypevalSeparator = null;
  
      // escapingStyle gives the method used at creation time for
      // quoting or escaping characters in the name.  It is set to the
      // first style of quote or escape encountered if and when the name
      // is parsed.
      private static final int STYLE_NONE = 0;
      private static final int STYLE_QUOTE1 = 1;
      private static final int STYLE_QUOTE2 = 2;
      private static final int STYLE_ESCAPE = 3;
      private int escapingStyle = STYLE_NONE;
  
      // Returns true if "match" is not null, and n contains "match" at
      // position i.
      private final boolean isA(String n, int i, String match) {
          return (match != null && n.startsWith(match, i));
      }
  
      private final boolean isMeta(String n, int i) {
          return (isA(n, i, syntaxEscape) ||
                  isA(n, i, syntaxBeginQuote1) ||
                  isA(n, i, syntaxBeginQuote2) ||
                  isSeparator(n, i));
      }
  
      private final boolean isSeparator(String n, int i) {
          return (isA(n, i, syntaxSeparator) ||
                  isA(n, i, syntaxSeparator2));
      }
  
      private final int skipSeparator(String name, int i) {
          if (isA(name, i, syntaxSeparator)) {
              i += syntaxSeparator.length();
          } else if (isA(name, i, syntaxSeparator2)) {
              i += syntaxSeparator2.length();
          }
          return (i);
      }
  
      private final int extractComp(String name, int i, int len, Vector comps)
      throws InvalidNameException {
          String beginQuote;
          String endQuote;
          boolean start = true;
          boolean one = false;
          StringBuffer answer = new StringBuffer(len);
  
          while (i < len) {
              // handle quoted strings
              if (start && ((one = isA(name, i, syntaxBeginQuote1)) ||
                            isA(name, i, syntaxBeginQuote2))) {
  
                  // record choice of quote chars being used
                  beginQuote = one ? syntaxBeginQuote1 : syntaxBeginQuote2;
                  endQuote = one ? syntaxEndQuote1 : syntaxEndQuote2;
                  if (escapingStyle == STYLE_NONE) {
                      escapingStyle = one ? STYLE_QUOTE1 : STYLE_QUOTE2;
                  }
  
                  // consume string until matching quote
                  for (i += beginQuote.length();
                       ((i < len) && !name.startsWith(endQuote, i));
                       i++) {
                      // skip escape character if it is escaping ending quote
                      // otherwise leave as is.
                      if (isA(name, i, syntaxEscape) &&
                          isA(name, i + syntaxEscape.length(), endQuote)) {
                          i += syntaxEscape.length();
                      }
                      answer.append(name.charAt(i));  // copy char
                  }
  
                  // no ending quote found
                  if (i >= len)
                      throw
                          new InvalidNameException(name + ": no close quote");
  //                      new Exception("no close quote");
  
                  i += endQuote.length();
  
                  // verify that end-quote occurs at separator or end of string
                  if (i == len || isSeparator(name, i)) {
                      break;
                  }
  //              throw (new Exception(
                  throw (new InvalidNameException(name +
                      ": close quote appears before end of component"));
  
              } else if (isSeparator(name, i)) {
                  break;
  
              } else if (isA(name, i, syntaxEscape)) {
                  if (isMeta(name, i + syntaxEscape.length())) {
                      // if escape precedes meta, consume escape and let
                      // meta through
                      i += syntaxEscape.length();
                      if (escapingStyle == STYLE_NONE) {
                          escapingStyle = STYLE_ESCAPE;
                      }
                  } else if (i + syntaxEscape.length() >= len) {
                      throw (new InvalidNameException(name +
                          ": unescaped " + syntaxEscape + " at end of component"));
                  }
              } else if (isA(name, i, syntaxTypevalSeparator) &&
          ((one = isA(name, i+syntaxTypevalSeparator.length(), syntaxBeginQuote1)) ||
              isA(name, i+syntaxTypevalSeparator.length(), syntaxBeginQuote2))) {
                  // Handle quote occurring after typeval separator
                  beginQuote = one ? syntaxBeginQuote1 : syntaxBeginQuote2;
                  endQuote = one ? syntaxEndQuote1 : syntaxEndQuote2;
  
                  i += syntaxTypevalSeparator.length();
                  answer.append(syntaxTypevalSeparator+beginQuote); // add back
  
                  // consume string until matching quote
                  for (i += beginQuote.length();
                       ((i < len) && !name.startsWith(endQuote, i));
                       i++) {
                      // skip escape character if it is escaping ending quote
                      // otherwise leave as is.
                      if (isA(name, i, syntaxEscape) &&
                          isA(name, i + syntaxEscape.length(), endQuote)) {
                          i += syntaxEscape.length();
                      }
                      answer.append(name.charAt(i));  // copy char
                  }
  
                  // no ending quote found
                  if (i >= len)
                      throw
                          new InvalidNameException(name + ": typeval no close quote");
  
                  i += endQuote.length();
                  answer.append(endQuote); // add back
  
                  // verify that end-quote occurs at separator or end of string
                  if (i == len || isSeparator(name, i)) {
                      break;
                  }
                  throw (new InvalidNameException(name.substring(i) +
                      ": typeval close quote appears before end of component"));
              }
  
              answer.append(name.charAt(i++));
              start = false;
          }
  
          if (syntaxDirection == RIGHT_TO_LEFT)
              comps.insertElementAt(answer.toString(), 0);
          else
              comps.addElement(answer.toString());
          return i;
      }
  
      private static boolean getBoolean(Properties p, String name) {
          return toBoolean(p.getProperty(name));
      }
  
      private static boolean toBoolean(String name) {
  