Skip to main content

RuntimeException

java.lang.RuntimeException

RuntimeException is described in the javadoc comments as:

RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine.

A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught.
author: Frank Yellin version: 1.13, 12/19/03 since: JDK1.0

Where is this exception thrown?

Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown.

How is this exception thrown?

The following sub-sections identify where this exception is thrown, and how (or why) the code is throwing the exception.

Any source code quoted in this section is subject to the Java Research License unless stated otherwise.

com.sun.corba.se.impl.transport.CorbaTransportManagerImpl.getByteBufferPool(int)

public ByteBufferPool getByteBufferPool(int id) {
    throw new RuntimeException();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.createOutputObject(MessageMediator)

public OutputObject createOutputObject(MessageMediator messageMediator) {
    throw new RuntimeException('*****SocketOrChannelConnectionImpl.createOutputObject - should not be called.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.dom.NodeImpl.cloneNode(boolean)

/**
     * Returns a duplicate of a given node. You can consider this a
     * generic 'copy constructor' for nodes. The newly returned object should
     * be completely independent of the source object's subtree, so changes
     * in one after the clone has been made will not affect the other.
     * <P>
     * Note: since we never have any children deep is meaningless here,
     * ParentNode overrides this behavior.
     * @see ParentNode
     * 
     * Example: Cloning a Text node will copy both the node and the text it
     * contains.
     * Example: Cloning something that has children -- Element or Attr, for
     * example -- will _not_ clone those children unless a 'deep clone'
     * has been requested. A shallow clone of an Attr node will yield an
     * empty Attr of the same name.
     * NOTE: Clones will always be read/write, even if the node being cloned
     * is read-only, to permit applications using only the DOM API to obtain
     * editable copies of locked portions of the tree.
     */
public Node cloneNode(boolean deep) {
    if (needsSyncData()) {
        synchronizeData();
    }
    NodeImpl newnode;
    try {
        newnode = (NodeImpl) clone();
    } catch (CloneNotSupportedException e) {
        throw new RuntimeException('**Internal Error**' + e);
    }
    newnode.ownerNode = ownerDocument();
    newnode.isOwned(false);
    newnode.isReadOnly(false);
    ownerDocument().callUserDataHandlers(this, newnode, UserDataHandler.NODE_CLONED);
    return newnode;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.io.ObjectStreamClass.readResolve(Object)

public Object readResolve(Object value) {
    if (readResolveObjectMethod != null) {
        try {
            return readResolveObjectMethod.invoke(value, noArgsList);
        } catch (Throwable t) {
            throw new RuntimeException(t);
        }
    } else return value;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.io.ObjectStreamClass.writeReplace(Serializable)

public Serializable writeReplace(Serializable value) {
    if (writeReplaceObjectMethod != null) {
        try {
            return (Serializable) writeReplaceObjectMethod.invoke(value, noArgsList);
        } catch (Throwable t) {
            throw new RuntimeException(t);
        }
    } else return value;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orbutil.ObjectStreamClass_1_3_1.readResolve(Object)

public Object readResolve(Object value) {
    if (readResolveObjectMethod != null) {
        try {
            return readResolveObjectMethod.invoke(value, noArgsList);
        } catch (Throwable t) {
            throw new RuntimeException(t.getMessage());
        }
    } else return value;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.orbutil.ObjectStreamClass_1_3_1.writeReplace(Serializable)

public Serializable writeReplace(Serializable value) {
    if (writeReplaceObjectMethod != null) {
        try {
            return (Serializable) writeReplaceObjectMethod.invoke(value, noArgsList);
        } catch (Throwable t) {
            throw new RuntimeException(t.getMessage());
        }
    } else return value;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.presentation.rmi.StubFactoryStaticImpl.makeStub()

public org.omg.CORBA.Object makeStub() {
    org.omg.CORBA.Object stub = null;
    try {
        stub = (org.omg.CORBA.Object) stubClass.newInstance();
    } catch (InstantiationException e) {
        throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e);
    }
    return stub;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.common.I18NImpl.getString(String, String, String)

/**
     * Returns the message string with the specified key from the
     * 'properties' file in the package containing the class with
     * the specified name.
     */
protected static final String getString(String className, String resource_name, String key) {
    PropertyResourceBundle bundle = null;
    try {
        InputStream stream = Class.forName(className).getResourceAsStream(resource_name);
        bundle = new PropertyResourceBundle(stream);
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
    return (String) bundle.handleGetObject(key);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.client.XSLTProcessorApplet.escapeString(String)

/**
   * Given a String containing markup, escape the markup so it
   * can be displayed in the browser.
   * @param s String to escape
   * The escaped string.
   */
public String escapeString(String s) {
    StringBuffer sb = new StringBuffer();
    int length = s.length();
    for (int i = 0; i < length; i++) {
        char ch = s.charAt(i);
        if ('<' == ch) {
            sb.append('<');
        } else if ('>' == ch) {
            sb.append('>');
        } else if ('&' == ch) {
            sb.append('&');
        } else if (0xd800 <= ch && ch < 0xdc00) {
            int next;
            if (i + 1 >= length) {
                throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString(ch) }));
            } else {
                next = s.charAt(++i);
                if (!(0xdc00 <= next && next < 0xe000)) throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[] { Integer.toHexString(ch) + ' ' + Integer.toHexString(next) }));
                next = ((ch - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
            }
            sb.append('&#x');
            sb.append(Integer.toHexString(next));
            sb.append(';');
        } else {
            sb.append(ch);
        }
    }
    return sb.toString();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.runTimeError(String)

/**
     * Print a run-time error message.
     */
public static void runTimeError(String code) {
    throw new RuntimeException(m_bundle.getString(code));
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.runTimeError(String, Object[])

public static void runTimeError(String code, Object[] args) {
    final String message = MessageFormat.format(m_bundle.getString(code), args);
    throw new RuntimeException(message);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.startXslElement(String, String, SerializationHandler, DOM, int)

/**
     * Utility function for the implementation of xsl:element.
     */
public static String startXslElement(String qname, String namespace, SerializationHandler handler, DOM dom, int node) {
    try {
        String prefix;
        final int index = qname.indexOf(':');
        if (index > 0) {
            prefix = qname.substring(0, index);
            if (namespace == null || namespace.length() == 0) {
                try {
                    namespace = dom.lookupNamespace(node, prefix);
                } catch (RuntimeException e) {
                    handler.flushPending();
                    NamespaceMappings nm = handler.getNamespaceMappings();
                    namespace = nm.lookupNamespace(prefix);
                    if (namespace == null) {
                        runTimeError(NAMESPACE_PREFIX_ERR, prefix);
                    }
                }
            }
            handler.startElement(namespace, qname.substring(index + 1), qname);
            handler.namespaceAfterStartElement(prefix, namespace);
        } else {
            if (namespace != null && namespace.length() > 0) {
                prefix = generatePrefix();
                qname = prefix + ':' + qname;
                handler.startElement(namespace, qname, qname);
                handler.namespaceAfterStartElement(prefix, namespace);
            } else {
                handler.startElement(null, null, qname);
            }
        }
    } catch (SAXException e) {
        throw new RuntimeException(e.getMessage());
    }
    return qname;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.xsltc.runtime.output.WriterOutputBuffer.append(String)

public OutputBuffer append(String s) {
    try {
        _writer.write(s);
    } catch (IOException e) {
        throw new RuntimeException(e.toString());
    }
    return this;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.xsltc.runtime.output.WriterOutputBuffer.append(char)

public OutputBuffer append(char ch) {
    try {
        _writer.write(ch);
    } catch (IOException e) {
        throw new RuntimeException(e.toString());
    }
    return this;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.xsltc.runtime.output.WriterOutputBuffer.append(char[], int, int)

public OutputBuffer append(char[] s, int from, int to) {
    try {
        _writer.write(s, from, to);
    } catch (IOException e) {
        throw new RuntimeException(e.toString());
    }
    return this;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xalan.internal.xsltc.runtime.output.WriterOutputBuffer.close()

public String close() {
    try {
        _writer.flush();
    } catch (IOException e) {
        throw new RuntimeException(e.toString());
    }
    return '';
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault.getDTMHandleFromNode(org.w3c.dom.Node)

/**
   * Given a W3C DOM node, try and return a DTM handle.
   * Note: calling this may be non-optimal, and there is no guarantee that
   * the node will be found in any particular DTM.
   * @param node Non-null reference to a DOM node.
   * @return a valid DTM handle.
   */
public synchronized int getDTMHandleFromNode(org.w3c.dom.Node node) {
    if (null == node) throw new IllegalArgumentException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NODE_NON_NULL, null));
    if (node instanceof com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy) return ((com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy) node).getDTMNodeNumber(); else {
        int max = m_dtms.length;
        for (int i = 0; i < max; i++) {
            DTM thisDTM = m_dtms[i];
            if ((null != thisDTM) && thisDTM instanceof DOM2DTM) {
                int handle = ((DOM2DTM) thisDTM).getHandleOfNode(node);
                if (handle != DTM.NULL) return handle;
            }
        }
        Node root = node;
        Node p = (root.getNodeType() == Node.ATTRIBUTE_NODE) ? ((org.w3c.dom.Attr) root).getOwnerElement() : root.getParentNode();
        for (; p != null; p = p.getParentNode()) {
            root = p;
        }
        DOM2DTM dtm = (DOM2DTM) getDTM(new javax.xml.transform.dom.DOMSource(root), false, null, true, true);
        int handle;
        if (node instanceof com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTMdefaultNamespaceDeclarationNode) {
            handle = dtm.getHandleOfNode(((org.w3c.dom.Attr) node).getOwnerElement());
            handle = dtm.getAttributeNode(handle, node.getNamespaceURI(), node.getLocalName());
        } else handle = ((DOM2DTM) dtm).getHandleOfNode(node);
        if (DTM.NULL == handle) throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COULD_NOT_RESOLVE_NODE, null));
        return handle;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Filter.init(CoroutineManager, int, int)

public void init(CoroutineManager co, int controllerCoroutineID, int sourceCoroutineID) {
    if (co == null) co = new CoroutineManager();
    fCoroutineManager = co;
    fControllerCoroutineID = co.co_joinCoroutineSet(controllerCoroutineID);
    fSourceCoroutineID = co.co_joinCoroutineSet(sourceCoroutineID);
    if (fControllerCoroutineID == -1 || fSourceCoroutineID == -1) throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COJOINROUTINESET_FAILED, null));
    fNoMoreEvents = false;
    eventcounter = frequency;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.res.XMLMessages.createMsg(ListResourceBundle, String, Object)

/**
   * Creates a message from the specified key and replacement
   * arguments, localized to the given locale.
   * @param errorCode The key for the message text.
   * @param fResourceBundle The resource bundle to use.
   * @param msgKey  The message key to use.
   * @param args      The arguments to be used as replacement text
   *                  in the message created.
   * @return The formatted message string.
   */
public static final String createMsg(ListResourceBundle fResourceBundle, String msgKey, Object args[]) {
    String fmsg = null;
    boolean throwex = false;
    String msg = null;
    if (msgKey != null) msg = fResourceBundle.getString(msgKey);
    if (msg == null) {
        msg = fResourceBundle.getString(BAD_CODE);
        throwex = true;
    }
    if (args != null) {
        try {
            int n = args.length;
            for (int i = 0; i < n; i++) {
                if (null == args[i]) args[i] = '';
            }
            fmsg = java.text.MessageFormat.format(msg, args);
        } catch (Exception e) {
            fmsg = fResourceBundle.getString(FORMAT_FAILED);
            fmsg += ' ' + msg;
        }
    } else fmsg = msg;
    if (throwex) {
        throw new RuntimeException(fmsg);
    }
    return fmsg;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serializer.Encodings.findCharToByteConverterMethod()

private static Method findCharToByteConverterMethod() {
    try {
        AccessController.doPrivileged(new PrivilegedAction() {

            public Object run() {
                try {
                    Class charToByteConverterClass = (Class) Class.forName('sun.io.CharToByteConverter');
                    Class argTypes[] = { String.class };
                    return charToByteConverterClass.getMethod('getConverter', argTypes);
                } catch (Exception e) {
                    throw new RuntimeException(e.toString());
                }
            }
        });
    } catch (Exception e) {
        System.err.println('Warning: Could not get charToByteConverterClass!');
    }
    return null;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serializer.SerializerBase.getNamespaceURI(String, boolean)

/**
     * Returns the URI of an element or attribute. Note that default namespaces
     * do not apply directly to attributes.
     * @param qname a qualified name
     * @param isElement true if the qualified name is the name of 
     * an element.
     * @return returns the namespace URI associated with the qualified name.
     */
public String getNamespaceURI(String qname, boolean isElement) {
    String uri = EMPTYSTRING;
    int col = qname.lastIndexOf(':');
    final String prefix = (col > 0) ? qname.substring(0, col) : EMPTYSTRING;
    if (!EMPTYSTRING.equals(prefix) || isElement) {
        if (m_prefixMap != null) {
            uri = m_prefixMap.lookupNamespace(prefix);
            if (uri == null && !prefix.equals(XMLNS_PREFIX)) {
                throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NAMESPACE_PREFIX, new Object[] { qname.substring(0, col) }));
            }
        }
    }
    return uri;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serializer.ToUnknownStream.flush()

private void flush() {
    try {
        if (m_firstTagNotEmitted) {
            emitFirstTag();
        }
        if (m_needToCallStartDocument) {
            m_handler.startDocument();
            m_needToCallStartDocument = false;
        }
    } catch (SAXException e) {
        throw new RuntimeException(e.toString());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.utils.DOMHelper.createDocument()

/**
   * DOM Level 1 did not have a standard mechanism for creating a new
   * Document object. This function provides a DOM-implementation-independent
   * abstraction for that for that concept. It's typically used when 
   * outputting a new DOM as the result of an operation.
   * TODO: This isn't directly compatable with DOM Level 2. 
   * The Level 2 createDocument call also creates the root 
   * element, and thus requires that you know what that element will be
   * before creating the Document. We should think about whether we want
   * to change this code, and the callers, so we can use the DOM's own 
   * method. (It's also possible that DOM Level 3 may relax this
   * sequence, but you may give up some intelligence in the DOM by
   * doing so; the intent was that knowing the document type and root
   * element might let the DOM automatically switch to a specialized
   * subclass for particular kinds of documents.)
   * @return The newly created DOM Document object, with no children, or
   * null if we can't find a DOM implementation that permits creating
   * new empty Documents.
   */
public static Document createDocument() {
    try {
        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
        dfactory.setNamespaceAware(true);
        dfactory.setValidating(true);
        DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
        Document outNode = docBuilder.newDocument();
        return outNode;
    } catch (ParserConfigurationException pce) {
        throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_CREATEDOCUMENT_NOT_SUPPORTED, null));
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.utils.DOMHelper.getParentOfNode(Node)

/**
   * Obtain the XPath-model parent of a DOM node -- ownerElement for Attrs,
   * parent for other nodes. 
   * Background: The DOM believes that you must be your Parent's
   * Child, and thus Attrs don't have parents. XPath said that Attrs
   * do have their owning Element as their parent. This function
   * bridges the difference, either by using the DOM Level 2 ownerElement
   * function or by using a 'silly and expensive function' in Level 1
   * DOMs.
   * (There's some discussion of future DOMs generalizing ownerElement 
   * into ownerNode and making it work on all types of nodes. This
   * still wouldn't help the users of Level 1 or Level 2 DOMs)
   *
   * @param node Node whose XPath parent we want to obtain
   * @return the parent of the node, or the ownerElement if it's an
   * Attr node, or null if the node is an orphan.
   * @throws RuntimeException if the Document has no root element.
   * This can't arise if the Document was created
   * via the DOM Level 2 factory methods, but is possible if other
   * mechanisms were used to obtain it
   */
public static Node getParentOfNode(Node node) throws RuntimeException {
    Node parent;
    short nodeType = node.getNodeType();
    if (Node.ATTRIBUTE_NODE == nodeType) {
        Document doc = node.getOwnerDocument();
        DOMImplementation impl = doc.getImplementation();
        if (impl != null && impl.hasFeature('Core', '2.0')) {
            parent = ((Attr) node).getOwnerElement();
            return parent;
        }
        Element rootElem = doc.getDocumentElement();
        if (null == rootElem) {
            throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, null));
        }
        parent = locateAttrParent(rootElem, node);
    } else {
        parent = node.getParentNode();
    }
    return parent;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.utils.ObjectPool.getInstance()

/**
   * Get an instance of the given object in this pool 
   *
   * @return An instance of the given object
   */
public synchronized Object getInstance() {
    if (freeStack.isEmpty()) {
        try {
            return objectType.newInstance();
        } catch (InstantiationException ex) {
        } catch (IllegalAccessException ex) {
        }
        throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_EXCEPTION_CREATING_POOL, null));
    } else {
        Object result = freeStack.lastElement();
        freeStack.setSize(freeStack.size() - 1);
        return result;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.utils.UnImplNode.error(String)

/**
   * Throw an error.
   * @param msg Message Key for the error
   */
public void error(String msg) {
    System.out.println('DOM ERROR! class: ' + this.getClass().getName());
    throw new RuntimeException(XMLMessages.createXMLMessage(msg, null));
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.utils.UnImplNode.error(String, Object[])

/**
   * Throw an error.
   * @param msg Message Key for the error
   * @param args Array of arguments to be used in the error message
   */
public void error(String msg, Object[] args) {
    System.out.println('DOM ERROR! class: ' + this.getClass().getName());
    throw new RuntimeException(XMLMessages.createXMLMessage(msg, args));
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.Expression.assertion(boolean, java.lang.String)

/**
   * Tell the user of an assertion error, and probably throw an
   * exception.
   * @param b  If false, a runtime exception will be thrown.
   * @param msg The assertion message, which should be informative.
   * @throws RuntimeException if the b argument is false.
   * @throws javax.xml.transform.TransformerException
   */
public void assertion(boolean b, java.lang.String msg) {
    if (!b) {
        java.lang.String fMsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] { msg });
        throw new RuntimeException(fMsg);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addElement(Node)

/**
   * Append a Node onto the vector.
   * @param value Node to add to the vector
   */
public void addElement(Node value) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    if ((m_firstFree + 1) >= m_mapSize) {
        if (null == m_map) {
            m_map = new Node[m_blocksize];
            m_mapSize = m_blocksize;
        } else {
            m_mapSize += m_blocksize;
            Node newMap[] = new Node[m_mapSize];
            System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
            m_map = newMap;
        }
    }
    m_map[m_firstFree] = value;
    m_firstFree++;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addNode(Node)

/**
   * Add a node to the NodeSet. Not all types of NodeSets support this
   * operation
   * @param n Node to be added
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public void addNode(Node n) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    this.addElement(n);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addNodeInDocOrder(Node, XPathContext)

/**
   * Add the node into a vector of nodes where it should occur in
   * document order.
   * @param v Vector of nodes, presumably containing Nodes
   * @param obj Node object.
   * @param node The node to be added.
   * @param support The XPath runtime context.
   * @return The index where it was inserted.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public int addNodeInDocOrder(Node node, XPathContext support) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    return addNodeInDocOrder(node, true, support);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addNodeInDocOrder(Node, boolean, XPathContext)

/**
   * Add the node into a vector of nodes where it should occur in
   * document order.
   * @param v Vector of nodes, presumably containing Nodes
   * @param obj Node object.
   * @param node The node to be added.
   * @param test true if we should test for doc order
   * @param support The XPath runtime context.
   * @return insertIndex.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public int addNodeInDocOrder(Node node, boolean test, XPathContext support) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    int insertIndex = -1;
    if (test) {
        int size = size(), i;
        for (i = size - 1; i >= 0; i--) {
            Node child = (Node) elementAt(i);
            if (child == node) {
                i = -2;
                break;
            }
            if (!DOM2Helper.isNodeAfter(node, child)) {
                break;
            }
        }
        if (i != -2) {
            insertIndex = i + 1;
            insertElementAt(node, insertIndex);
        }
    } else {
        insertIndex = this.size();
        boolean foundit = false;
        for (int i = 0; i < insertIndex; i++) {
            if (this.item(i).equals(node)) {
                foundit = true;
                break;
            }
        }
        if (!foundit) addElement(node);
    }
    return insertIndex;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addNodes(NodeIterator)

/**
   * Copy NodeList members into this nodelist, adding in
   * document order.  Null references are not added.
   * @param iterator NodeIterator which yields the nodes to be added.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public void addNodes(NodeIterator iterator) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    if (null != iterator) {
        Node obj;
        while (null != (obj = iterator.nextNode())) {
            addElement(obj);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addNodes(NodeList)

/**
   * Copy NodeList members into this nodelist, adding in
   * document order.  If a node is null, don't add it.
   * @param nodelist List of nodes which should now be referenced by
   * this NodeSet.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public void addNodes(NodeList nodelist) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    if (null != nodelist) {
        int nChildren = nodelist.getLength();
        for (int i = 0; i < nChildren; i++) {
            Node obj = nodelist.item(i);
            if (null != obj) {
                addElement(obj);
            }
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addNodes(NodeSet)

/**
   * Copy NodeList members into this nodelist, adding in
   * document order.  Only genuine node references will be copied;
   * nulls appearing in the source NodeSet will
   * not be added to this one. 
   *  In case you're wondering why this function is needed: NodeSet
   * implements both NodeIterator and NodeList. If this method isn't
   * provided, Java can't decide which of those to use when addNodes()
   * is invoked. Providing the more-explicit match avoids that
   * ambiguity.)
   * @param ns NodeSet whose members should be merged into this NodeSet.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public void addNodes(NodeSet ns) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    addNodes((NodeIterator) ns);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addNodesInDocOrder(NodeIterator, XPathContext)

/**
   * Copy NodeList members into this nodelist, adding in
   * document order.  If a node is null, don't add it.
   * @param iterator NodeIterator which yields the nodes to be added.
   * @param support The XPath runtime context.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public void addNodesInDocOrder(NodeIterator iterator, XPathContext support) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    Node node;
    while (null != (node = iterator.nextNode())) {
        addNodeInDocOrder(node, support);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addNodesInDocOrder(NodeList, XPathContext)

/**
   * Copy NodeList members into this nodelist, adding in
   * document order.  If a node is null, don't add it.
   * @param nodelist List of nodes to be added
   * @param support The XPath runtime context.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public void addNodesInDocOrder(NodeList nodelist, XPathContext support) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    int nChildren = nodelist.getLength();
    for (int i = 0; i < nChildren; i++) {
        Node node = nodelist.item(i);
        if (null != node) {
            addNodeInDocOrder(node, support);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.addNodesInDocOrder(int, int, int, NodeList, XPathContext)

/**
   * Add the node list to this node set in document order.
   * @param start index.
   * @param end index.
   * @param testIndex index.
   * @param nodelist The nodelist to add.
   * @param support The XPath runtime context.
   * @return false always.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
private boolean addNodesInDocOrder(int start, int end, int testIndex, NodeList nodelist, XPathContext support) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    boolean foundit = false;
    int i;
    Node node = nodelist.item(testIndex);
    for (i = end; i >= start; i--) {
        Node child = (Node) elementAt(i);
        if (child == node) {
            i = -2;
            break;
        }
        if (!DOM2Helper.isNodeAfter(node, child)) {
            insertElementAt(node, i + 1);
            testIndex--;
            if (testIndex > 0) {
                boolean foundPrev = addNodesInDocOrder(0, i, testIndex, nodelist, support);
                if (!foundPrev) {
                    addNodesInDocOrder(i, size() - 1, testIndex, nodelist, support);
                }
            }
            break;
        }
    }
    if (i == -1) {
        insertElementAt(node, 0);
    }
    return foundit;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.getCurrentNode()

/**
   * Return the last fetched node.  Needed to support the UnionPathIterator.
   * @return the last fetched node.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a cached type, and thus doesn't permit indexed access.
   */
public Node getCurrentNode() {
    if (!m_cacheNodes) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null));
    int saved = m_next;
    Node n = (m_next < m_firstFree) ? elementAt(m_next) : null;
    m_next = saved;
    return n;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.insertElementAt(Node, int)

/**
   * Inserts the specified node in this vector at the specified index.
   * Each component in this vector with an index greater or equal to
   * the specified index is shifted upward to have an index one greater
   * than the value it had previously.
   * @param value Node to insert
   * @param at Position where to insert
   */
public void insertElementAt(Node value, int at) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    if (null == m_map) {
        m_map = new Node[m_blocksize];
        m_mapSize = m_blocksize;
    } else if ((m_firstFree + 1) >= m_mapSize) {
        m_mapSize += m_blocksize;
        Node newMap[] = new Node[m_mapSize];
        System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
        m_map = newMap;
    }
    if (at <= (m_firstFree - 1)) {
        System.arraycopy(m_map, at, m_map, at + 1, m_firstFree - at);
    }
    m_map[at] = value;
    m_firstFree++;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.insertNode(Node, int)

/**
   * Insert a node at a given position.
   * @param n Node to be added
   * @param pos Offset at which the node is to be inserted,
   * with 0 being the first position.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public void insertNode(Node n, int pos) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    insertElementAt(n, pos);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.previousNode()

/**
   *  Returns the previous node in the set and moves the position of the
   * iterator backwards in the set.
   * @return  The previous <code>Node</code> in the set being iterated over,
   *   or<code>null</code> if there are no more members in that set.
   * @throws DOMException
   *    INVALID_STATE_ERR: Raised if this method is called after the
   *   <code>detach</code> method was invoked.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a cached type, and hence doesn't know what the previous node was.
   */
public Node previousNode() throws DOMException {
    if (!m_cacheNodes) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_ITERATE, null));
    if ((m_next - 1) > 0) {
        m_next--;
        return this.elementAt(m_next);
    } else return null;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.removeElement(Node)

/**
   * Removes the first occurrence of the argument from this vector.
   * If the object is found in this vector, each component in the vector
   * with an index greater or equal to the object's index is shifted
   * downward to have an index one smaller than the value it had
   * previously.
   * @param s Node to remove from the list
   * @return True if the node was successfully removed
   */
public boolean removeElement(Node s) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    if (null == m_map) return false;
    for (int i = 0; i < m_firstFree; i++) {
        Node node = m_map[i];
        if ((null != node) && node.equals(s)) {
            if (i < m_firstFree - 1) System.arraycopy(m_map, i + 1, m_map, i, m_firstFree - i - 1);
            m_firstFree--;
            m_map[m_firstFree] = null;
            return true;
        }
    }
    return false;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.removeNode(Node)

/**
   * Remove a node.
   * @param n Node to be added
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a mutable type.
   */
public void removeNode(Node n) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    this.removeElement(n);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.runTo(int)

/**
   * If an index is requested, NodeSet will call this method
   * to run the iterator to the index.  By default this sets
   * m_next to the index.  If the index argument is -1, this
   * signals that the iterator should be run to the end.
   * @param index Position to advance (or retreat) to, with
   * 0 requesting the reset ('fresh') position and -1 (or indeed
   * any out-of-bounds value) requesting the final position.
   * @throws RuntimeException thrown if this NodeSet is not
   * one of the types which supports indexing/counting.
   */
public void runTo(int index) {
    if (!m_cacheNodes) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null));
    if ((index >= 0) && (m_next < m_firstFree)) m_next = index; else m_next = m_firstFree - 1;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.setCurrentPos(int)

/**
   * Set the current position in the node set.
   * @param i Must be a valid index.
   * @throws RuntimeException thrown if this NodeSet is not of 
   * a cached type, and thus doesn't permit indexed access.
   */
public void setCurrentPos(int i) {
    if (!m_cacheNodes) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null));
    m_next = i;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.setElementAt(Node, int)

/**
   * Sets the component at the specified index of this vector to be the
   * specified object. The previous component at that position is discarded.
   * The index must be a value greater than or equal to 0 and less
   * than the current size of the vector.
   * @param node Node to set
   * @param index Index of where to set the node
   */
public void setElementAt(Node node, int index) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null));
    if (null == m_map) {
        m_map = new Node[m_blocksize];
        m_mapSize = m_blocksize;
    }
    m_map[index] = node;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSet.setShouldCacheNodes(boolean)

/**
   * If setShouldCacheNodes(true) is called, then nodes will
   * be cached.  They are not cached by default. This switch must
   * be set before the first call to nextNode is made, to ensure
   * that all nodes are cached.
   * @param b true if this node set should be cached.
   * @throws RuntimeException thrown if an attempt is made to
   * request caching after we've already begun stepping through the
   * nodes in this set.
  */
public void setShouldCacheNodes(boolean b) {
    if (!isFresh()) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_CALL_SETSHOULDCACHENODE, null));
    m_cacheNodes = b;
    m_mutable = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.addElement(int)

/**
   * Append a Node onto the vector.
   * @param value The node to be added.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void addElement(int value) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    super.addElement(value);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.addNode(int)

/**
   * Add a node to the NodeSetDTM. Not all types of NodeSetDTMs support this
   * operation
   * @param n Node to be added
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void addNode(int n) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    this.addElement(n);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.addNodeInDocOrder(int, XPathContext)

/**
   * Add the node into a vector of nodes where it should occur in
   * document order.
   * @param v Vector of nodes, presumably containing Nodes
   * @param obj Node object.
   * @param node The node to be added.
   * @param support The XPath runtime context.
   * @return The index where it was inserted.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public int addNodeInDocOrder(int node, XPathContext support) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    return addNodeInDocOrder(node, true, support);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.addNodeInDocOrder(int, boolean, XPathContext)

/**
   * Add the node into a vector of nodes where it should occur in
   * document order.
   * @param v Vector of nodes, presumably containing Nodes
   * @param obj Node object.
   * @param node The node to be added.
   * @param test true if we should test for doc order
   * @param support The XPath runtime context.
   * @return insertIndex.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public int addNodeInDocOrder(int node, boolean test, XPathContext support) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    int insertIndex = -1;
    if (test) {
        int size = size(), i;
        for (i = size - 1; i >= 0; i--) {
            int child = elementAt(i);
            if (child == node) {
                i = -2;
                break;
            }
            DTM dtm = support.getDTM(node);
            if (!dtm.isNodeAfter(node, child)) {
                break;
            }
        }
        if (i != -2) {
            insertIndex = i + 1;
            insertElementAt(node, insertIndex);
        }
    } else {
        insertIndex = this.size();
        boolean foundit = false;
        for (int i = 0; i < insertIndex; i++) {
            if (i == node) {
                foundit = true;
                break;
            }
        }
        if (!foundit) addElement(node);
    }
    return insertIndex;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.addNodes(DTMIterator)

/**
   * Copy NodeList members into this nodelist, adding in
   * document order.  Null references are not added.
   * @param iterator DTMIterator which yields the nodes to be added.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void addNodes(DTMIterator iterator) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    if (null != iterator) {
        int obj;
        while (DTM.NULL != (obj = iterator.nextNode())) {
            addElement(obj);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.addNodesInDocOrder(DTMIterator, XPathContext)

/**
   * Copy NodeList members into this nodelist, adding in
   * document order.  If a node is null, don't add it.
   * @param iterator DTMIterator which yields the nodes to be added.
   * @param support The XPath runtime context.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void addNodesInDocOrder(DTMIterator iterator, XPathContext support) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    int node;
    while (DTM.NULL != (node = iterator.nextNode())) {
        addNodeInDocOrder(node, support);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.appendNodes(NodeVector)

/**
   * Append the nodes to the list.
   * @param nodes The nodes to be appended to this node set.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void appendNodes(NodeVector nodes) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    super.appendNodes(nodes);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.insertElementAt(int, int)

/**
   * Inserts the specified node in this vector at the specified index.
   * Each component in this vector with an index greater or equal to
   * the specified index is shifted upward to have an index one greater
   * than the value it had previously.
   * @param value The node to be inserted.
   * @param at The index where the insert should occur.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void insertElementAt(int value, int at) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    super.insertElementAt(value, at);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.insertNode(int, int)

/**
   * Insert a node at a given position.
   * @param n Node to be added
   * @param pos Offset at which the node is to be inserted,
   * with 0 being the first position.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void insertNode(int n, int pos) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    insertElementAt(n, pos);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.previousNode()

/**
   *  Returns the previous node in the set and moves the position of the
   * iterator backwards in the set.
   * @return  The previous <code>Node</code> in the set being iterated over,
   *   or<code>DTM.NULL</code> if there are no more members in that set.
   * @throws DOMException
   *    INVALID_STATE_ERR: Raised if this method is called after the
   *   <code>detach</code> method was invoked.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a cached type, and hence doesn't know what the previous node was.
   */
public int previousNode() {
    if (!m_cacheNodes) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_ITERATE, null));
    if ((m_next - 1) > 0) {
        m_next--;
        return this.elementAt(m_next);
    } else return DTM.NULL;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.removeAllElements()

/**
   * Inserts the specified node in this vector at the specified index.
   * Each component in this vector with an index greater or equal to
   * the specified index is shifted upward to have an index one greater
   * than the value it had previously.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void removeAllElements() {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    super.removeAllElements();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.removeElement(int)

/**
   * Removes the first occurrence of the argument from this vector.
   * If the object is found in this vector, each component in the vector
   * with an index greater or equal to the object's index is shifted
   * downward to have an index one smaller than the value it had
   * previously.
   * @param s The node to be removed.
   * @return True if the node was successfully removed
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public boolean removeElement(int s) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    return super.removeElement(s);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.removeElementAt(int)

/**
   * Deletes the component at the specified index. Each component in
   * this vector with an index greater or equal to the specified
   * index is shifted downward to have an index one smaller than
   * the value it had previously.
   * @param i The index of the node to be removed.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void removeElementAt(int i) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    super.removeElementAt(i);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.removeNode(int)

/**
   * Remove a node.
   * @param n Node to be added
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void removeNode(int n) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    this.removeElement(n);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.runTo(int)

/**
   * If an index is requested, NodeSetDTM will call this method
   * to run the iterator to the index.  By default this sets
   * m_next to the index.  If the index argument is -1, this
   * signals that the iterator should be run to the end.
   * @param index Position to advance (or retreat) to, with
   * 0 requesting the reset ('fresh') position and -1 (or indeed
   * any out-of-bounds value) requesting the final position.
   * @throws RuntimeException thrown if this NodeSetDTM is not
   * one of the types which supports indexing/counting.
   */
public void runTo(int index) {
    if (!m_cacheNodes) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_INDEX, null));
    if ((index >= 0) && (m_next < m_firstFree)) m_next = index; else m_next = m_firstFree - 1;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.setCurrentPos(int)

/**
   * Set the current position in the node set.
   * @param i Must be a valid index.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a cached type, and thus doesn't permit indexed access.
   */
public void setCurrentPos(int i) {
    if (!m_cacheNodes) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_INDEX, null));
    m_next = i;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.setElementAt(int, int)

/**
   * Sets the component at the specified index of this vector to be the
   * specified object. The previous component at that position is discarded.
   * The index must be a value greater than or equal to 0 and less
   * than the current size of the vector.
   * @param node  The node to be set.
   * @param index The index of the node to be replaced.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void setElementAt(int node, int index) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    super.setElementAt(node, index);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.setItem(int, int)

/**
   * Same as setElementAt.
   * @param node  The node to be set.
   * @param index The index of the node to be replaced.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a mutable type.
   */
public void setItem(int node, int index) {
    if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null));
    super.setElementAt(node, index);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.setShouldCacheNodes(boolean)

/**
   * If setShouldCacheNodes(true) is called, then nodes will
   * be cached.  They are not cached by default. This switch must
   * be set before the first call to nextNode is made, to ensure
   * that all nodes are cached.
   * @param b true if this node set should be cached.
   * @throws RuntimeException thrown if an attempt is made to
   * request caching after we've already begun stepping through the
   * nodes in this set.
  */
public void setShouldCacheNodes(boolean b) {
    if (!isFresh()) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_CALL_SETSHOULDCACHENODE, null));
    m_cacheNodes = b;
    m_mutable = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.XPath.assertion(boolean, String)

/**
   * Tell the user of an assertion error, and probably throw an
   * exception.
   * @param b  If false, a runtime exception will be thrown.
   * @param msg The assertion message, which should be informative.
   * @throws RuntimeException if the b argument is false.
   */
public void assertion(boolean b, String msg) {
    if (!b) {
        String fMsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] { msg });
        throw new RuntimeException(fMsg);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.AxesWalker.setRoot(int)

/**
   * Set the root node of the TreeWalker.
   * (Not part of the DOM2 TreeWalker interface).
   * @param root The context node of this step.
   */
public void setRoot(int root) {
    XPathContext xctxt = wi().getXPathContext();
    m_dtm = xctxt.getDTM(root);
    m_traverser = m_dtm.getAxisTraverser(m_axis);
    m_isFresh = true;
    m_foundLast = false;
    m_root = root;
    m_currentNode = root;
    if (DTM.NULL == root) {
        throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_SETTING_WALKER_ROOT_TO_NULL, null));
    }
    resetProximityPositions();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.FilterExprWalker.acceptNode(int)

/**
   * This method needs to override AxesWalker.acceptNode because FilterExprWalkers
   * don't need to, and shouldn't, do a node test.
   * @param n  The node to check to see if it passes the filter or not.
   * @return  a constant to determine whether the node is accepted,
   *   rejected, or skipped, as defined  above .
   */
public short acceptNode(int n) {
    try {
        if (getPredicateCount() > 0) {
            countProximityPosition(0);
            if (!executePredicates(n, m_lpi.getXPathContext())) return DTMIterator.FILTER_SKIP;
        }
        return DTMIterator.FILTER_ACCEPT;
    } catch (javax.xml.transform.TransformerException se) {
        throw new RuntimeException(se.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.LocPathIterator.previousNode()

/**
   *  Returns the previous node in the set and moves the position of the
   * iterator backwards in the set.
   * @return  The previous <code>Node</code> in the set being iterated over,
   *   or<code>null</code> if there are no more members in that set.
   */
public int previousNode() {
    throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_ITERATE, null));
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.MatchPatternIterator.acceptNode(int, XPathContext)

/**
   *  Test whether a specified node is visible in the logical view of a
   * TreeWalker or NodeIterator. This function will be called by the
   * implementation of TreeWalker and NodeIterator; it is not intended to
   * be called directly from user code.
   * @param n  The node to check to see if it passes the filter or not.
   * @return  a constant to determine whether the node is accepted,
   *   rejected, or skipped, as defined  above .
   */
public short acceptNode(int n, XPathContext xctxt) {
    try {
        xctxt.pushCurrentNode(n);
        xctxt.pushIteratorRoot(m_context);
        if (DEBUG) {
            System.out.println('traverser: ' + m_traverser);
            System.out.print('node: ' + n);
            System.out.println(', ' + m_cdtm.getNodeName(n));
            System.out.println('pattern: ' + m_pattern.toString());
            m_pattern.debugWhatToShow(m_pattern.getWhatToShow());
        }
        XObject score = m_pattern.execute(xctxt);
        if (DEBUG) {
            System.out.println('score: ' + score);
            System.out.println('skip: ' + (score == NodeTest.SCORE_NONE));
        }
        return (score == NodeTest.SCORE_NONE) ? DTMIterator.FILTER_SKIP : DTMIterator.FILTER_ACCEPT;
    } catch (javax.xml.transform.TransformerException se) {
        throw new RuntimeException(se.getMessage());
    } finally {
        xctxt.popCurrentNode();
        xctxt.popIteratorRoot();
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.acceptNode(int)

/**
   *  Test whether a specified node is visible in the logical view of a
   * TreeWalker or NodeIterator. This function will be called by the
   * implementation of TreeWalker and NodeIterator; it is not intended to
   * be called directly from user code.
   * @param n  The node to check to see if it passes the filter or not.
   * @return  a constant to determine whether the node is accepted,
   *   rejected, or skipped, as defined  above .
   */
public short acceptNode(int n) {
    XPathContext xctxt = m_lpi.getXPathContext();
    try {
        xctxt.pushCurrentNode(n);
        XObject score = execute(xctxt, n);
        if (score != NodeTest.SCORE_NONE) {
            if (getPredicateCount() > 0) {
                countProximityPosition(0);
                if (!executePredicates(n, xctxt)) return DTMIterator.FILTER_SKIP;
            }
            return DTMIterator.FILTER_ACCEPT;
        }
    } catch (javax.xml.transform.TransformerException se) {
        throw new RuntimeException(se.getMessage());
    } finally {
        xctxt.popCurrentNode();
    }
    return DTMIterator.FILTER_SKIP;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.UnionChildIterator.acceptNode(int)

/**
   * Test whether a specified node is visible in the logical view of a
   * TreeWalker or NodeIterator. This function will be called by the
   * implementation of TreeWalker and NodeIterator; it is not intended to
   * be called directly from user code.
   * @param n  The node to check to see if it passes the filter or not.
   * @return  a constant to determine whether the node is accepted,
   *   rejected, or skipped, as defined  above .
   */
public short acceptNode(int n) {
    XPathContext xctxt = getXPathContext();
    try {
        xctxt.pushCurrentNode(n);
        for (int i = 0; i < m_nodeTests.length; i++) {
            PredicatedNodeTest pnt = m_nodeTests[i];
            XObject score = pnt.execute(xctxt, n);
            if (score != NodeTest.SCORE_NONE) {
                if (pnt.getPredicateCount() > 0) {
                    if (pnt.executePredicates(n, xctxt)) return DTMIterator.FILTER_ACCEPT;
                } else return DTMIterator.FILTER_ACCEPT;
            }
        }
    } catch (javax.xml.transform.TransformerException se) {
        throw new RuntimeException(se.getMessage());
    } finally {
        xctxt.popCurrentNode();
    }
    return DTMIterator.FILTER_SKIP;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.WalkerFactory.analyze(Compiler, int, int)

/**
   * Analyze the location path and return 32 bits that give information about
   * the location path as a whole.  See the BIT_XXX constants for meaning about
   * each of the bits.
   * @param compiler non-null reference to compiler object that has processed
   *                 the XPath operations into an opcode map.
   * @param stepOpCodePos The opcode position for the step.
   * @param stepIndex The top-level step index withing the iterator.
   * @return 32 bits as an integer that give information about the location
   * path as a whole.
   * @throws javax.xml.transform.TransformerException
   */
private static int analyze(Compiler compiler, int stepOpCodePos, int stepIndex) throws javax.xml.transform.TransformerException {
    int stepType;
    int stepCount = 0;
    int analysisResult = 0x00000000;
    while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos))) {
        stepCount++;
        boolean predAnalysis = analyzePredicate(compiler, stepOpCodePos, stepType);
        if (predAnalysis) analysisResult |= BIT_PREDICATE;
        switch(stepType) {
            case OpCodes.OP_VARIABLE:
            case OpCodes.OP_EXTFUNCTION:
            case OpCodes.OP_FUNCTION:
            case OpCodes.OP_GROUP:
                analysisResult |= BIT_FILTER;
                break;
            case OpCodes.FROM_ROOT:
                analysisResult |= BIT_ROOT;
                break;
            case OpCodes.FROM_ANCESTORS:
                analysisResult |= BIT_ANCESTOR;
                break;
            case OpCodes.FROM_ANCESTORS_OR_SELF:
                analysisResult |= BIT_ANCESTOR_OR_SELF;
                break;
            case OpCodes.FROM_ATTRIBUTES:
                analysisResult |= BIT_ATTRIBUTE;
                break;
            case OpCodes.FROM_NAMESPACE:
                analysisResult |= BIT_NAMESPACE;
                break;
            case OpCodes.FROM_CHILDREN:
                analysisResult |= BIT_CHILD;
                break;
            case OpCodes.FROM_DESCENDANTS:
                analysisResult |= BIT_DESCENDANT;
                break;
            case OpCodes.FROM_DESCENDANTS_OR_SELF:
                if (2 == stepCount && BIT_ROOT == analysisResult) {
                    analysisResult |= BIT_ANY_DESCENDANT_FROM_ROOT;
                }
                analysisResult |= BIT_DESCENDANT_OR_SELF;
                break;
            case OpCodes.FROM_FOLLOWING:
                analysisResult |= BIT_FOLLOWING;
                break;
            case OpCodes.FROM_FOLLOWING_SIBLINGS:
                analysisResult |= BIT_FOLLOWING_SIBLING;
                break;
            case OpCodes.FROM_PRECEDING:
                analysisResult |= BIT_PRECEDING;
                break;
            case OpCodes.FROM_PRECEDING_SIBLINGS:
                analysisResult |= BIT_PRECEDING_SIBLING;
                break;
            case OpCodes.FROM_PARENT:
                analysisResult |= BIT_PARENT;
                break;
            case OpCodes.FROM_SELF:
                analysisResult |= BIT_SELF;
                break;
            case OpCodes.MATCH_ATTRIBUTE:
                analysisResult |= (BIT_MATCH_PATTERN | BIT_ATTRIBUTE);
                break;
            case OpCodes.MATCH_ANY_ANCESTOR:
                analysisResult |= (BIT_MATCH_PATTERN | BIT_ANCESTOR);
                break;
            case OpCodes.MATCH_IMMEDIATE_ANCESTOR:
                analysisResult |= (BIT_MATCH_PATTERN | BIT_PARENT);
                break;
            default:
                throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[] { Integer.toString(stepType) }));
        }
        if (OpCodes.NODETYPE_NODE == compiler.getOp(stepOpCodePos + 3)) {
            analysisResult |= BIT_NODETEST_ANY;
        }
        stepOpCodePos = compiler.getNextStepPos(stepOpCodePos);
        if (stepOpCodePos < 0) break;
    }
    analysisResult |= (stepCount & BITS_COUNT);
    return analysisResult;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.WalkerFactory.createDefaultStepPattern(Compiler, int, MatchPatternIterator, int, StepPattern, StepPattern)

/**
   * Create a StepPattern that is contained within a LocationPath.
   *
   * @param compiler The compiler that holds the syntax tree/op map to
   * construct from.
   * @param stepOpCodePos The current op code position within the opmap.
   * @param mpi The MatchPatternIterator to which the steps will be attached.
   * @param analysis 32 bits of analysis, from which the type of AxesWalker
   *                 may be influenced.
   * @param tail The step that is the first step analyzed, but the last 
   *                  step in the relative match linked list, i.e. the tail.
   *                  May be null.
   * @param head The step that is the current head of the relative 
   *                 match step linked list.
   *                 May be null.
   * @return the head of the list.
   * @throws javax.xml.transform.TransformerException
   */
private static StepPattern createDefaultStepPattern(Compiler compiler, int opPos, MatchPatternIterator mpi, int analysis, StepPattern tail, StepPattern head) throws javax.xml.transform.TransformerException {
    int stepType = compiler.getOp(opPos);
    boolean simpleInit = false;
    int totalNumberWalkers = (analysis & BITS_COUNT);
    boolean prevIsOneStepDown = true;
    int firstStepPos = compiler.getFirstChildPos(opPos);
    int whatToShow = compiler.getWhatToShow(opPos);
    StepPattern ai = null;
    int axis, predicateAxis;
    switch(stepType) {
        case OpCodes.OP_VARIABLE:
        case OpCodes.OP_EXTFUNCTION:
        case OpCodes.OP_FUNCTION:
        case OpCodes.OP_GROUP:
            prevIsOneStepDown = false;
            Expression expr;
            switch(stepType) {
                case OpCodes.OP_VARIABLE:
                case OpCodes.OP_EXTFUNCTION:
                case OpCodes.OP_FUNCTION:
                case OpCodes.OP_GROUP:
                    expr = compiler.compile(opPos);
                    break;
                default:
                    expr = compiler.compile(opPos + 2);
            }
            axis = Axis.FILTEREDLIST;
            predicateAxis = Axis.FILTEREDLIST;
            ai = new FunctionPattern(expr, axis, predicateAxis);
            simpleInit = true;
            break;
        case OpCodes.FROM_ROOT:
            whatToShow = DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT;
            axis = Axis.ROOT;
            predicateAxis = Axis.ROOT;
            ai = new StepPattern(DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT, axis, predicateAxis);
            break;
        case OpCodes.FROM_ATTRIBUTES:
            whatToShow = DTMFilter.SHOW_ATTRIBUTE;
            axis = Axis.PARENT;
            predicateAxis = Axis.ATTRIBUTE;
            break;
        case OpCodes.FROM_NAMESPACE:
            whatToShow = DTMFilter.SHOW_NAMESPACE;
            axis = Axis.PARENT;
            predicateAxis = Axis.NAMESPACE;
            break;
        case OpCodes.FROM_ANCESTORS:
            axis = Axis.DESCENDANT;
            predicateAxis = Axis.ANCESTOR;
            break;
        case OpCodes.FROM_CHILDREN:
            axis = Axis.PARENT;
            predicateAxis = Axis.CHILD;
            break;
        case OpCodes.FROM_ANCESTORS_OR_SELF:
            axis = Axis.DESCENDANTORSELF;
            predicateAxis = Axis.ANCESTORORSELF;
            break;
        case OpCodes.FROM_SELF:
            axis = Axis.SELF;
            predicateAxis = Axis.SELF;
            break;
        case OpCodes.FROM_PARENT:
            axis = Axis.CHILD;
            predicateAxis = Axis.PARENT;
            break;
        case OpCodes.FROM_PRECEDING_SIBLINGS:
            axis = Axis.FOLLOWINGSIBLING;
            predicateAxis = Axis.PRECEDINGSIBLING;
            break;
        case OpCodes.FROM_PRECEDING:
            axis = Axis.FOLLOWING;
            predicateAxis = Axis.PRECEDING;
            break;
        case OpCodes.FROM_FOLLOWING_SIBLINGS:
            axis = Axis.PRECEDINGSIBLING;
            predicateAxis = Axis.FOLLOWINGSIBLING;
            break;
        case OpCodes.FROM_FOLLOWING:
            axis = Axis.PRECEDING;
            predicateAxis = Axis.FOLLOWING;
            break;
        case OpCodes.FROM_DESCENDANTS_OR_SELF:
            axis = Axis.ANCESTORORSELF;
            predicateAxis = Axis.DESCENDANTORSELF;
            break;
        case OpCodes.FROM_DESCENDANTS:
            axis = Axis.ANCESTOR;
            predicateAxis = Axis.DESCENDANT;
            break;
        default:
            throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[] { Integer.toString(stepType) }));
    }
    if (null == ai) {
        whatToShow = compiler.getWhatToShow(opPos);
        ai = new StepPattern(whatToShow, compiler.getStepNS(opPos), compiler.getStepLocalName(opPos), axis, predicateAxis);
    }
    if (false || DEBUG_PATTERN_CREATION) {
        System.out.print('new step: ' + ai);
        System.out.print(', axis: ' + Axis.names[ai.getAxis()]);
        System.out.print(', predAxis: ' + Axis.names[ai.getAxis()]);
        System.out.print(', what: ');
        System.out.print('    ');
        ai.debugWhatToShow(ai.getWhatToShow());
    }
    int argLen = compiler.getFirstPredicateOpPos(opPos);
    ai.setPredicates(compiler.getCompiledPredicates(argLen));
    return ai;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.WalkerFactory.createDefaultWalker(Compiler, int, WalkingIterator, int)

/**
   * Create the proper Walker from the axes type.
   * @param compiler non-null reference to compiler object that has processed
   *                 the XPath operations into an opcode map.
   * @param opPos The opcode position for the step.
   * @param lpi The owning location path iterator.
   * @param analysis 32 bits of analysis, from which the type of AxesWalker
   *                 may be influenced.
   * @return non-null reference to AxesWalker derivative.
   * @throws RuntimeException if the input is bad.
   */
private static AxesWalker createDefaultWalker(Compiler compiler, int opPos, WalkingIterator lpi, int analysis) {
    AxesWalker ai = null;
    int stepType = compiler.getOp(opPos);
    boolean simpleInit = false;
    int totalNumberWalkers = (analysis & BITS_COUNT);
    boolean prevIsOneStepDown = true;
    switch(stepType) {
        case OpCodes.OP_VARIABLE:
        case OpCodes.OP_EXTFUNCTION:
        case OpCodes.OP_FUNCTION:
        case OpCodes.OP_GROUP:
            prevIsOneStepDown = false;
            if (DEBUG_WALKER_CREATION) System.out.println('new walker:  FilterExprWalker: ' + analysis + ', ' + compiler.toString());
            ai = new FilterExprWalker(lpi);
            simpleInit = true;
            break;
        case OpCodes.FROM_ROOT:
            ai = new AxesWalker(lpi, Axis.ROOT);
            break;
        case OpCodes.FROM_ANCESTORS:
            prevIsOneStepDown = false;
            ai = new ReverseAxesWalker(lpi, Axis.ANCESTOR);
            break;
        case OpCodes.FROM_ANCESTORS_OR_SELF:
            prevIsOneStepDown = false;
            ai = new ReverseAxesWalker(lpi, Axis.ANCESTORORSELF);
            break;
        case OpCodes.FROM_ATTRIBUTES:
            ai = new AxesWalker(lpi, Axis.ATTRIBUTE);
            break;
        case OpCodes.FROM_NAMESPACE:
            ai = new AxesWalker(lpi, Axis.NAMESPACE);
            break;
        case OpCodes.FROM_CHILDREN:
            ai = new AxesWalker(lpi, Axis.CHILD);
            break;
        case OpCodes.FROM_DESCENDANTS:
            prevIsOneStepDown = false;
            ai = new AxesWalker(lpi, Axis.DESCENDANT);
            break;
        case OpCodes.FROM_DESCENDANTS_OR_SELF:
            prevIsOneStepDown = false;
            ai = new AxesWalker(lpi, Axis.DESCENDANTORSELF);
            break;
        case OpCodes.FROM_FOLLOWING:
            prevIsOneStepDown = false;
            ai = new AxesWalker(lpi, Axis.FOLLOWING);
            break;
        case OpCodes.FROM_FOLLOWING_SIBLINGS:
            prevIsOneStepDown = false;
            ai = new AxesWalker(lpi, Axis.FOLLOWINGSIBLING);
            break;
        case OpCodes.FROM_PRECEDING:
            prevIsOneStepDown = false;
            ai = new ReverseAxesWalker(lpi, Axis.PRECEDING);
            break;
        case OpCodes.FROM_PRECEDING_SIBLINGS:
            prevIsOneStepDown = false;
            ai = new ReverseAxesWalker(lpi, Axis.PRECEDINGSIBLING);
            break;
        case OpCodes.FROM_PARENT:
            prevIsOneStepDown = false;
            ai = new ReverseAxesWalker(lpi, Axis.PARENT);
            break;
        case OpCodes.FROM_SELF:
            ai = new AxesWalker(lpi, Axis.SELF);
            break;
        default:
            throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[] { Integer.toString(stepType) }));
    }
    if (simpleInit) {
        ai.initNodeTest(DTMFilter.SHOW_ALL);
    } else {
        int whatToShow = compiler.getWhatToShow(opPos);
        if ((0 == (whatToShow & (DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_NAMESPACE | DTMFilter.SHOW_ELEMENT | DTMFilter.SHOW_PROCESSING_INSTRUCTION))) || (whatToShow == DTMFilter.SHOW_ALL)) ai.initNodeTest(whatToShow); else {
            ai.initNodeTest(whatToShow, compiler.getStepNS(opPos), compiler.getStepLocalName(opPos));
        }
    }
    return ai;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.WalkerFactory.getAxisFromStep(Compiler, int)

/**
   * Special purpose function to see if we can optimize the pattern for 
   * a DescendantIterator.
   * @param compiler non-null reference to compiler object that has processed
   *                 the XPath operations into an opcode map.
   * @param stepOpCodePos The opcode position for the step.
   * @param stepIndex The top-level step index withing the iterator.
   * @return 32 bits as an integer that give information about the location
   * path as a whole.
   * @throws javax.xml.transform.TransformerException
   */
public static int getAxisFromStep(Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException {
    int stepType = compiler.getOp(stepOpCodePos);
    switch(stepType) {
        case OpCodes.FROM_FOLLOWING:
            return Axis.FOLLOWING;
        case OpCodes.FROM_FOLLOWING_SIBLINGS:
            return Axis.FOLLOWINGSIBLING;
        case OpCodes.FROM_PRECEDING:
            return Axis.PRECEDING;
        case OpCodes.FROM_PRECEDING_SIBLINGS:
            return Axis.PRECEDINGSIBLING;
        case OpCodes.FROM_PARENT:
            return Axis.PARENT;
        case OpCodes.FROM_NAMESPACE:
            return Axis.NAMESPACE;
        case OpCodes.FROM_ANCESTORS:
            return Axis.ANCESTOR;
        case OpCodes.FROM_ANCESTORS_OR_SELF:
            return Axis.ANCESTORORSELF;
        case OpCodes.FROM_ATTRIBUTES:
            return Axis.ATTRIBUTE;
        case OpCodes.FROM_ROOT:
            return Axis.ROOT;
        case OpCodes.FROM_CHILDREN:
            return Axis.CHILD;
        case OpCodes.FROM_DESCENDANTS_OR_SELF:
            return Axis.DESCENDANTORSELF;
        case OpCodes.FROM_DESCENDANTS:
            return Axis.DESCENDANT;
        case OpCodes.FROM_SELF:
            return Axis.SELF;
        case OpCodes.OP_EXTFUNCTION:
        case OpCodes.OP_FUNCTION:
        case OpCodes.OP_GROUP:
        case OpCodes.OP_VARIABLE:
            return Axis.FILTEREDLIST;
    }
    throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[] { Integer.toString(stepType) }));
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.WalkerFactory.isNaturalDocOrder(Compiler, int, int, int)

/**
   * Tell if the pattern can be 'walked' with the iteration steps in natural 
   * document order, without duplicates.
   * @param compiler non-null reference to compiler object that has processed
   *                 the XPath operations into an opcode map.
   * @param stepOpCodePos The opcode position for the step.
   * @param stepIndex The top-level step index withing the iterator.
   * @param analysis The general analysis of the pattern.
   * @return true if the walk can be done in natural order.
   * @throws javax.xml.transform.TransformerException
   */
private static boolean isNaturalDocOrder(Compiler compiler, int stepOpCodePos, int stepIndex, int analysis) throws javax.xml.transform.TransformerException {
    if (canCrissCross(analysis)) return false;
    if (isSet(analysis, BIT_NAMESPACE)) return false;
    if (isSet(analysis, BIT_FOLLOWING | BIT_FOLLOWING_SIBLING) && isSet(analysis, BIT_PRECEDING | BIT_PRECEDING_SIBLING)) return false;
    int stepType;
    int stepCount = 0;
    boolean foundWildAttribute = false;
    int potentialDuplicateMakingStepCount = 0;
    while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos))) {
        stepCount++;
        switch(stepType) {
            case OpCodes.FROM_ATTRIBUTES:
            case OpCodes.MATCH_ATTRIBUTE:
                if (foundWildAttribute) return false;
                String localName = compiler.getStepLocalName(stepOpCodePos);
                if (localName.equals('*')) {
                    foundWildAttribute = true;
                }
                break;
            case OpCodes.FROM_FOLLOWING:
            case OpCodes.FROM_FOLLOWING_SIBLINGS:
            case OpCodes.FROM_PRECEDING:
            case OpCodes.FROM_PRECEDING_SIBLINGS:
            case OpCodes.FROM_PARENT:
            case OpCodes.OP_VARIABLE:
            case OpCodes.OP_EXTFUNCTION:
            case OpCodes.OP_FUNCTION:
            case OpCodes.OP_GROUP:
            case OpCodes.FROM_NAMESPACE:
            case OpCodes.FROM_ANCESTORS:
            case OpCodes.FROM_ANCESTORS_OR_SELF:
            case OpCodes.MATCH_ANY_ANCESTOR:
            case OpCodes.MATCH_IMMEDIATE_ANCESTOR:
            case OpCodes.FROM_DESCENDANTS_OR_SELF:
            case OpCodes.FROM_DESCENDANTS:
                if (potentialDuplicateMakingStepCount > 0) return false;
                potentialDuplicateMakingStepCount++;
            case OpCodes.FROM_ROOT:
            case OpCodes.FROM_CHILDREN:
            case OpCodes.FROM_SELF:
                if (foundWildAttribute) return false;
                break;
            default:
                throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[] { Integer.toString(stepType) }));
        }
        int nextStepOpCodePos = compiler.getNextStepPos(stepOpCodePos);
        if (nextStepOpCodePos < 0) break;
        stepOpCodePos = nextStepOpCodePos;
    }
    return true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.axes.WalkerFactory.isOptimizableForDescendantIterator(Compiler, int, int)

/**
   * Special purpose function to see if we can optimize the pattern for 
   * a DescendantIterator.
   * @param compiler non-null reference to compiler object that has processed
   *                 the XPath operations into an opcode map.
   * @param stepOpCodePos The opcode position for the step.
   * @param stepIndex The top-level step index withing the iterator.
   * @return 32 bits as an integer that give information about the location
   * path as a whole.
   * @throws javax.xml.transform.TransformerException
   */
private static boolean isOptimizableForDescendantIterator(Compiler compiler, int stepOpCodePos, int stepIndex) throws javax.xml.transform.TransformerException {
    int stepType;
    int stepCount = 0;
    boolean foundDorDS = false;
    boolean foundSelf = false;
    boolean foundDS = false;
    int nodeTestType = OpCodes.NODETYPE_NODE;
    while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos))) {
        if (nodeTestType != OpCodes.NODETYPE_NODE && nodeTestType != OpCodes.NODETYPE_ROOT) return false;
        stepCount++;
        if (stepCount > 3) return false;
        boolean mightBeProximate = mightBeProximate(compiler, stepOpCodePos, stepType);
        if (mightBeProximate) return false;
        switch(stepType) {
            case OpCodes.FROM_FOLLOWING:
            case OpCodes.FROM_FOLLOWING_SIBLINGS:
            case OpCodes.FROM_PRECEDING:
            case OpCodes.FROM_PRECEDING_SIBLINGS:
            case OpCodes.FROM_PARENT:
            case OpCodes.OP_VARIABLE:
            case OpCodes.OP_EXTFUNCTION:
            case OpCodes.OP_FUNCTION:
            case OpCodes.OP_GROUP:
            case OpCodes.FROM_NAMESPACE:
            case OpCodes.FROM_ANCESTORS:
            case OpCodes.FROM_ANCESTORS_OR_SELF:
            case OpCodes.FROM_ATTRIBUTES:
            case OpCodes.MATCH_ATTRIBUTE:
            case OpCodes.MATCH_ANY_ANCESTOR:
            case OpCodes.MATCH_IMMEDIATE_ANCESTOR:
                return false;
            case OpCodes.FROM_ROOT:
                if (1 != stepCount) return false;
                break;
            case OpCodes.FROM_CHILDREN:
                if (!foundDS && !(foundDorDS && foundSelf)) return false;
                break;
            case OpCodes.FROM_DESCENDANTS_OR_SELF:
                foundDS = true;
            case OpCodes.FROM_DESCENDANTS:
                if (3 == stepCount) return false;
                foundDorDS = true;
                break;
            case OpCodes.FROM_SELF:
                if (1 != stepCount) return false;
                foundSelf = true;
                break;
            default:
                throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[] { Integer.toString(stepType) }));
        }
        nodeTestType = compiler.getStepTestType(stepOpCodePos);
        int nextStepOpCodePos = compiler.getNextStepPos(stepOpCodePos);
        if (nextStepOpCodePos < 0) break;
        if (OpCodes.ENDOP != compiler.getOp(nextStepOpCodePos)) {
            if (compiler.countPredicates(stepOpCodePos) > 0) {
                return false;
            }
        }
        stepOpCodePos = nextStepOpCodePos;
    }
    return true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.compiler.Compiler.assertion(boolean, java.lang.String)

/**
   * Tell the user of an assertion error, and probably throw an
   * exception.
   * @param b  If false, a runtime exception will be thrown.
   * @param msg The assertion message, which should be informative.
   * @throws RuntimeException if the b argument is false.
   */
public void assertion(boolean b, java.lang.String msg) {
    if (!b) {
        java.lang.String fMsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] { msg });
        throw new RuntimeException(fMsg);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.compiler.OpMap.getNextStepPos(int)

/**
   * Given a location step position, return the end position, i.e. the
   * beginning of the next step.
   * @param opPos the position of a location step.
   * @return the position of the next location step.
   */
public int getNextStepPos(int opPos) {
    int stepType = getOp(opPos);
    if ((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES)) {
        return getNextOpPos(opPos);
    } else if ((stepType >= OpCodes.FIRST_NODESET_OP) && (stepType <= OpCodes.LAST_NODESET_OP)) {
        int newOpPos = getNextOpPos(opPos);
        while (OpCodes.OP_PREDICATE == getOp(newOpPos)) {
            newOpPos = getNextOpPos(newOpPos);
        }
        stepType = getOp(newOpPos);
        if (!((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES))) {
            return OpCodes.ENDOP;
        }
        return newOpPos;
    } else {
        throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_UNKNOWN_STEP, new Object[] { new Integer(stepType).toString() }));
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.compiler.XPathParser.assertion(boolean, String)

/**
   * Notify the user of an assertion error, and probably throw an
   * exception.
   * @param b  If false, a runtime exception will be thrown.
   * @param msg The assertion message, which should be informative.
   * @throws RuntimeException if the b argument is false.
   */
private void assertion(boolean b, String msg) {
    if (!b) {
        String fMsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] { msg });
        throw new RuntimeException(fMsg);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.functions.FuncCurrent.execute(XPathContext)

/**
   * Execute the function.  The function must return
   * a valid object.
   * @param xctxt The current execution context.
   * @return A valid XObject.
   * @throws javax.xml.transform.TransformerException
   */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException {
    SubContextList subContextList = xctxt.getCurrentNodeList();
    int currentNode = DTM.NULL;
    if (null != subContextList) {
        if (subContextList instanceof PredicatedNodeTest) {
            LocPathIterator iter = ((PredicatedNodeTest) subContextList).getLocPathIterator();
            currentNode = iter.getCurrentContextNode();
        } else if (subContextList instanceof StepPattern) {
            throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_PROCESSOR_ERROR, null));
        }
    } else {
        currentNode = xctxt.getContextNode();
    }
    return new XNodeSet(currentNode, xctxt.getDTMManager());
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.functions.FuncExtFunction.reportWrongNumberArgs()

/**
   * Constructs and throws a WrongNumberArgException with the appropriate
   * message for this function object.  This class supports an arbitrary
   * number of arguments, so this method must never be called.
   * @throws WrongNumberArgsException
   */
protected void reportWrongNumberArgs() throws WrongNumberArgsException {
    String fMsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] { 'Programmer's assertion:  the method FunctionMultiArgs.reportWrongNumberArgs() should never be called.' });
    throw new RuntimeException(fMsg);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.functions.FunctionMultiArgs.reportWrongNumberArgs()

/**
   * Constructs and throws a WrongNumberArgException with the appropriate
   * message for this function object.  This class supports an arbitrary
   * number of arguments, so this method must never be called.
   * @throws WrongNumberArgsException
   */
protected void reportWrongNumberArgs() throws WrongNumberArgsException {
    String fMsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] { 'Programmer's assertion:  the method FunctionMultiArgs.reportWrongNumberArgs() should never be called.' });
    throw new RuntimeException(fMsg);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.objects.XNodeSet.getFresh()

/**
   * Get a fresh copy of the object.  For use with variables.
   * @return A fresh nodelist.
   */
public XObject getFresh() {
    try {
        if (hasCache()) return (XObject) cloneWithReset(); else return this;
    } catch (CloneNotSupportedException cnse) {
        throw new RuntimeException(cnse.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.objects.XNodeSet.iter()

/**
   * Cast result object to a nodelist.
   * @return The nodeset as a nodelist
   */
public DTMIterator iter() {
    try {
        if (hasCache()) return cloneWithReset(); else return this;
    } catch (CloneNotSupportedException cnse) {
        throw new RuntimeException(cnse.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.objects.XRTreeFragSelectWrapper.asNodeIterator()

/**
   * Cast result object to a DTMIterator.
   * @return The document fragment as a DTMIterator
   */
public DTMIterator asNodeIterator() {
    throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null));
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.objects.XRTreeFragSelectWrapper.rtf()

/**
   * Cast result object to a result tree fragment.
   * @return The document fragment this wraps
   */
public int rtf() {
    throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null));
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.objects.XStringForChars.fsb()

/**
   * Cast result object to a string.
   * @return The string this wraps or the empty string if null
   */
public FastStringBuffer fsb() {
    throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS, null));
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.res.XPATHMessages.createXPATHMsg(ListResourceBundle, String, Object)

/**
   * Creates a message from the specified key and replacement
   * arguments, localized to the given locale.
   * @param errorCode The key for the message text.
   * @param fResourceBundle The resource bundle to use.
   * @param msgKey  The message key to use.
   * @param args      The arguments to be used as replacement text
   *                  in the message created.
   * @return The formatted message string.
   */
public static final String createXPATHMsg(ListResourceBundle fResourceBundle, String msgKey, Object args[]) {
    String fmsg = null;
    boolean throwex = false;
    String msg = null;
    if (msgKey != null) msg = fResourceBundle.getString(msgKey);
    if (msg == null) {
        msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE);
        throwex = true;
    }
    if (args != null) {
        try {
            int n = args.length;
            for (int i = 0; i < n; i++) {
                if (null == args[i]) args[i] = '';
            }
            fmsg = java.text.MessageFormat.format(msg, args);
        } catch (Exception e) {
            fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED);
            fmsg += ' ' + msg;
        }
    } else fmsg = msg;
    if (throwex) {
        throw new RuntimeException(fmsg);
    }
    return fmsg;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.beans.EventHandler.invokeInternal(Object, Method, Object[])

private Object invokeInternal(Object proxy, Method method, Object[] arguments) {
    String methodName = method.getName();
    if (method.getDeclaringClass() == Object.class) {
        if (methodName.equals('hashCode')) {
            return new Integer(System.identityHashCode(proxy));
        } else if (methodName.equals('equals')) {
            return (proxy == arguments[0] ? Boolean.TRUE : Boolean.FALSE);
        } else if (methodName.equals('toString')) {
            return proxy.getClass().getName() + '@' + Integer.toHexString(proxy.hashCode());
        }
    }
    if (listenerMethodName == null || listenerMethodName.equals(methodName)) {
        Class[] argTypes = null;
        Object[] newArgs = null;
        if (eventPropertyName == null) {
            newArgs = new Object[] {};
            argTypes = new Class[] {};
        } else {
            Object input = applyGetters(arguments[0], getEventPropertyName());
            newArgs = new Object[] { input };
            argTypes = new Class[] { input.getClass() };
        }
        try {
            if (targetMethod == null) {
                targetMethod = ReflectionUtils.getMethod(target.getClass(), action, argTypes);
            }
            if (targetMethod == null) {
                targetMethod = ReflectionUtils.getMethod(target.getClass(), 'set' + NameGenerator.capitalize(action), argTypes);
            }
            if (targetMethod == null) {
                throw new RuntimeException('No method called: ' + action + ' on class ' + target.getClass() + ' with argument ' + argTypes[0]);
            }
            return MethodUtil.invoke(targetMethod, target, newArgs);
        } catch (IllegalAccessException ex) {
            throw new RuntimeException(ex);
        } catch (InvocationTargetException ex) {
            throw new RuntimeException(ex.getTargetException());
        }
    }
    return null;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.addRelation(ObjectName)

/**
     * Adds an MBean created by the user (and registered by him in the MBean
     * Server) as a relation in the Relation Service.
     * <P>To be added as a relation, the MBean must conform to the
     * following:
     * <P>- implement the Relation interface
     * <P>- have for RelationService ObjectName the ObjectName of current
     * Relation Service
     * <P>- have a relation id unique and unused in current Relation Service
     * <P>- have for relation type a relation type created in the Relation
     * Service
     * <P>- have roles conforming to the role info provided in the relation
     * type.
     * @param theRelObjectName  ObjectName of the relation MBean to be added.
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationServiceNotRegisteredException  if the Relation
     * Service is not registered in the MBean Server
     * @exception NoSuchMethodException  If the MBean does not implement the
     * Relation interface
     * @exception InvalidRelationIdException  if:
     * <P>- no relation identifier in MBean
     * <P>- the relation identifier is already used in the Relation Service
     * @exception InstanceNotFoundException  if the MBean for given ObjectName
     * has not been registered
     * @exception InvalidRelationServiceException  if:
     * <P>- no Relation Service name in MBean
     * <P>- the Relation Service name in the MBean is not the one of the
     * current Relation Service
     * @exception RelationTypeNotFoundException  if:
     * <P>- no relation type name in MBean
     * <P>- the relation type name in MBean does not correspond to a relation
     * type created in the Relation Service
     * @exception InvalidRoleValueException  if:
     * <P>- the number of referenced MBeans in a role is less than
     * expected minimum degree
     * <P>- the number of referenced MBeans in a role exceeds expected
     * maximum degree
     * <P>- one referenced MBean in the value is not an Object of the MBean
     * class expected for that role
     * <P>- an MBean provided for a role does not exist
     * @exception RoleNotFoundException  if a value is provided for a role
     * that does not exist in the relation type
     */
public void addRelation(ObjectName theRelObjectName) throws IllegalArgumentException, RelationServiceNotRegisteredException, NoSuchMethodException, InvalidRelationIdException, InstanceNotFoundException, InvalidRelationServiceException, RelationTypeNotFoundException, RoleNotFoundException, InvalidRoleValueException {
    if (theRelObjectName == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) trace('addRelation: entering', theRelObjectName.toString());
    isActive();
    if ((!(myMBeanServer.isInstanceOf(theRelObjectName, 'javax.management.relation.Relation')))) {
        String excMsg = 'This MBean does not implement the Relation interface.';
        throw new NoSuchMethodException(excMsg);
    }
    String relId = null;
    try {
        relId = (String) (myMBeanServer.getAttribute(theRelObjectName, 'RelationId'));
    } catch (MBeanException exc1) {
        throw new RuntimeException((exc1.getTargetException()).getMessage());
    } catch (ReflectionException exc2) {
        throw new RuntimeException(exc2.getMessage());
    } catch (AttributeNotFoundException exc3) {
        throw new RuntimeException(exc3.getMessage());
    }
    if (relId == null) {
        String excMsg = 'This MBean does not provide a relation id.';
        throw new InvalidRelationIdException(excMsg);
    }
    ObjectName relServObjName = null;
    try {
        relServObjName = (ObjectName) (myMBeanServer.getAttribute(theRelObjectName, 'RelationServiceName'));
    } catch (MBeanException exc1) {
        throw new RuntimeException((exc1.getTargetException()).getMessage());
    } catch (ReflectionException exc2) {
        throw new RuntimeException(exc2.getMessage());
    } catch (AttributeNotFoundException exc3) {
        throw new RuntimeException(exc3.getMessage());
    }
    boolean badRelServFlg = false;
    if (relServObjName == null) {
        badRelServFlg = true;
    } else if (!(relServObjName.equals(myObjName))) {
        badRelServFlg = true;
    }
    if (badRelServFlg) {
        String excMsg = 'The Relation Service referenced in the MBean is not the current one.';
        throw new InvalidRelationServiceException(excMsg);
    }
    String relTypeName = null;
    try {
        relTypeName = (String) (myMBeanServer.getAttribute(theRelObjectName, 'RelationTypeName'));
    } catch (MBeanException exc1) {
        throw new RuntimeException((exc1.getTargetException()).getMessage());
    } catch (ReflectionException exc2) {
        throw new RuntimeException(exc2.getMessage());
    } catch (AttributeNotFoundException exc3) {
        throw new RuntimeException(exc3.getMessage());
    }
    if (relTypeName == null) {
        String excMsg = 'No relation type provided.';
        throw new RelationTypeNotFoundException(excMsg);
    }
    RoleList roleList = null;
    try {
        roleList = (RoleList) (myMBeanServer.invoke(theRelObjectName, 'retrieveAllRoles', null, null));
    } catch (MBeanException exc1) {
        throw new RuntimeException((exc1.getTargetException()).getMessage());
    } catch (ReflectionException exc2) {
        throw new RuntimeException(exc2.getMessage());
    }
    addRelationInt(false, null, theRelObjectName, relId, relTypeName, roleList);
    synchronized (myRelMBeanObjName2RelIdMap) {
        myRelMBeanObjName2RelIdMap.put(theRelObjectName, relId);
    }
    try {
        myMBeanServer.setAttribute(theRelObjectName, new Attribute('RelationServiceManagementFlag', new Boolean(true)));
    } catch (Exception exc) {
    }
    ArrayList newRefList = new ArrayList();
    newRefList.add(theRelObjectName);
    updateUnregistrationListener(newRefList, null);
    if (isTraceOn()) trace('addRelation: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.findAssociatedMBeans(ObjectName, String, String)

/**
     * Retrieves the MBeans associated to given one in a relation.
     * <P>This corresponds to CIM Associators and AssociatorNames operations.
     * @param theMBeanName  ObjectName of MBean
     * @param theRelTypeName  can be null; if specified, only the relations
     * of that type will be considered in the search. Else all
     * relation types are considered.
     * @param theRoleName  can be null; if specified, only the relations
     * where the MBean is referenced in that role will be considered. Else all
     * roles are considered.
     * @return an HashMap, where the keys are the ObjectNames of the MBeans
     * associated to given MBean, and the value is, for each key, an ArrayList
     * of the relation ids of the relations where the key MBean is
     * associated to given one (as they can be associated in several different
     * relations).
     * @exception IllegalArgumentException  if null parameter
     */
public Map findAssociatedMBeans(ObjectName theMBeanName, String theRelTypeName, String theRoleName) throws IllegalArgumentException {
    if (theMBeanName == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) {
        String str = new String('theMBeanName ' + theMBeanName.toString() + ', theRelTypeName ' + theRelTypeName + ', theRoleName ' + theRoleName);
        trace('findAssociatedMBeans: entering', str);
    }
    HashMap relId2RoleNamesMap = (HashMap) (findReferencingRelations(theMBeanName, theRelTypeName, theRoleName));
    HashMap result = new HashMap();
    for (Iterator relIdIter = (relId2RoleNamesMap.keySet()).iterator(); relIdIter.hasNext(); ) {
        String currRelId = (String) (relIdIter.next());
        HashMap objName2RoleNamesMap = null;
        try {
            objName2RoleNamesMap = (HashMap) (getReferencedMBeans(currRelId));
        } catch (RelationNotFoundException exc) {
            throw new RuntimeException(exc.getMessage());
        }
        for (Iterator objNameIter = (objName2RoleNamesMap.keySet()).iterator(); objNameIter.hasNext(); ) {
            ObjectName currObjName = (ObjectName) (objNameIter.next());
            if (!(currObjName.equals(theMBeanName))) {
                ArrayList currRelIdList = (ArrayList) (result.get(currObjName));
                if (currRelIdList == null) {
                    currRelIdList = new ArrayList();
                    currRelIdList.add(currRelId);
                    result.put(currObjName, currRelIdList);
                } else {
                    currRelIdList.add(currRelId);
                }
            }
        }
    }
    if (isTraceOn()) trace('findReferencingRelations: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.getAllRoles(String)

/**
     * Returns all roles present in the relation.
     * @param theRelId  relation id
     * @return a RoleResult object, including a RoleList (for roles
     * successfully retrieved) and a RoleUnresolvedList (for roles not
     * readable).
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationNotFoundException  if no relation for given id
     * @exception RelationServiceNotRegisteredException  if the Relation
     * Service is not registered in the MBean Server
     */
public RoleResult getAllRoles(String theRelId) throws IllegalArgumentException, RelationNotFoundException, RelationServiceNotRegisteredException {
    if (theRelId == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) trace('getAllRoles: entering', theRelId);
    Object relObj = getRelation(theRelId);
    RoleResult result = null;
    if (relObj instanceof RelationSupport) {
        result = ((RelationSupport) relObj).getAllRolesInt(true, this);
    } else {
        try {
            result = (RoleResult) (myMBeanServer.getAttribute(((ObjectName) relObj), 'AllRoles'));
        } catch (Exception exc) {
            throw new RuntimeException(exc.getMessage());
        }
    }
    if (isTraceOn()) trace('getAllRoles: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.getReferencedMBeans(String)

/**
     * Retrieves MBeans referenced in the various roles of the relation.
     * @param theRelId  relation id
     * @return a HashMap mapping:
     * <P> ObjectName -> ArrayList of String (role
     * names)
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationNotFoundException  if no relation for given
     * relation id
     */
public Map getReferencedMBeans(String theRelId) throws IllegalArgumentException, RelationNotFoundException {
    if (theRelId == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) trace('getReferencedMBeans: entering', theRelId);
    Object relObj = getRelation(theRelId);
    HashMap result = null;
    if (relObj instanceof RelationSupport) {
        result = (HashMap) (((RelationSupport) relObj).getReferencedMBeans());
    } else {
        try {
            result = (HashMap) (myMBeanServer.getAttribute(((ObjectName) relObj), 'ReferencedMBeans'));
        } catch (Exception exc) {
            throw new RuntimeException(exc.getMessage());
        }
    }
    if (isTraceOn()) trace('getReferencedMBeans: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.getRelationTypeName(String)

/**
     * Returns name of associated relation type for given relation.
     * @param theRelId  relation id
     * @return the name of the associated relation type.
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationNotFoundException  if no relation for given
     * relation id
     */
public String getRelationTypeName(String theRelId) throws IllegalArgumentException, RelationNotFoundException {
    if (theRelId == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) trace('getRelationTypeName: entering', theRelId);
    Object relObj = getRelation(theRelId);
    String result = null;
    if (relObj instanceof RelationSupport) {
        result = ((RelationSupport) relObj).getRelationTypeName();
    } else {
        try {
            result = (String) (myMBeanServer.getAttribute(((ObjectName) relObj), 'RelationTypeName'));
        } catch (Exception exc) {
            throw new RuntimeException(exc.getMessage());
        }
    }
    if (isTraceOn()) trace('getRelationTypeName: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.getRole(String, String)

/**
     * Retrieves role value for given role name in given relation.
     * @param theRelId  relation id
     * @param theRoleName  name of role
     * @return the ArrayList of ObjectName objects being the role value
     * @exception RelationServiceNotRegisteredException  if the Relation
     * Service is not registered
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationNotFoundException  if no relation with given id
     * @exception RoleNotFoundException  if:
     * <P>- there is no role with given name
     * <P>or
     * <P>- the role is not readable.
     * @see #setRole
     */
public List getRole(String theRelId, String theRoleName) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException, RoleNotFoundException {
    if (theRelId == null || theRoleName == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) {
        String str = 'theRelId ' + theRelId + ', theRoleName ' + theRoleName;
        trace('getRole: entering', str);
    }
    isActive();
    Object relObj = getRelation(theRelId);
    ArrayList result = null;
    if (relObj instanceof RelationSupport) {
        result = (ArrayList) (((RelationSupport) relObj).getRoleInt(theRoleName, true, this, false));
    } else {
        Object[] params = new Object[1];
        params[0] = theRoleName;
        String[] signature = new String[1];
        signature[0] = 'java.lang.String';
        try {
            List invokeResult = (List) (myMBeanServer.invoke(((ObjectName) relObj), 'getRole', params, signature));
            if (invokeResult == null || invokeResult instanceof ArrayList) result = (ArrayList) invokeResult; else result = new ArrayList(result);
        } catch (InstanceNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (ReflectionException exc2) {
            throw new RuntimeException(exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RoleNotFoundException) {
                throw ((RoleNotFoundException) wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }
    if (isTraceOn()) trace('getRole: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.getRoleCardinality(String, String)

/**
     * Retrieves the number of MBeans currently referenced in the given role.
     * @param theRelId  relation id
     * @param theRoleName  name of role
     * @return the number of currently referenced MBeans in that role
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationNotFoundException  if no relation with given id
     * @exception RoleNotFoundException  if there is no role with given name
     */
public Integer getRoleCardinality(String theRelId, String theRoleName) throws IllegalArgumentException, RelationNotFoundException, RoleNotFoundException {
    if (theRelId == null || theRoleName == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) {
        String str = 'theRelId ' + theRelId + ', theRoleName ' + theRoleName;
        trace('getRoleCardinality: entering', str);
    }
    Object relObj = getRelation(theRelId);
    Integer result = null;
    if (relObj instanceof RelationSupport) {
        result = (Integer) (((RelationSupport) relObj).getRoleCardinality(theRoleName));
    } else {
        Object[] params = new Object[1];
        params[0] = theRoleName;
        String[] signature = new String[1];
        signature[0] = 'java.lang.String';
        try {
            result = (Integer) (myMBeanServer.invoke(((ObjectName) relObj), 'getRoleCardinality', params, signature));
        } catch (InstanceNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (ReflectionException exc2) {
            throw new RuntimeException(exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RoleNotFoundException) {
                throw ((RoleNotFoundException) wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }
    if (isTraceOn()) trace('getRoleCardinality: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.getRoles(String, String[])

/**
     * Retrieves values of roles with given names in given relation.
     * @param theRelId  relation id
     * @param theRoleNameArray  array of names of roles to be retrieved
     * @return a RoleResult object, including a RoleList (for roles
     * successfully retrieved) and a RoleUnresolvedList (for roles not
     * retrieved).
     * @exception RelationServiceNotRegisteredException  if the Relation
     * Service is not registered in the MBean Server
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationNotFoundException  if no relation with given id
     * @see #setRoles
     */
public RoleResult getRoles(String theRelId, String[] theRoleNameArray) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException {
    if (theRelId == null || theRoleNameArray == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) trace('getRoles: entering', theRelId);
    isActive();
    Object relObj = getRelation(theRelId);
    RoleResult result = null;
    if (relObj instanceof RelationSupport) {
        result = ((RelationSupport) relObj).getRolesInt(theRoleNameArray, true, this);
    } else {
        Object[] params = new Object[1];
        params[0] = theRoleNameArray;
        String[] signature = new String[1];
        try {
            signature[0] = (theRoleNameArray.getClass()).getName();
        } catch (Exception exc) {
        }
        try {
            result = (RoleResult) (myMBeanServer.invoke(((ObjectName) relObj), 'getRoles', params, signature));
        } catch (InstanceNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (ReflectionException exc2) {
            throw new RuntimeException(exc2.getMessage());
        } catch (MBeanException exc3) {
            throw new RuntimeException((exc3.getTargetException()).getMessage());
        }
    }
    if (isTraceOn()) trace('getRoles: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.handleNotification(Notification, Object)

/**
     * Invoked when a JMX notification occurs.
     * Currently handles notifications for unregistration of MBeans, either
     * referenced in a relation role or being a relation itself.
     * @param theNtf  The notification.
     * @param theHandback  An opaque object which helps the listener to
     * associate information regarding the MBean emitter (can be null).
     */
public void handleNotification(Notification theNtf, Object theHandback) {
    if (theNtf == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) trace('handleNotification: entering', theNtf.toString());
    if (theNtf instanceof MBeanServerNotification) {
        String ntfType = theNtf.getType();
        if (ntfType.equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
            ObjectName mbeanName = ((MBeanServerNotification) theNtf).getMBeanName();
            boolean isRefedMBeanFlg = false;
            synchronized (myRefedMBeanObjName2RelIdsMap) {
                if (myRefedMBeanObjName2RelIdsMap.containsKey(mbeanName)) {
                    synchronized (myUnregNtfList) {
                        myUnregNtfList.add(theNtf);
                    }
                    isRefedMBeanFlg = true;
                }
                if (isRefedMBeanFlg && myPurgeFlg) {
                    try {
                        purgeRelations();
                    } catch (Exception exc) {
                        throw new RuntimeException(exc.getMessage());
                    }
                }
            }
            String relId = null;
            synchronized (myRelMBeanObjName2RelIdMap) {
                relId = (String) (myRelMBeanObjName2RelIdMap.get(mbeanName));
            }
            if (relId != null) {
                try {
                    removeRelation(relId);
                } catch (Exception exc) {
                    throw new RuntimeException(exc.getMessage());
                }
            }
        }
    }
    if (isTraceOn()) trace('handleNotification: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.handleReferenceUnregistration(String, ObjectName, List)

private void handleReferenceUnregistration(String theRelId, ObjectName theObjName, List theRoleNameList) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException, RoleNotFoundException {
    if (theRelId == null || theRoleNameList == null || theObjName == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isDebugOn()) {
        String str = new String('theRelId ' + theRelId + ', theRoleNameList ' + theRoleNameList.toString() + 'theObjName ' + theObjName.toString());
        debug('handleReferenceUnregistration: entering', str);
    }
    isActive();
    String currRelTypeName = getRelationTypeName(theRelId);
    Object relObj = getRelation(theRelId);
    boolean deleteRelFlg = false;
    for (Iterator roleNameIter = theRoleNameList.iterator(); roleNameIter.hasNext(); ) {
        if (deleteRelFlg) {
            break;
        }
        String currRoleName = (String) (roleNameIter.next());
        int currRoleRefNbr = (getRoleCardinality(theRelId, currRoleName)).intValue();
        int currRoleNewRefNbr = currRoleRefNbr - 1;
        RoleInfo currRoleInfo = null;
        try {
            currRoleInfo = getRoleInfo(currRelTypeName, currRoleName);
        } catch (RelationTypeNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (RoleInfoNotFoundException exc2) {
            throw new RuntimeException(exc2.getMessage());
        }
        boolean chkMinFlg = currRoleInfo.checkMinDegree(currRoleNewRefNbr);
        if (!chkMinFlg) {
            deleteRelFlg = true;
        }
    }
    if (deleteRelFlg) {
        removeRelation(theRelId);
    } else {
        for (Iterator roleNameIter = theRoleNameList.iterator(); roleNameIter.hasNext(); ) {
            String currRoleName = (String) (roleNameIter.next());
            if (relObj instanceof RelationSupport) {
                try {
                    ((RelationSupport) relObj).handleMBeanUnregistrationInt(theObjName, currRoleName, true, this);
                } catch (RelationTypeNotFoundException exc3) {
                    throw new RuntimeException(exc3.getMessage());
                } catch (InvalidRoleValueException exc4) {
                    throw new RuntimeException(exc4.getMessage());
                }
            } else {
                Object[] params = new Object[2];
                params[0] = theObjName;
                params[1] = currRoleName;
                String[] signature = new String[2];
                signature[0] = 'javax.management.ObjectName';
                signature[1] = 'java.lang.String';
                try {
                    myMBeanServer.invoke(((ObjectName) relObj), 'handleMBeanUnregistration', params, signature);
                } catch (InstanceNotFoundException exc1) {
                    throw new RuntimeException(exc1.getMessage());
                } catch (ReflectionException exc3) {
                    throw new RuntimeException(exc3.getMessage());
                } catch (MBeanException exc2) {
                    Exception wrappedExc = exc2.getTargetException();
                    throw new RuntimeException(wrappedExc.getMessage());
                }
            }
        }
    }
    if (isDebugOn()) debug('handleReferenceUnregistration: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.initialiseMissingRoles(boolean, RelationSupport, ObjectName, String, String, List)

private void initialiseMissingRoles(boolean theRelBaseFlg, RelationSupport theRelObj, ObjectName theRelObjName, String theRelId, String theRelTypeName, List theRoleInfoList) throws IllegalArgumentException, RelationServiceNotRegisteredException, InvalidRoleValueException {
    if ((theRelBaseFlg && (theRelObj == null || theRelObjName != null)) || (!theRelBaseFlg && (theRelObjName == null || theRelObj != null)) || theRelId == null || theRelTypeName == null || theRoleInfoList == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isDebugOn()) {
        StringBuffer strB = new StringBuffer('theRelBaseFlg ' + theRelBaseFlg + ', theRelId ' + theRelId + ', theRelTypeName ' + theRelTypeName + ', theRoleInfoList ' + theRoleInfoList);
        if (theRelObjName != null) {
            strB.append(theRelObjName.toString());
        }
        debug('initialiseMissingRoles: entering', strB.toString());
    }
    isActive();
    for (Iterator roleInfoIter = theRoleInfoList.iterator(); roleInfoIter.hasNext(); ) {
        RoleInfo currRoleInfo = (RoleInfo) (roleInfoIter.next());
        String roleName = currRoleInfo.getName();
        ArrayList emptyValue = new ArrayList();
        Role role = new Role(roleName, emptyValue);
        if (theRelBaseFlg) {
            try {
                theRelObj.setRoleInt(role, true, this, false);
            } catch (RoleNotFoundException exc1) {
                throw new RuntimeException(exc1.getMessage());
            } catch (RelationNotFoundException exc2) {
                throw new RuntimeException(exc2.getMessage());
            } catch (RelationTypeNotFoundException exc3) {
                throw new RuntimeException(exc3.getMessage());
            }
        } else {
            Object[] params = new Object[1];
            params[0] = role;
            String[] signature = new String[1];
            signature[0] = 'javax.management.relation.Role';
            try {
                myMBeanServer.setAttribute(theRelObjName, new Attribute('Role', role));
            } catch (InstanceNotFoundException exc1) {
                throw new RuntimeException(exc1.getMessage());
            } catch (ReflectionException exc3) {
                throw new RuntimeException(exc3.getMessage());
            } catch (MBeanException exc2) {
                Exception wrappedExc = exc2.getTargetException();
                if (wrappedExc instanceof InvalidRoleValueException) {
                    throw ((InvalidRoleValueException) wrappedExc);
                } else {
                    throw new RuntimeException(wrappedExc.getMessage());
                }
            } catch (AttributeNotFoundException exc4) {
                throw new RuntimeException(exc4.getMessage());
            } catch (InvalidAttributeValueException exc5) {
                throw new RuntimeException(exc5.getMessage());
            }
        }
    }
    if (isDebugOn()) debug('initializeMissingRoles: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.purgeRelations()

/**
     * Purges the relations.
     * <P>Depending on the purgeFlag value, this method is either called
     * automatically when a notification is received for the unregistration of
     * an MBean referenced in a relation (if the flag is set to true), or not
     * (if the flag is set to false).
     * <P>In that case it is up to the user to call it to maintain the
     * consistency of the relations. To be kept in mind that if an MBean is
     * unregistered and the purge not done immediately, if the ObjectName is
     * reused and assigned to another MBean referenced in a relation, calling
     * manually this purgeRelations() method will cause trouble, as will
     * consider the ObjectName as corresponding to the unregistered MBean, not
     * seeing the new one.
     * <P>The behavior depends on the cardinality of the role where the
     * unregistered MBean is referenced:
     * <P>- if removing one MBean reference in the role makes its number of
     * references less than the minimum degree, the relation has to be removed.
     * <P>- if the remaining number of references after removing the MBean
     * reference is still in the cardinality range, keep the relation and
     * update it calling its handleMBeanUnregistration() callback.
     * @exception RelationServiceNotRegisteredException  if the Relation
     * Service is not registered in the MBean Server.
     */
public void purgeRelations() throws RelationServiceNotRegisteredException {
    if (isTraceOn()) trace('purgeRelations: entering', null);
    isActive();
    ArrayList localUnregNtfList = null;
    synchronized (myUnregNtfList) {
        localUnregNtfList = (ArrayList) (myUnregNtfList.clone());
        myUnregNtfList = new ArrayList();
    }
    ArrayList obsRefList = new ArrayList();
    HashMap localMBean2RelIdMap = new HashMap();
    synchronized (myRefedMBeanObjName2RelIdsMap) {
        for (Iterator unregNtfIter = localUnregNtfList.iterator(); unregNtfIter.hasNext(); ) {
            MBeanServerNotification currNtf = (MBeanServerNotification) (unregNtfIter.next());
            ObjectName unregMBeanName = currNtf.getMBeanName();
            obsRefList.add(unregMBeanName);
            HashMap relIdMap = (HashMap) (myRefedMBeanObjName2RelIdsMap.get(unregMBeanName));
            localMBean2RelIdMap.put(unregMBeanName, relIdMap);
            myRefedMBeanObjName2RelIdsMap.remove(unregMBeanName);
        }
    }
    updateUnregistrationListener(null, obsRefList);
    for (Iterator unregNtfIter = localUnregNtfList.iterator(); unregNtfIter.hasNext(); ) {
        MBeanServerNotification currNtf = (MBeanServerNotification) (unregNtfIter.next());
        ObjectName unregMBeanName = currNtf.getMBeanName();
        HashMap localRelIdMap = (HashMap) (localMBean2RelIdMap.get(unregMBeanName));
        Set localRelIdSet = localRelIdMap.keySet();
        for (Iterator relIdIter = localRelIdSet.iterator(); relIdIter.hasNext(); ) {
            String currRelId = (String) (relIdIter.next());
            ArrayList localRoleNameList = (ArrayList) (localRelIdMap.get(currRelId));
            try {
                handleReferenceUnregistration(currRelId, unregMBeanName, localRoleNameList);
            } catch (RelationNotFoundException exc1) {
                throw new RuntimeException(exc1.getMessage());
            } catch (RoleNotFoundException exc2) {
                throw new RuntimeException(exc2.getMessage());
            }
        }
    }
    if (isTraceOn()) trace('purgeRelations: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.removeRelationType(String)

/**
     * Removes given relation type from Relation Service.
     * <P>The relation objects of that type will be removed from the
     * Relation Service.
     * @param theRelTypeName  name of the relation type to be removed
     * @exception RelationServiceNotRegisteredException  if the Relation
     * Service is not registered in the MBean Server
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationTypeNotFoundException  If there is no relation type
     * with that name
     */
public void removeRelationType(String theRelTypeName) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationTypeNotFoundException {
    isActive();
    if (theRelTypeName == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) trace('removeRelationType: entering', theRelTypeName);
    RelationType relType = getRelationType(theRelTypeName);
    ArrayList relIdList = null;
    synchronized (myRelType2RelIdsMap) {
        ArrayList relIdList1 = (ArrayList) (myRelType2RelIdsMap.get(theRelTypeName));
        if (relIdList1 != null) {
            relIdList = (ArrayList) (relIdList1.clone());
        }
    }
    synchronized (myRelType2ObjMap) {
        myRelType2ObjMap.remove(theRelTypeName);
    }
    synchronized (myRelType2RelIdsMap) {
        myRelType2RelIdsMap.remove(theRelTypeName);
    }
    if (relIdList != null) {
        for (Iterator relIdIter = relIdList.iterator(); relIdIter.hasNext(); ) {
            String currRelId = (String) (relIdIter.next());
            try {
                removeRelation(currRelId);
            } catch (RelationNotFoundException exc1) {
                throw new RuntimeException(exc1.getMessage());
            }
        }
    }
    if (isTraceOn()) trace('removeRelationType: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.setRole(String, Role)

/**
     * Sets the given role in given relation.
     * <P>Will check the role according to its corresponding role definition
     * provided in relation's relation type
     * <P>The Relation Service will keep track of the change to keep the
     * consistency of relations by handling referenced MBean unregistrations.
     * @param theRelId  relation id
     * @param theRole  role to be set (name and new value)
     * @exception RelationServiceNotRegisteredException  if the Relation
     * Service is not registered in the MBean Server
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationNotFoundException  if no relation with given id
     * @exception RoleNotFoundException  if the role does not exist or is not
     * writable
     * @exception InvalidRoleValueException  if value provided for role is not
     * valid:
     * <P>- the number of referenced MBeans in given value is less than
     * expected minimum degree
     * <P>or
     * <P>- the number of referenced MBeans in provided value exceeds expected
     * maximum degree
     * <P>or
     * <P>- one referenced MBean in the value is not an Object of the MBean
     * class expected for that role
     * <P>or
     * <P>- an MBean provided for that role does not exist
     * @see #getRole
     */
public void setRole(String theRelId, Role theRole) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException, RoleNotFoundException, InvalidRoleValueException {
    if (theRelId == null || theRole == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) {
        String str = new String('theRelId ' + theRelId + ', theRole ' + theRole.toString());
        trace('setRole: entering', str);
    }
    isActive();
    Object relObj = getRelation(theRelId);
    if (relObj instanceof RelationSupport) {
        try {
            ((RelationSupport) relObj).setRoleInt(theRole, true, this, false);
        } catch (RelationTypeNotFoundException exc) {
            throw new RuntimeException(exc.getMessage());
        }
    } else {
        Object[] params = new Object[1];
        params[0] = theRole;
        String[] signature = new String[1];
        signature[0] = 'javax.management.relation.Role';
        try {
            myMBeanServer.setAttribute(((ObjectName) relObj), new Attribute('Role', theRole));
        } catch (InstanceNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (ReflectionException exc3) {
            throw new RuntimeException(exc3.getMessage());
        } catch (MBeanException exc2) {
            Exception wrappedExc = exc2.getTargetException();
            if (wrappedExc instanceof RoleNotFoundException) {
                throw ((RoleNotFoundException) wrappedExc);
            } else if (wrappedExc instanceof InvalidRoleValueException) {
                throw ((InvalidRoleValueException) wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        } catch (AttributeNotFoundException exc4) {
            throw new RuntimeException(exc4.getMessage());
        } catch (InvalidAttributeValueException exc5) {
            throw new RuntimeException(exc5.getMessage());
        }
    }
    if (isTraceOn()) trace('setRole: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationService.setRoles(String, RoleList)

/**
     * Sets the given roles in given relation.
     * <P>Will check the role according to its corresponding role definition
     * provided in relation's relation type
     * <P>The Relation Service keeps track of the changes to keep the
     * consistency of relations by handling referenced MBean unregistrations.
     * @param theRelId  relation id
     * @param theRoleList  list of roles to be set
     * @return a RoleResult object, including a RoleList (for roles
     * successfully set) and a RoleUnresolvedList (for roles not
     * set).
     * @exception RelationServiceNotRegisteredException  if the Relation
     * Service is not registered in the MBean Server
     * @exception IllegalArgumentException  if null parameter
     * @exception RelationNotFoundException  if no relation with given id
     * @see #getRoles
     */
public RoleResult setRoles(String theRelId, RoleList theRoleList) throws RelationServiceNotRegisteredException, IllegalArgumentException, RelationNotFoundException {
    if (theRelId == null || theRoleList == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isTraceOn()) {
        String str = new String('theRelId ' + theRelId + ', theRoleList ' + theRoleList.toString());
        trace('setRoles: entering', str);
    }
    isActive();
    Object relObj = getRelation(theRelId);
    RoleResult result = null;
    if (relObj instanceof RelationSupport) {
        try {
            result = ((RelationSupport) relObj).setRolesInt(theRoleList, true, this);
        } catch (RelationTypeNotFoundException exc) {
            throw new RuntimeException(exc.getMessage());
        }
    } else {
        Object[] params = new Object[1];
        params[0] = theRoleList;
        String[] signature = new String[1];
        signature[0] = 'javax.management.relation.RoleList';
        try {
            result = (RoleResult) (myMBeanServer.invoke(((ObjectName) relObj), 'setRoles', params, signature));
        } catch (InstanceNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (ReflectionException exc3) {
            throw new RuntimeException(exc3.getMessage());
        } catch (MBeanException exc2) {
            throw new RuntimeException((exc2.getTargetException()).getMessage());
        }
    }
    if (isTraceOn()) trace('setRoles: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationSupport.getRoleInt(String, boolean, RelationService, boolean)

Object getRoleInt(String theRoleName, boolean theRelServCallFlg, RelationService theRelServ, boolean theMultiRoleFlg) throws IllegalArgumentException, RoleNotFoundException, RelationServiceNotRegisteredException {
    if (theRoleName == null || (theRelServCallFlg && theRelServ == null)) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isDebugOn()) {
        String str = 'theRoleName ' + theRoleName;
        debug('getRoleInt: entering', str);
    }
    int pbType = 0;
    Role role = null;
    synchronized (myRoleName2ValueMap) {
        role = (Role) (myRoleName2ValueMap.get(theRoleName));
    }
    if (role == null) {
        pbType = RoleStatus.NO_ROLE_WITH_NAME;
    } else {
        Integer status = null;
        if (theRelServCallFlg) {
            try {
                status = theRelServ.checkRoleReading(theRoleName, myRelTypeName);
            } catch (RelationTypeNotFoundException exc) {
                throw new RuntimeException(exc.getMessage());
            }
        } else {
            Object[] params = new Object[2];
            params[0] = theRoleName;
            params[1] = myRelTypeName;
            String[] signature = new String[2];
            signature[0] = 'java.lang.String';
            signature[1] = 'java.lang.String';
            try {
                status = (Integer) (myRelServiceMBeanServer.invoke(myRelServiceName, 'checkRoleReading', params, signature));
            } catch (MBeanException exc1) {
                throw new RuntimeException('incorrect relation type');
            } catch (ReflectionException exc2) {
                throw new RuntimeException(exc2.getMessage());
            } catch (InstanceNotFoundException exc3) {
                throw new RelationServiceNotRegisteredException(exc3.getMessage());
            }
        }
        pbType = status.intValue();
    }
    Object result = null;
    if (pbType == 0) {
        if (!(theMultiRoleFlg)) {
            result = (ArrayList) (((ArrayList) (role.getRoleValue())).clone());
        } else {
            result = (Role) (role.clone());
        }
    } else {
        if (!(theMultiRoleFlg)) {
            try {
                RelationService.throwRoleProblemException(pbType, theRoleName);
                return null;
            } catch (InvalidRoleValueException exc) {
                throw new RuntimeException(exc.getMessage());
            }
        } else {
            result = new RoleUnresolved(theRoleName, null, pbType);
        }
    }
    if (isDebugOn()) debug('getRoleInt: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationSupport.getRolesInt(String[], boolean, RelationService)

RoleResult getRolesInt(String[] theRoleNameArray, boolean theRelServCallFlg, RelationService theRelServ) throws IllegalArgumentException, RelationServiceNotRegisteredException {
    if (theRoleNameArray == null || (theRelServCallFlg && theRelServ == null)) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isDebugOn()) debug('getRolesInt: entering', null);
    RoleList roleList = new RoleList();
    RoleUnresolvedList roleUnresList = new RoleUnresolvedList();
    for (int i = 0; i < theRoleNameArray.length; i++) {
        String currRoleName = theRoleNameArray[i];
        Object currResult = null;
        try {
            currResult = getRoleInt(currRoleName, theRelServCallFlg, theRelServ, true);
        } catch (RoleNotFoundException exc) {
            return null;
        }
        if (currResult instanceof Role) {
            try {
                roleList.add((Role) currResult);
            } catch (IllegalArgumentException exc) {
                throw new RuntimeException(exc.getMessage());
            }
        } else if (currResult instanceof RoleUnresolved) {
            try {
                roleUnresList.add((RoleUnresolved) currResult);
            } catch (IllegalArgumentException exc) {
                throw new RuntimeException(exc.getMessage());
            }
        }
    }
    RoleResult result = new RoleResult(roleList, roleUnresList);
    if (isDebugOn()) debug('getRolesInt: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationSupport.sendRoleUpdateNotification(Role, List, boolean, RelationService)

private void sendRoleUpdateNotification(Role theNewRole, List theOldRoleValue, boolean theRelServCallFlg, RelationService theRelServ) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException {
    if (theNewRole == null || theOldRoleValue == null || (theRelServCallFlg && theRelServ == null)) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isDebugOn()) {
        String str = 'theNewRole ' + theNewRole + ', theOldRoleValue ' + theOldRoleValue + ', theRelServCallFlg ' + theRelServCallFlg;
        debug('sendRoleUpdateNotification: entering', str);
    }
    if (theRelServCallFlg) {
        try {
            theRelServ.sendRoleUpdateNotification(myRelId, theNewRole, theOldRoleValue);
        } catch (RelationNotFoundException exc) {
            throw new RuntimeException(exc.getMessage());
        }
    } else {
        Object[] params = new Object[3];
        params[0] = myRelId;
        params[1] = theNewRole;
        params[2] = ((ArrayList) theOldRoleValue);
        String[] signature = new String[3];
        signature[0] = 'java.lang.String';
        signature[1] = 'javax.management.relation.Role';
        signature[2] = 'java.util.List';
        try {
            myRelServiceMBeanServer.invoke(myRelServiceName, 'sendRoleUpdateNotification', params, signature);
        } catch (ReflectionException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (InstanceNotFoundException exc2) {
            throw new RelationServiceNotRegisteredException(exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RelationNotFoundException) {
                throw ((RelationNotFoundException) wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }
    if (isDebugOn()) debug('sendRoleUpdateNotification: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationSupport.setRoleInt(Role, boolean, RelationService, boolean)

Object setRoleInt(Role theRole, boolean theRelServCallFlg, RelationService theRelServ, boolean theMultiRoleFlg) throws IllegalArgumentException, RoleNotFoundException, InvalidRoleValueException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException {
    if (theRole == null || (theRelServCallFlg && theRelServ == null)) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isDebugOn()) {
        String str = 'theRole ' + theRole + ', theRelServCallFlg ' + theRelServCallFlg + ', theMultiRoleFlg ' + theMultiRoleFlg;
        debug('setRoleInt: entering', str);
    }
    String roleName = theRole.getRoleName();
    int pbType = 0;
    Role role = null;
    synchronized (myRoleName2ValueMap) {
        role = (Role) (myRoleName2ValueMap.get(roleName));
    }
    ArrayList oldRoleValue = null;
    Boolean initFlg = null;
    if (role == null) {
        initFlg = new Boolean(true);
        oldRoleValue = new ArrayList();
    } else {
        initFlg = new Boolean(false);
        oldRoleValue = (ArrayList) (role.getRoleValue());
    }
    try {
        Integer status = null;
        if (theRelServCallFlg) {
            status = theRelServ.checkRoleWriting(theRole, myRelTypeName, initFlg);
        } else {
            Object[] params = new Object[3];
            params[0] = theRole;
            params[1] = myRelTypeName;
            params[2] = initFlg;
            String[] signature = new String[3];
            signature[0] = 'javax.management.relation.Role';
            signature[1] = 'java.lang.String';
            signature[2] = 'java.lang.Boolean';
            status = (Integer) (myRelServiceMBeanServer.invoke(myRelServiceName, 'checkRoleWriting', params, signature));
        }
        pbType = status.intValue();
    } catch (MBeanException exc2) {
        Exception wrappedExc = exc2.getTargetException();
        if (wrappedExc instanceof RelationTypeNotFoundException) {
            throw ((RelationTypeNotFoundException) wrappedExc);
        } else {
            throw new RuntimeException(wrappedExc.getMessage());
        }
    } catch (ReflectionException exc3) {
        throw new RuntimeException(exc3.getMessage());
    } catch (RelationTypeNotFoundException exc4) {
        throw new RuntimeException(exc4.getMessage());
    } catch (InstanceNotFoundException exc5) {
        throw new RelationServiceNotRegisteredException(exc5.getMessage());
    }
    Object result = null;
    if (pbType == 0) {
        if (!(initFlg.booleanValue())) {
            sendRoleUpdateNotification(theRole, oldRoleValue, theRelServCallFlg, theRelServ);
            updateRelationServiceMap(theRole, oldRoleValue, theRelServCallFlg, theRelServ);
        }
        synchronized (myRoleName2ValueMap) {
            myRoleName2ValueMap.put(roleName, (Role) (theRole.clone()));
        }
        if (theMultiRoleFlg) {
            result = theRole;
        }
    } else {
        if (!(theMultiRoleFlg)) {
            RelationService.throwRoleProblemException(pbType, roleName);
            return null;
        } else {
            result = new RoleUnresolved(roleName, theRole.getRoleValue(), pbType);
        }
    }
    if (isDebugOn()) debug('setRoleInt: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationSupport.setRolesInt(RoleList, boolean, RelationService)

RoleResult setRolesInt(RoleList theRoleList, boolean theRelServCallFlg, RelationService theRelServ) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationTypeNotFoundException, RelationNotFoundException {
    if (theRoleList == null || (theRelServCallFlg && theRelServ == null)) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isDebugOn()) {
        String str = 'theRoleList ' + theRoleList + ', theRelServCallFlg ' + theRelServCallFlg;
        debug('setRolesInt: entering', str);
    }
    RoleList roleList = new RoleList();
    RoleUnresolvedList roleUnresList = new RoleUnresolvedList();
    for (Iterator roleIter = theRoleList.iterator(); roleIter.hasNext(); ) {
        Role currRole = (Role) (roleIter.next());
        Object currResult = null;
        try {
            currResult = setRoleInt(currRole, theRelServCallFlg, theRelServ, true);
        } catch (RoleNotFoundException exc1) {
        } catch (InvalidRoleValueException exc2) {
        }
        if (currResult instanceof Role) {
            try {
                roleList.add((Role) currResult);
            } catch (IllegalArgumentException exc) {
                throw new RuntimeException(exc.getMessage());
            }
        } else if (currResult instanceof RoleUnresolved) {
            try {
                roleUnresList.add((RoleUnresolved) currResult);
            } catch (IllegalArgumentException exc) {
                throw new RuntimeException(exc.getMessage());
            }
        }
    }
    RoleResult result = new RoleResult(roleList, roleUnresList);
    if (isDebugOn()) debug('setRolesInt: exiting', null);
    return result;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationSupport.updateRelationServiceMap(Role, List, boolean, RelationService)

private void updateRelationServiceMap(Role theNewRole, List theOldRoleValue, boolean theRelServCallFlg, RelationService theRelServ) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException {
    if (theNewRole == null || theOldRoleValue == null || (theRelServCallFlg && theRelServ == null)) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isDebugOn()) {
        String str = 'theNewRole ' + theNewRole + ', theOldRoleValue ' + theOldRoleValue + ', theRelServCallFlg ' + theRelServCallFlg;
        debug('updateRelationServiceMap: entering', str);
    }
    if (theRelServCallFlg) {
        try {
            theRelServ.updateRoleMap(myRelId, theNewRole, theOldRoleValue);
        } catch (RelationNotFoundException exc) {
            throw new RuntimeException(exc.getMessage());
        }
    } else {
        Object[] params = new Object[3];
        params[0] = myRelId;
        params[1] = theNewRole;
        params[2] = theOldRoleValue;
        String[] signature = new String[3];
        signature[0] = 'java.lang.String';
        signature[1] = 'javax.management.relation.Role';
        signature[2] = 'java.util.List';
        try {
            myRelServiceMBeanServer.invoke(myRelServiceName, 'updateRoleMap', params, signature);
        } catch (ReflectionException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (InstanceNotFoundException exc2) {
            throw new RelationServiceNotRegisteredException(exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RelationNotFoundException) {
                throw ((RelationNotFoundException) wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }
    if (isDebugOn()) debug('updateRelationServiceMap: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.management.relation.RelationTypeSupport.addRoleInfo(RoleInfo)

/**
     * Add a role info.
     * This method of course should not be used after the creation of the
     * relation type, because updating it would invalidate that the relations
     * created associated to that type still conform to it.
     * Can throw a RuntimeException if trying to update a relation type
     * declared in the Relation Service.
     * @param theRoleInfo  role info to be added.
     * @exception IllegalArgumentException  if null parameter.
     * @exception InvalidRelationTypeException  if there is already a role
     *  info in current relation type with the same name.
     */
protected void addRoleInfo(RoleInfo theRoleInfo) throws IllegalArgumentException, InvalidRelationTypeException {
    if (theRoleInfo == null) {
        String excMsg = 'Invalid parameter.';
        throw new IllegalArgumentException(excMsg);
    }
    if (isDebugOn()) debug('addRoleInfo: entering', theRoleInfo.toString());
    if (isInRelationService) {
        String excMsg = 'Relation type cannot be updated as it is declared in the Relation Service.';
        throw new RuntimeException(excMsg);
    }
    String roleName = theRoleInfo.getName();
    if (roleName2InfoMap.containsKey(roleName)) {
        StringBuffer excMsgStrB = new StringBuffer();
        String excMsg = 'Two role infos provided for role ';
        excMsgStrB.append(excMsg);
        excMsgStrB.append(roleName);
        throw new InvalidRelationTypeException(excMsgStrB.toString());
    }
    roleName2InfoMap.put(roleName, new RoleInfo(theRoleInfo));
    if (isDebugOn()) debug('addRoleInfo: exiting', null);
    return;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.bmp.BMPImageReader.read(int, ImageReadParam)

public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException {
    if (iis == null) {
        throw new IllegalStateException(I18N.getString('BMPImageReader5'));
    }
    checkIndex(imageIndex);
    clearAbortRequest();
    processImageStarted(imageIndex);
    if (param == null) param = getDefaultReadParam();
    readHeader();
    sourceRegion = new Rectangle(0, 0, 0, 0);
    destinationRegion = new Rectangle(0, 0, 0, 0);
    computeRegions(param, this.width, this.height, param.getDestination(), sourceRegion, destinationRegion);
    scaleX = param.getSourceXSubsampling();
    scaleY = param.getSourceYSubsampling();
    sourceBands = param.getSourceBands();
    destBands = param.getDestinationBands();
    seleBand = (sourceBands != null) && (destBands != null);
    noTransform = destinationRegion.equals(new Rectangle(0, 0, width, height)) || seleBand;
    if (!seleBand) {
        sourceBands = new int[numBands];
        destBands = new int[numBands];
        for (int i = 0; i < numBands; i++) destBands[i] = sourceBands[i] = i;
    }
    bi = param.getDestination();
    WritableRaster raster = null;
    if (bi == null) {
        sampleModel = sampleModel.createCompatibleSampleModel(destinationRegion.x + destinationRegion.width, destinationRegion.y + destinationRegion.height);
        if (seleBand) sampleModel = sampleModel.createSubsetSampleModel(sourceBands);
        raster = Raster.createWritableRaster(sampleModel, new Point());
        bi = new BufferedImage(colorModel, raster, false, null);
    } else {
        raster = bi.getWritableTile(0, 0);
        sampleModel = bi.getSampleModel();
        colorModel = bi.getColorModel();
        noTransform &= destinationRegion.equals(raster.getBounds());
    }
    byte bdata[] = null;
    short sdata[] = null;
    int idata[] = null;
    if (sampleModel.getDataType() == DataBuffer.TYPE_BYTE) bdata = (byte[]) ((DataBufferByte) raster.getDataBuffer()).getData(); else if (sampleModel.getDataType() == DataBuffer.TYPE_USHORT) sdata = (short[]) ((DataBufferUShort) raster.getDataBuffer()).getData(); else if (sampleModel.getDataType() == DataBuffer.TYPE_INT) idata = (int[]) ((DataBufferInt) raster.getDataBuffer()).getData();
    switch(imageType) {
        case VERSION_2_1_BIT:
            read1Bit(bdata);
            break;
        case VERSION_2_4_BIT:
            read4Bit(bdata);
            break;
        case VERSION_2_8_BIT:
            read8Bit(bdata);
            break;
        case VERSION_2_24_BIT:
            read24Bit(bdata);
            break;
        case VERSION_3_1_BIT:
            read1Bit(bdata);
            break;
        case VERSION_3_4_BIT:
            switch((int) compression) {
                case BI_RGB:
                    read4Bit(bdata);
                    break;
                case BI_RLE4:
                    readRLE4(bdata);
                    break;
                case BI_JPEG:
                    readEmbedded('JPEG', bi, param);
                    break;
                case BI_PNG:
                    readEmbedded('PNG', bi, param);
                    break;
                default:
                    throw new RuntimeException(I18N.getString('BMPImageReader1'));
            }
            break;
        case VERSION_3_8_BIT:
            switch((int) compression) {
                case BI_RGB:
                    read8Bit(bdata);
                    break;
                case BI_RLE8:
                    readRLE8(bdata);
                    break;
                case BI_JPEG:
                    readEmbedded('JPEG', bi, param);
                    break;
                case BI_PNG:
                    readEmbedded('PNG', bi, param);
                    break;
                default:
                    throw new RuntimeException(I18N.getString('BMPImageReader1'));
            }
            break;
        case VERSION_3_24_BIT:
            read24Bit(bdata);
            break;
        case VERSION_3_NT_16_BIT:
            read16Bit(sdata);
            break;
        case VERSION_3_NT_32_BIT:
            switch((int) compression) {
                case BI_JPEG:
                    iis.seek(54);
                    readEmbedded('JPEG', bi, param);
                    break;
                case BI_PNG:
                    readEmbedded('PNG', bi, param);
                    break;
                default:
                    read32Bit(idata);
            }
            break;
        case VERSION_4_1_BIT:
            read1Bit(bdata);
            break;
        case VERSION_4_4_BIT:
            switch((int) compression) {
                case BI_RGB:
                    read4Bit(bdata);
                    break;
                case BI_RLE4:
                    readRLE4(bdata);
                    break;
                case BI_JPEG:
                    readEmbedded('JPEG', bi, param);
                    break;
                case BI_PNG:
                    readEmbedded('PNG', bi, param);
                    break;
                default:
                    throw new RuntimeException(I18N.getString('BMPImageReader1'));
            }
        case VERSION_4_8_BIT:
            switch((int) compression) {
                case BI_RGB:
                    read8Bit(bdata);
                    break;
                case BI_RLE8:
                    readRLE8(bdata);
                    break;
                case BI_JPEG:
                    readEmbedded('JPEG', bi, param);
                    break;
                case BI_PNG:
                    readEmbedded('PNG', bi, param);
                    break;
                default:
                    throw new RuntimeException(I18N.getString('BMPImageReader1'));
            }
            break;
        case VERSION_4_16_BIT:
            read16Bit(sdata);
            break;
        case VERSION_4_24_BIT:
            read24Bit(bdata);
            break;
        case VERSION_4_32_BIT:
            read32Bit(idata);
            break;
    }
    if (abortRequested()) processReadAborted(); else processImageComplete();
    return bi;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.bmp.BMPImageReader.readHeader()

public void readHeader() throws IOException {
    if (gotHeader) return;
    if (iis == null) {
        throw new IllegalStateException('Input source not set!');
    }
    int profileData = 0, profileSize = 0;
    this.metadata = new BMPMetadata();
    iis.mark();
    byte[] marker = new byte[2];
    iis.read(marker);
    if (marker[0] != 0x42 || marker[1] != 0x4d) throw new IllegalArgumentException(I18N.getString('BMPImageReader1'));
    bitmapFileSize = iis.readUnsignedInt();
    iis.skipBytes(4);
    bitmapOffset = iis.readUnsignedInt();
    long size = iis.readUnsignedInt();
    if (size == 12) {
        width = iis.readShort();
        height = iis.readShort();
    } else {
        width = iis.readInt();
        height = iis.readInt();
    }
    metadata.width = width;
    metadata.height = height;
    int planes = iis.readUnsignedShort();
    bitsPerPixel = iis.readUnsignedShort();
    metadata.bitsPerPixel = (short) bitsPerPixel;
    numBands = 3;
    if (size == 12) {
        metadata.bmpVersion = VERSION_2;
        if (bitsPerPixel == 1) {
            imageType = VERSION_2_1_BIT;
        } else if (bitsPerPixel == 4) {
            imageType = VERSION_2_4_BIT;
        } else if (bitsPerPixel == 8) {
            imageType = VERSION_2_8_BIT;
        } else if (bitsPerPixel == 24) {
            imageType = VERSION_2_24_BIT;
        }
        int numberOfEntries = (int) ((bitmapOffset - 14 - size) / 3);
        int sizeOfPalette = numberOfEntries * 3;
        palette = new byte[sizeOfPalette];
        iis.readFully(palette, 0, sizeOfPalette);
        metadata.palette = palette;
        metadata.paletteSize = numberOfEntries;
    } else {
        compression = iis.readUnsignedInt();
        imageSize = iis.readUnsignedInt();
        long xPelsPerMeter = iis.readInt();
        long yPelsPerMeter = iis.readInt();
        long colorsUsed = iis.readUnsignedInt();
        long colorsImportant = iis.readUnsignedInt();
        metadata.compression = (int) compression;
        metadata.xPixelsPerMeter = (int) xPelsPerMeter;
        metadata.yPixelsPerMeter = (int) yPelsPerMeter;
        metadata.colorsUsed = (int) colorsUsed;
        metadata.colorsImportant = (int) colorsImportant;
        if (size == 40) {
            switch((int) compression) {
                case BI_RGB:
                case BI_RLE8:
                case BI_RLE4:
                case BI_PNG:
                case BI_JPEG:
                    int numberOfEntries = (int) ((bitmapOffset - 14 - size) / 4);
                    int sizeOfPalette = numberOfEntries * 4;
                    palette = new byte[sizeOfPalette];
                    iis.readFully(palette, 0, sizeOfPalette);
                    metadata.palette = palette;
                    metadata.paletteSize = numberOfEntries;
                    if (bitsPerPixel == 1) {
                        imageType = VERSION_3_1_BIT;
                    } else if (bitsPerPixel == 4) {
                        imageType = VERSION_3_4_BIT;
                    } else if (bitsPerPixel == 8) {
                        imageType = VERSION_3_8_BIT;
                    } else if (bitsPerPixel == 24) {
                        imageType = VERSION_3_24_BIT;
                    } else if (bitsPerPixel == 16) {
                        imageType = VERSION_3_NT_16_BIT;
                        redMask = 0x7C00;
                        greenMask = 0x3E0;
                        blueMask = (1 << 5) - 1;
                        metadata.redMask = redMask;
                        metadata.greenMask = greenMask;
                        metadata.blueMask = blueMask;
                    } else if (bitsPerPixel == 32) {
                        imageType = VERSION_3_NT_32_BIT;
                        redMask = 0x00FF0000;
                        greenMask = 0x0000FF00;
                        blueMask = 0x000000FF;
                        metadata.redMask = redMask;
                        metadata.greenMask = greenMask;
                        metadata.blueMask = blueMask;
                    }
                    metadata.bmpVersion = VERSION_3;
                    break;
                case BI_BITFIELDS:
                    if (bitsPerPixel == 16) {
                        imageType = VERSION_3_NT_16_BIT;
                    } else if (bitsPerPixel == 32) {
                        imageType = VERSION_3_NT_32_BIT;
                    }
                    redMask = (int) iis.readUnsignedInt();
                    greenMask = (int) iis.readUnsignedInt();
                    blueMask = (int) iis.readUnsignedInt();
                    metadata.redMask = redMask;
                    metadata.greenMask = greenMask;
                    metadata.blueMask = blueMask;
                    if (colorsUsed != 0) {
                        sizeOfPalette = (int) colorsUsed * 4;
                        palette = new byte[sizeOfPalette];
                        iis.readFully(palette, 0, sizeOfPalette);
                        metadata.palette = palette;
                        metadata.paletteSize = (int) colorsUsed;
                    }
                    metadata.bmpVersion = VERSION_3_NT;
                    break;
                default:
                    throw new RuntimeException(I18N.getString('BMPImageReader2'));
            }
        } else if (size == 108 || size == 124) {
            if (size == 108) metadata.bmpVersion = VERSION_4; else if (size == 124) metadata.bmpVersion = VERSION_5;
            redMask = (int) iis.readUnsignedInt();
            greenMask = (int) iis.readUnsignedInt();
            blueMask = (int) iis.readUnsignedInt();
            alphaMask = (int) iis.readUnsignedInt();
            long csType = iis.readUnsignedInt();
            int redX = iis.readInt();
            int redY = iis.readInt();
            int redZ = iis.readInt();
            int greenX = iis.readInt();
            int greenY = iis.readInt();
            int greenZ = iis.readInt();
            int blueX = iis.readInt();
            int blueY = iis.readInt();
            int blueZ = iis.readInt();
            long gammaRed = iis.readUnsignedInt();
            long gammaGreen = iis.readUnsignedInt();
            long gammaBlue = iis.readUnsignedInt();
            if (size == 124) {
                metadata.intent = iis.readInt();
                profileData = iis.readInt();
                profileSize = iis.readInt();
                iis.skipBytes(4);
            }
            metadata.colorSpace = (int) csType;
            if (csType == LCS_CALIBRATED_RGB) {
                metadata.redX = redX;
                metadata.redY = redY;
                metadata.redZ = redZ;
                metadata.greenX = greenX;
                metadata.greenY = greenY;
                metadata.greenZ = greenZ;
                metadata.blueX = blueX;
                metadata.blueY = blueY;
                metadata.blueZ = blueZ;
                metadata.gammaRed = (int) gammaRed;
                metadata.gammaGreen = (int) gammaGreen;
                metadata.gammaBlue = (int) gammaBlue;
            }
            int numberOfEntries = (int) ((bitmapOffset - 14 - size) / 4);
            int sizeOfPalette = numberOfEntries * 4;
            palette = new byte[sizeOfPalette];
            iis.readFully(palette, 0, sizeOfPalette);
            metadata.palette = palette;
            metadata.paletteSize = numberOfEntries;
            if (bitsPerPixel == 1) {
                imageType = VERSION_4_1_BIT;
            } else if (bitsPerPixel == 4) {
                imageType = VERSION_4_4_BIT;
            } else if (bitsPerPixel == 8) {
                imageType = VERSION_4_8_BIT;
            } else if (bitsPerPixel == 16) {
                imageType = VERSION_4_16_BIT;
                if ((int) compression == BI_RGB) {
                    redMask = 0x7C00;
                    greenMask = 0x3E0;
                    blueMask = 0x1F;
                }
            } else if (bitsPerPixel == 24) {
                imageType = VERSION_4_24_BIT;
            } else if (bitsPerPixel == 32) {
                imageType = VERSION_4_32_BIT;
                if ((int) compression == BI_RGB) {
                    redMask = 0x00FF0000;
                    greenMask = 0x0000FF00;
                    blueMask = 0x000000FF;
                }
            }
            metadata.redMask = redMask;
            metadata.greenMask = greenMask;
            metadata.blueMask = blueMask;
            metadata.alphaMask = alphaMask;
        } else {
            throw new RuntimeException(I18N.getString('BMPImageReader3'));
        }
    }
    if (height > 0) {
        isBottomUp = true;
    } else {
        isBottomUp = false;
        height = Math.abs(height);
    }
    ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    if (metadata.colorSpace == PROFILE_LINKED || metadata.colorSpace == PROFILE_EMBEDDED) {
        iis.mark();
        iis.skipBytes(profileData - size);
        byte[] profile = new byte[profileSize];
        iis.readFully(profile, 0, profileSize);
        iis.reset();
        try {
            if (metadata.colorSpace == PROFILE_LINKED) colorSpace = new ICC_ColorSpace(ICC_Profile.getInstance(new String(profile))); else colorSpace = new ICC_ColorSpace(ICC_Profile.getInstance(profile));
        } catch (Exception e) {
            colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
        }
    }
    if (bitsPerPixel == 1 || bitsPerPixel == 4 || bitsPerPixel == 8) {
        numBands = 1;
        if (bitsPerPixel == 8) {
            int[] bandOffsets = new int[numBands];
            for (int i = 0; i < numBands; i++) {
                bandOffsets[i] = numBands - 1 - i;
            }
            sampleModel = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, width, height, numBands, numBands * width, bandOffsets);
        } else {
            sampleModel = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, width, height, bitsPerPixel);
        }
        byte r[], g[], b[];
        if (imageType == VERSION_2_1_BIT || imageType == VERSION_2_4_BIT || imageType == VERSION_2_8_BIT) {
            size = palette.length / 3;
            if (size > 256) {
                size = 256;
            }
            int off;
            r = new byte[(int) size];
            g = new byte[(int) size];
            b = new byte[(int) size];
            for (int i = 0; i < (int) size; i++) {
                off = 3 * i;
                b[i] = palette[off];
                g[i] = palette[off + 1];
                r[i] = palette[off + 2];
            }
        } else {
            size = palette.length / 4;
            if (size > 256) {
                size = 256;
            }
            int off;
            r = new byte[(int) size];
            g = new byte[(int) size];
            b = new byte[(int) size];
            for (int i = 0; i < size; i++) {
                off = 4 * i;
                b[i] = palette[off];
                g[i] = palette[off + 1];
                r[i] = palette[off + 2];
            }
        }
        if (ImageUtil.isIndicesForGrayscale(r, g, b)) colorModel = ImageUtil.createColorModel(null, sampleModel); else colorModel = new IndexColorModel(bitsPerPixel, (int) size, r, g, b);
    } else if (bitsPerPixel == 16) {
        numBands = 3;
        sampleModel = new SinglePixelPackedSampleModel(DataBuffer.TYPE_USHORT, width, height, new int[] { redMask, greenMask, blueMask });
        colorModel = new DirectColorModel(colorSpace, 16, redMask, greenMask, blueMask, 0, false, DataBuffer.TYPE_USHORT);
    } else if (bitsPerPixel == 32) {
        numBands = alphaMask == 0 ? 3 : 4;
        int[] bitMasks = numBands == 3 ? new int[] { redMask, greenMask, blueMask } : new int[] { redMask, greenMask, blueMask, alphaMask };
        sampleModel = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT, width, height, bitMasks);
        colorModel = new DirectColorModel(colorSpace, 32, redMask, greenMask, blueMask, alphaMask, false, DataBuffer.TYPE_INT);
    } else {
        numBands = 3;
        int[] bandOffsets = new int[numBands];
        for (int i = 0; i < numBands; i++) {
            bandOffsets[i] = numBands - 1 - i;
        }
        sampleModel = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, width, height, numBands, numBands * width, bandOffsets);
        colorModel = ImageUtil.createColorModel(colorSpace, sampleModel);
    }
    originalSampleModel = sampleModel;
    originalColorModel = colorModel;
    iis.reset();
    iis.skipBytes(bitmapOffset);
    gotHeader = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.bmp.BMPImageReader.readEmbedded(String, BufferedImage, ImageReadParam)

/** Decodes the jpeg/png image embedded in the bitmap using any jpeg
     *  ImageIO-style plugin.
     * @param bi The destination <code>BufferedImage</code>.
     * @param bmpParam The <code>ImageReadParam</code> for decoding this
     *          BMP image.  The parameters for subregion, band selection and
     *          subsampling are used in decoding the jpeg image.
     */
private void readEmbedded(String format, BufferedImage bi, ImageReadParam bmpParam) throws IOException {
    Iterator iterator = ImageIO.getImageReadersByFormatName(format);
    ImageReader reader = null;
    if (iterator.hasNext()) reader = (ImageReader) iterator.next();
    if (reader != null) {
        byte[] buff = new byte[(int) imageSize];
        iis.read(buff);
        reader.setInput(ImageIO.createImageInputStream(new ByteArrayInputStream(buff)));
        reader.addIIOReadProgressListener(new EmbeddedProgressAdapter() {

            public void imageProgress(ImageReader source, float percentageDone) {
                processImageProgress(percentageDone);
            }
        });
        reader.addIIOReadUpdateListener(new IIOReadUpdateListener() {

            public void imageUpdate(ImageReader source, BufferedImage theImage, int minX, int minY, int width, int height, int periodX, int periodY, int[] bands) {
                processImageUpdate(theImage, minX, minY, width, height, periodX, periodY, bands);
            }

            public void passComplete(ImageReader source, BufferedImage theImage) {
                processPassComplete(theImage);
            }

            public void passStarted(ImageReader source, BufferedImage theImage, int pass, int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands) {
                processPassStarted(theImage, pass, minPass, maxPass, minX, minY, periodX, periodY, bands);
            }

            public void thumbnailPassComplete(ImageReader source, BufferedImage thumb) {
            }

            public void thumbnailPassStarted(ImageReader source, BufferedImage thumb, int pass, int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands) {
            }

            public void thumbnailUpdate(ImageReader source, BufferedImage theThumbnail, int minX, int minY, int width, int height, int periodX, int periodY, int[] bands) {
            }
        });
        reader.addIIOReadWarningListener(new IIOReadWarningListener() {

            public void warningOccurred(ImageReader source, String warning) {
                processWarningOccurred(warning);
            }
        });
        ImageReadParam param = reader.getDefaultReadParam();
        param.setDestination(bi);
        param.setDestinationBands(bmpParam.getDestinationBands());
        param.setDestinationOffset(bmpParam.getDestinationOffset());
        param.setSourceBands(bmpParam.getSourceBands());
        param.setSourceRegion(bmpParam.getSourceRegion());
        param.setSourceSubsampling(bmpParam.getSourceXSubsampling(), bmpParam.getSourceYSubsampling(), bmpParam.getSubsamplingXOffset(), bmpParam.getSubsamplingYOffset());
        reader.read(0, param);
    } else throw new RuntimeException(I18N.getString('BMPImageReader4') + ' ' + format);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.bmp.BMPImageWriter.write(IIOMetadata, IIOImage, ImageWriteParam)

public void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException {
    if (stream == null) {
        throw new IllegalStateException(I18N.getString('BMPImageWriter7'));
    }
    if (image == null) {
        throw new IllegalArgumentException(I18N.getString('BMPImageWriter8'));
    }
    clearAbortRequest();
    processImageStarted(0);
    if (param == null) param = getDefaultWriteParam();
    BMPImageWriteParam bmpParam = (BMPImageWriteParam) param;
    int bitsPerPixel = 24;
    boolean isPalette = false;
    int paletteEntries = 0;
    IndexColorModel icm = null;
    RenderedImage input = null;
    Raster inputRaster = null;
    boolean writeRaster = image.hasRaster();
    Rectangle sourceRegion = param.getSourceRegion();
    SampleModel sampleModel = null;
    ColorModel colorModel = null;
    compImageSize = 0;
    if (writeRaster) {
        inputRaster = image.getRaster();
        sampleModel = inputRaster.getSampleModel();
        colorModel = ImageUtil.createColorModel(null, sampleModel);
        if (sourceRegion == null) sourceRegion = inputRaster.getBounds(); else sourceRegion = sourceRegion.intersection(inputRaster.getBounds());
    } else {
        input = image.getRenderedImage();
        sampleModel = input.getSampleModel();
        colorModel = input.getColorModel();
        Rectangle rect = new Rectangle(input.getMinX(), input.getMinY(), input.getWidth(), input.getHeight());
        if (sourceRegion == null) sourceRegion = rect; else sourceRegion = sourceRegion.intersection(rect);
    }
    IIOMetadata imageMetadata = image.getMetadata();
    BMPMetadata bmpImageMetadata = null;
    if (imageMetadata != null && imageMetadata instanceof BMPMetadata) {
        bmpImageMetadata = (BMPMetadata) imageMetadata;
    } else {
        ImageTypeSpecifier imageType = new ImageTypeSpecifier(colorModel, sampleModel);
        bmpImageMetadata = (BMPMetadata) getDefaultImageMetadata(imageType, param);
    }
    if (sourceRegion.isEmpty()) throw new RuntimeException(I18N.getString('BMPImageWrite0'));
    int scaleX = param.getSourceXSubsampling();
    int scaleY = param.getSourceYSubsampling();
    int xOffset = param.getSubsamplingXOffset();
    int yOffset = param.getSubsamplingYOffset();
    int dataType = sampleModel.getDataType();
    sourceRegion.translate(xOffset, yOffset);
    sourceRegion.width -= xOffset;
    sourceRegion.height -= yOffset;
    int minX = sourceRegion.x / scaleX;
    int minY = sourceRegion.y / scaleY;
    w = (sourceRegion.width + scaleX - 1) / scaleX;
    h = (sourceRegion.height + scaleY - 1) / scaleY;
    xOffset = sourceRegion.x % scaleX;
    yOffset = sourceRegion.y % scaleY;
    Rectangle destinationRegion = new Rectangle(minX, minY, w, h);
    boolean noTransform = destinationRegion.equals(sourceRegion);
    int[] sourceBands = param.getSourceBands();
    boolean noSubband = true;
    int numBands = sampleModel.getNumBands();
    if (sourceBands != null) {
        sampleModel = sampleModel.createSubsetSampleModel(sourceBands);
        colorModel = null;
        noSubband = false;
        numBands = sampleModel.getNumBands();
    } else {
        sourceBands = new int[numBands];
        for (int i = 0; i < numBands; i++) sourceBands[i] = i;
    }
    int[] bandOffsets = null;
    boolean bgrOrder = true;
    if (sampleModel instanceof ComponentSampleModel) {
        bandOffsets = ((ComponentSampleModel) sampleModel).getBandOffsets();
        if (sampleModel instanceof BandedSampleModel) {
            bgrOrder = false;
        } else {
            for (int i = 0; i < bandOffsets.length; i++) bgrOrder &= bandOffsets[i] == bandOffsets.length - i - 1;
        }
    } else {
        bandOffsets = new int[numBands];
        for (int i = 0; i < numBands; i++) bandOffsets[i] = i;
    }
    if (bgrOrder && sampleModel instanceof SinglePixelPackedSampleModel) {
        int[] bitOffsets = ((SinglePixelPackedSampleModel) sampleModel).getBitOffsets();
        for (int i = 0; i < bitOffsets.length - 1; i++) {
            bgrOrder &= bitOffsets[i] > bitOffsets[i + 1];
        }
    }
    noTransform &= bgrOrder;
    int sampleSize[] = sampleModel.getSampleSize();
    int destScanlineBytes = w * numBands;
    switch(bmpParam.getCompressionMode()) {
        case ImageWriteParam.MODE_EXPLICIT:
            compressionType = getCompressionType(bmpParam.getCompressionType());
            break;
        case ImageWriteParam.MODE_COPY_FROM_METADATA:
            compressionType = bmpImageMetadata.compression;
            break;
        case ImageWriteParam.MODE_DEFAULT:
            compressionType = getPreferredCompressionType(colorModel, sampleModel);
            break;
        default:
            compressionType = BI_RGB;
    }
    if (!canEncodeImage(compressionType, colorModel, sampleModel)) {
        throw new IOException('Image can not be encoded with compression type ' + compressionTypeNames[compressionType]);
    }
    byte r[] = null, g[] = null, b[] = null, a[] = null;
    if (colorModel instanceof IndexColorModel) {
        isPalette = true;
        icm = (IndexColorModel) colorModel;
        paletteEntries = icm.getMapSize();
        if (paletteEntries <= 2) {
            bitsPerPixel = 1;
            destScanlineBytes = w + 7 >> 3;
        } else if (paletteEntries <= 16) {
            bitsPerPixel = 4;
            destScanlineBytes = w + 1 >> 1;
        } else if (paletteEntries <= 256) {
            bitsPerPixel = 8;
        } else {
            bitsPerPixel = 24;
            isPalette = false;
            paletteEntries = 0;
            destScanlineBytes = w * 3;
        }
        if (isPalette == true) {
            r = new byte[paletteEntries];
            g = new byte[paletteEntries];
            b = new byte[paletteEntries];
            a = new byte[paletteEntries];
            icm.getAlphas(a);
            icm.getReds(r);
            icm.getGreens(g);
            icm.getBlues(b);
        }
    } else {
        if (numBands == 1) {
            isPalette = true;
            paletteEntries = 256;
            bitsPerPixel = sampleSize[0];
            destScanlineBytes = (w * bitsPerPixel + 7 >> 3);
            r = new byte[256];
            g = new byte[256];
            b = new byte[256];
            a = new byte[256];
            for (int i = 0; i < 256; i++) {
                r[i] = (byte) i;
                g[i] = (byte) i;
                b[i] = (byte) i;
                a[i] = (byte) 255;
            }
        } else {
            if (sampleModel instanceof SinglePixelPackedSampleModel && noSubband) {
                bitsPerPixel = DataBuffer.getDataTypeSize(sampleModel.getDataType());
                destScanlineBytes = w * bitsPerPixel + 7 >> 3;
                if (compressionType == BMPConstants.BI_BITFIELDS) {
                    isPalette = true;
                    paletteEntries = 3;
                    r = new byte[paletteEntries];
                    g = new byte[paletteEntries];
                    b = new byte[paletteEntries];
                    a = new byte[paletteEntries];
                    if (bitsPerPixel == 16) {
                        b[0] = (byte) 0x00;
                        g[0] = (byte) 0x00;
                        r[0] = (byte) 0xF8;
                        a[0] = (byte) 0x00;
                        b[1] = (byte) 0x00;
                        g[1] = (byte) 0x00;
                        r[1] = (byte) 0x07;
                        a[1] = (byte) 0xE0;
                        b[2] = (byte) 0x00;
                        g[2] = (byte) 0x00;
                        r[2] = (byte) 0x00;
                        a[2] = (byte) 0x1F;
                    } else if (bitsPerPixel == 32) {
                        b[0] = (byte) 0x00;
                        g[0] = (byte) 0xFF;
                        r[0] = (byte) 0x00;
                        a[0] = (byte) 0x00;
                        b[1] = (byte) 0x00;
                        g[1] = (byte) 0x00;
                        r[1] = (byte) 0xFF;
                        a[1] = (byte) 0x00;
                        b[2] = (byte) 0x00;
                        g[2] = (byte) 0x00;
                        r[2] = (byte) 0x00;
                        a[2] = (byte) 0xFF;
                    } else {
                        throw new RuntimeException(I18N.getString('BMPImageWrite6'));
                    }
                }
            }
        }
    }
    int fileSize = 0;
    int offset = 0;
    int headerSize = 0;
    int imageSize = 0;
    int xPelsPerMeter = 0;
    int yPelsPerMeter = 0;
    int colorsUsed = 0;
    int colorsImportant = paletteEntries;
    int padding = destScanlineBytes % 4;
    if (padding != 0) {
        padding = 4 - padding;
    }
    if (sampleModel instanceof SinglePixelPackedSampleModel && noSubband) {
        destScanlineBytes = w;
        bitPos = ((SinglePixelPackedSampleModel) sampleModel).getBitMasks();
        for (int i = 0; i < bitPos.length; i++) bitPos[i] = firstLowBit(bitPos[i]);
    }
    offset = 54 + paletteEntries * 4;
    imageSize = (destScanlineBytes + padding) * h;
    fileSize = imageSize + offset;
    headerSize = 40;
    long headPos = stream.getStreamPosition();
    writeFileHeader(fileSize, offset);
    writeInfoHeader(headerSize, bitsPerPixel);
    stream.writeInt(compressionType);
    stream.writeInt(imageSize);
    stream.writeInt(xPelsPerMeter);
    stream.writeInt(yPelsPerMeter);
    stream.writeInt(colorsUsed);
    stream.writeInt(colorsImportant);
    if (isPalette == true) {
        if (compressionType == BMPConstants.BI_BITFIELDS) {
            for (int i = 0; i < 3; i++) {
                int mask = (a[i] & 0xFF) + ((r[i] & 0xFF) * 0x100) + ((g[i] & 0xFF) * 0x10000) + ((b[i] & 0xFF) * 0x1000000);
                stream.writeInt(mask);
            }
        } else {
            for (int i = 0; i < paletteEntries; i++) {
                stream.writeByte(b[i]);
                stream.writeByte(g[i]);
                stream.writeByte(r[i]);
                stream.writeByte(a[i]);
            }
        }
    }
    int scanlineBytes = w * numBands;
    int[] pixels = new int[scanlineBytes * scaleX];
    bpixels = new byte[destScanlineBytes];
    int l;
    if (compressionType == BMPConstants.BI_JPEG || compressionType == BMPConstants.BI_PNG) {
        embedded_stream = new ByteArrayOutputStream();
        writeEmbedded(image, bmpParam);
        embedded_stream.flush();
        imageSize = embedded_stream.size();
        long endPos = stream.getStreamPosition();
        fileSize = (int) (offset + imageSize);
        stream.seek(headPos);
        writeSize(fileSize, 2);
        stream.seek(headPos);
        writeSize(imageSize, 34);
        stream.seek(endPos);
        stream.write(embedded_stream.toByteArray());
        embedded_stream = null;
        if (abortRequested()) {
            processWriteAborted();
        } else {
            processImageComplete();
            stream.flushBefore(stream.getStreamPosition());
        }
        return;
    }
    isTopDown = bmpParam.isTopDown();
    int maxBandOffset = bandOffsets[0];
    for (int i = 1; i < bandOffsets.length; i++) if (bandOffsets[i] > maxBandOffset) maxBandOffset = bandOffsets[i];
    int[] pixel = new int[maxBandOffset + 1];
    for (int i = 0; i < h; i++) {
        if (abortRequested()) {
            break;
        }
        int row = minY + i;
        if (!isTopDown) row = minY + h - i - 1;
        Raster src = inputRaster;
        Rectangle srcRect = new Rectangle(minX * scaleX + xOffset, row * scaleY + yOffset, (w - 1) * scaleX + 1, 1);
        if (!writeRaster) src = input.getData(srcRect);
        if (noTransform && noSubband) {
            SampleModel sm = src.getSampleModel();
            int pos = 0;
            int startX = srcRect.x - src.getSampleModelTranslateX();
            int startY = srcRect.y - src.getSampleModelTranslateY();
            if (sm instanceof ComponentSampleModel) {
                ComponentSampleModel csm = (ComponentSampleModel) sm;
                pos = csm.getOffset(startX, startY, 0);
                for (int nb = 1; nb < csm.getNumBands(); nb++) {
                    if (pos > csm.getOffset(startX, startY, nb)) {
                        pos = csm.getOffset(startX, startY, nb);
                    }
                }
            } else if (sm instanceof MultiPixelPackedSampleModel) {
                MultiPixelPackedSampleModel mppsm = (MultiPixelPackedSampleModel) sm;
                pos = mppsm.getOffset(startX, startY);
            } else if (sm instanceof SinglePixelPackedSampleModel) {
                SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel) sm;
                pos = sppsm.getOffset(startX, startY);
            }
            if (compressionType == BMPConstants.BI_RGB || compressionType == BMPConstants.BI_BITFIELDS) {
                switch(dataType) {
                    case DataBuffer.TYPE_BYTE:
                        byte[] bdata = ((DataBufferByte) src.getDataBuffer()).getData();
                        stream.write(bdata, pos, destScanlineBytes);
                        break;
                    case DataBuffer.TYPE_SHORT:
                        short[] sdata = ((DataBufferShort) src.getDataBuffer()).getData();
                        stream.writeShorts(sdata, pos, destScanlineBytes);
                        break;
                    case DataBuffer.TYPE_USHORT:
                        short[] usdata = ((DataBufferUShort) src.getDataBuffer()).getData();
                        stream.writeShorts(usdata, pos, destScanlineBytes);
                        break;
                    case DataBuffer.TYPE_INT:
                        int[] idata = ((DataBufferInt) src.getDataBuffer()).getData();
                        stream.writeInts(idata, pos, destScanlineBytes);
                        break;
                }
                for (int k = 0; k < padding; k++) {
                    stream.writeByte(0);
                }
            } else if (compressionType == BMPConstants.BI_RLE4) {
                if (bpixels == null || bpixels.length < scanlineBytes) bpixels = new byte[scanlineBytes];
                src.getPixels(srcRect.x, srcRect.y, srcRect.width, srcRect.height, pixels);
                for (int h = 0; h < scanlineBytes; h++) {
                    bpixels[h] = (byte) pixels[h];
                }
                encodeRLE4(bpixels, scanlineBytes);
            } else if (compressionType == BMPConstants.BI_RLE8) {
                if (bpixels == null || bpixels.length < scanlineBytes) bpixels = new byte[scanlineBytes];
                src.getPixels(srcRect.x, srcRect.y, srcRect.width, srcRect.height, pixels);
                for (int h = 0; h < scanlineBytes; h++) {
                    bpixels[h] = (byte) pixels[h];
                }
                encodeRLE8(bpixels, scanlineBytes);
            }
        } else {
            src.getPixels(srcRect.x, srcRect.y, srcRect.width, srcRect.height, pixels);
            if (scaleX != 1 || maxBandOffset != numBands - 1 || bgrOrder) for (int j = 0, k = 0, n = 0; j < w; j++, k += scaleX * numBands, n += numBands) {
                System.arraycopy(pixels, k, pixel, 0, pixel.length);
                for (int m = 0; m < numBands; m++) pixels[n + numBands - m - 1] = pixel[bandOffsets[sourceBands[m]]];
            }
            writePixels(0, scanlineBytes, bitsPerPixel, pixels, padding, numBands, icm);
        }
        processImageProgress(100.0f * (((float) i) / ((float) h)));
    }
    if (compressionType == BMPConstants.BI_RLE4 || compressionType == BMPConstants.BI_RLE8) {
        stream.writeByte(0);
        stream.writeByte(1);
        incCompImageSize(2);
        imageSize = compImageSize;
        fileSize = compImageSize + offset;
        long endPos = stream.getStreamPosition();
        stream.seek(headPos);
        writeSize(fileSize, 2);
        stream.seek(headPos);
        writeSize(imageSize, 34);
        stream.seek(endPos);
    }
    if (abortRequested()) {
        processWriteAborted();
    } else {
        processImageComplete();
        stream.flushBefore(stream.getStreamPosition());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.bmp.BMPImageWriter.writeEmbedded(IIOImage, ImageWriteParam)

private void writeEmbedded(IIOImage image, ImageWriteParam bmpParam) throws IOException {
    String format = compressionType == BMPConstants.BI_JPEG ? 'jpeg' : 'png';
    Iterator iterator = ImageIO.getImageWritersByFormatName(format);
    ImageWriter writer = null;
    if (iterator.hasNext()) writer = (ImageWriter) iterator.next();
    if (writer != null) {
        if (embedded_stream == null) {
            throw new RuntimeException('No stream for writing embedded image!');
        }
        writer.addIIOWriteProgressListener(new IIOWriteProgressAdapter() {

            public void imageProgress(ImageWriter source, float percentageDone) {
                processImageProgress(percentageDone);
            }
        });
        writer.addIIOWriteWarningListener(new IIOWriteWarningListener() {

            public void warningOccurred(ImageWriter source, int imageIndex, String warning) {
                processWarningOccurred(imageIndex, warning);
            }
        });
        writer.setOutput(ImageIO.createImageOutputStream(embedded_stream));
        ImageWriteParam param = writer.getDefaultWriteParam();
        param.setDestinationOffset(bmpParam.getDestinationOffset());
        param.setSourceBands(bmpParam.getSourceBands());
        param.setSourceRegion(bmpParam.getSourceRegion());
        param.setSourceSubsampling(bmpParam.getSourceXSubsampling(), bmpParam.getSourceYSubsampling(), bmpParam.getSubsamplingXOffset(), bmpParam.getSubsamplingYOffset());
        writer.write(null, image, param);
    } else throw new RuntimeException(I18N.getString('BMPImageWrite5') + ' ' + format);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.startDocument(XMLLocator, String, NamespaceContext, Augmentations)

/**
     * The start of the document.
     * @param locator The system identifier of the entity if the entity
     *                 is external, null otherwise.
     * @param encoding The auto-detected IANA encoding name of the entity
     *                 stream. This value will be null in those situations
     *                 where the entity encoding is not auto-detected (e.g.
     *                 internal entities or a document entity that is
     *                 parsed from a java.io.Reader).
     * @param namespaceContext
     *                 The namespace context in effect at the
     *                 start of this document.
     *                 This object represents the current context.
     *                 Implementors of this class are responsible
     *                 for copying the namespace bindings from the
     *                 the current context (and its parent contexts)
     *                 if that information is important.
     * @param augs     Additional information that may include infoset augmentations
     * @throws XNIException Thrown by handler to signal an error.
     */
public void startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs) throws XNIException {
    if (!fDeferNodeExpansion) {
        if (fDocumentClassName.equals(DEFAULT_DOCUMENT_CLASS_NAME)) {
            fDocument = new DocumentImpl();
            fDocumentImpl = (CoreDocumentImpl) fDocument;
            fDocumentImpl.setStrictErrorChecking(false);
            fDocumentImpl.setInputEncoding(encoding);
            fDocumentImpl.setDocumentURI(locator.getExpandedSystemId());
        } else if (fDocumentClassName.equals(PSVI_DOCUMENT_CLASS_NAME)) {
            fDocument = new PSVIDocumentImpl();
            fDocumentImpl = (CoreDocumentImpl) fDocument;
            fStorePSVI = true;
            fDocumentImpl.setStrictErrorChecking(false);
            fDocumentImpl.setInputEncoding(encoding);
            fDocumentImpl.setDocumentURI(locator.getExpandedSystemId());
        } else {
            try {
                ClassLoader cl = ObjectFactory.findClassLoader();
                Class documentClass = ObjectFactory.findProviderClass(fDocumentClassName, cl, true);
                fDocument = (Document) documentClass.newInstance();
                Class defaultDocClass = ObjectFactory.findProviderClass(CORE_DOCUMENT_CLASS_NAME, cl, true);
                if (defaultDocClass.isAssignableFrom(documentClass)) {
                    fDocumentImpl = (CoreDocumentImpl) fDocument;
                    Class psviDocClass = ObjectFactory.findProviderClass(PSVI_DOCUMENT_CLASS_NAME, cl, true);
                    if (psviDocClass.isAssignableFrom(documentClass)) {
                        fStorePSVI = true;
                    }
                    fDocumentImpl.setStrictErrorChecking(false);
                    fDocumentImpl.setInputEncoding(encoding);
                    if (locator != null) {
                        fDocumentImpl.setDocumentURI(locator.getExpandedSystemId());
                    }
                }
            } catch (ClassNotFoundException e) {
            } catch (Exception e) {
                throw new RuntimeException(DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, 'CannotCreateDocumentClass', new Object[] { fDocumentClassName }));
            }
        }
        fCurrentNode = fDocument;
    } else {
        fDeferredDocumentImpl = new DeferredDocumentImpl(fNamespaceAware);
        fDocument = fDeferredDocumentImpl;
        fDocumentIndex = fDeferredDocumentImpl.createDeferredDocument();
        fDeferredDocumentImpl.setInputEncoding(encoding);
        fDeferredDocumentImpl.setDocumentURI(locator.getExpandedSystemId());
        fCurrentNodeIndex = fDocumentIndex;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serialize.HTMLdtd.initialize()

/**
     * Initialize upon first access. Will load all the HTML character references
     * into a list that is accessible by name or character value and is optimized
     * for character substitution. This method may be called any number of times
     * but will execute only once.
     */
private static void initialize() {
    InputStream is = null;
    BufferedReader reader = null;
    int index;
    String name;
    String value;
    int code;
    String line;
    if (_byName != null) return;
    try {
        _byName = new Hashtable();
        _byChar = new Hashtable();
        is = HTMLdtd.class.getResourceAsStream(ENTITIES_RESOURCE);
        if (is == null) {
            throw new RuntimeException(DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'ResourceNotFound', new Object[] { ENTITIES_RESOURCE }));
        }
        reader = new BufferedReader(new InputStreamReader(is, 'ASCII'));
        line = reader.readLine();
        while (line != null) {
            if (line.length() == 0 || line.charAt(0) == '#') {
                line = reader.readLine();
                continue;
            }
            index = line.indexOf(' ');
            if (index > 1) {
                name = line.substring(0, index);
                ++index;
                if (index < line.length()) {
                    value = line.substring(index);
                    index = value.indexOf(' ');
                    if (index > 0) value = value.substring(0, index);
                    code = Integer.parseInt(value);
                    defineEntity(name, (char) code);
                }
            }
            line = reader.readLine();
        }
        is.close();
    } catch (Exception except) {
        throw new RuntimeException(DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'ResourceNotLoaded', new Object[] { ENTITIES_RESOURCE, except.toString() }));
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (Exception except) {
            }
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xml.internal.serialize.XMLSerializer.serializeElement(Element)

/**
     * Called to serialize a DOM element. Equivalent to calling {@link
     * #startElement}, {@link #endElement} and serializing everything
     * inbetween, but better optimized.
     */
protected void serializeElement(Element elem) throws IOException {
    Attr attr;
    NamedNodeMap attrMap;
    int i;
    Node child;
    ElementState state;
    String name;
    String value;
    String tagName;
    String prefix, localUri;
    String uri;
    if (fNamespaces) {
        fLocalNSBinder.reset();
        fNSBinder.pushContext();
    }
    if (DEBUG) {
        System.out.println('==>startElement: ' + elem.getNodeName() + ' ns=' + elem.getNamespaceURI());
    }
    tagName = elem.getTagName();
    state = getElementState();
    if (isDocumentState()) {
        if (!_started) {
            startDocument(tagName);
        }
    } else {
        if (state.empty) _printer.printText('>');
        if (state.inCData) {
            _printer.printText(']]>');
            state.inCData = false;
        }
        if (_indenting && !state.preserveSpace && (state.empty || state.afterElement || state.afterComment)) _printer.breakLine();
    }
    fPreserveSpace = state.preserveSpace;
    int length = 0;
    attrMap = null;
    if (elem.hasAttributes()) {
        attrMap = elem.getAttributes();
        length = attrMap.getLength();
    }
    if (!fNamespaces) {
        _printer.printText('<');
        _printer.printText(tagName);
        _printer.indent();
        for (i = 0; i < length; ++i) {
            attr = (Attr) attrMap.item(i);
            name = attr.getName();
            value = attr.getValue();
            if (value == null) value = '';
            printAttribute(name, value, attr.getSpecified(), attr);
        }
    } else {
        for (i = 0; i < length; i++) {
            attr = (Attr) attrMap.item(i);
            uri = attr.getNamespaceURI();
            if (uri != null && uri.equals(NamespaceContext.XMLNS_URI)) {
                value = attr.getNodeValue();
                if (value == null) {
                    value = XMLSymbols.EMPTY_STRING;
                }
                if (value.equals(NamespaceContext.XMLNS_URI)) {
                    if (fDOMErrorHandler != null) {
                        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.XML_DOMAIN, 'CantBindXMLNS', null);
                        modifyDOMError(msg, DOMError.SEVERITY_ERROR, attr);
                        boolean continueProcess = fDOMErrorHandler.handleError(fDOMError);
                        if (!continueProcess) {
                            throw new RuntimeException(DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'SerializationStopped', null));
                        }
                    }
                } else {
                    prefix = attr.getPrefix();
                    prefix = (prefix == null || prefix.length() == 0) ? XMLSymbols.EMPTY_STRING : fSymbolTable.addSymbol(prefix);
                    String localpart = fSymbolTable.addSymbol(attr.getLocalName());
                    if (prefix == XMLSymbols.PREFIX_XMLNS) {
                        value = fSymbolTable.addSymbol(value);
                        if (value.length() != 0) {
                            fNSBinder.declarePrefix(localpart, value);
                        } else {
                        }
                        continue;
                    } else {
                        value = fSymbolTable.addSymbol(value);
                        fNSBinder.declarePrefix(XMLSymbols.EMPTY_STRING, value);
                        continue;
                    }
                }
            }
        }
        uri = elem.getNamespaceURI();
        prefix = elem.getPrefix();
        if ((uri != null && prefix != null) && uri.length() == 0 && prefix.length() != 0) {
            prefix = null;
            _printer.printText('<');
            _printer.printText(elem.getLocalName());
            _printer.indent();
        } else {
            _printer.printText('<');
            _printer.printText(tagName);
            _printer.indent();
        }
        if (uri != null) {
            uri = fSymbolTable.addSymbol(uri);
            prefix = (prefix == null || prefix.length() == 0) ? XMLSymbols.EMPTY_STRING : fSymbolTable.addSymbol(prefix);
            if (fNSBinder.getURI(prefix) == uri) {
            } else {
                printNamespaceAttr(prefix, uri);
                fLocalNSBinder.declarePrefix(prefix, uri);
                fNSBinder.declarePrefix(prefix, uri);
            }
        } else {
            if (elem.getLocalName() == null) {
                if (fDOMErrorHandler != null) {
                    String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, 'NullLocalElementName', new Object[] { elem.getNodeName() });
                    modifyDOMError(msg, DOMError.SEVERITY_ERROR, elem);
                    boolean continueProcess = fDOMErrorHandler.handleError(fDOMError);
                    if (!continueProcess) {
                        throw new RuntimeException(DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'SerializationStopped', null));
                    }
                }
            } else {
                uri = fNSBinder.getURI(XMLSymbols.EMPTY_STRING);
                if (uri != null && uri.length() > 0) {
                    printNamespaceAttr(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING);
                    fLocalNSBinder.declarePrefix(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING);
                    fNSBinder.declarePrefix(XMLSymbols.EMPTY_STRING, XMLSymbols.EMPTY_STRING);
                }
            }
        }
        for (i = 0; i < length; i++) {
            attr = (Attr) attrMap.item(i);
            value = attr.getValue();
            name = attr.getNodeName();
            uri = attr.getNamespaceURI();
            if (uri != null && uri.length() == 0) {
                uri = null;
                name = attr.getLocalName();
            }
            if (DEBUG) {
                System.out.println('==>process attribute: ' + attr.getNodeName());
            }
            if (value == null) {
                value = XMLSymbols.EMPTY_STRING;
            }
            if (uri != null) {
                prefix = attr.getPrefix();
                prefix = prefix == null ? XMLSymbols.EMPTY_STRING : fSymbolTable.addSymbol(prefix);
                String localpart = fSymbolTable.addSymbol(attr.getLocalName());
                if (uri != null && uri.equals(NamespaceContext.XMLNS_URI)) {
                    prefix = attr.getPrefix();
                    prefix = (prefix == null || prefix.length() == 0) ? XMLSymbols.EMPTY_STRING : fSymbolTable.addSymbol(prefix);
                    localpart = fSymbolTable.addSymbol(attr.getLocalName());
                    if (prefix == XMLSymbols.PREFIX_XMLNS) {
                        localUri = fLocalNSBinder.getURI(localpart);
                        value = fSymbolTable.addSymbol(value);
                        if (value.length() != 0) {
                            if (localUri == null) {
                                printNamespaceAttr(localpart, value);
                                fLocalNSBinder.declarePrefix(localpart, value);
                            }
                        } else {
                        }
                        continue;
                    } else {
                        uri = fNSBinder.getURI(XMLSymbols.EMPTY_STRING);
                        localUri = fLocalNSBinder.getURI(XMLSymbols.EMPTY_STRING);
                        value = fSymbolTable.addSymbol(value);
                        if (localUri == null) {
                            printNamespaceAttr(XMLSymbols.EMPTY_STRING, value);
                        }
                        continue;
                    }
                }
                uri = fSymbolTable.addSymbol(uri);
                String declaredURI = fNSBinder.getURI(prefix);
                if (prefix == XMLSymbols.EMPTY_STRING || declaredURI != uri) {
                    name = attr.getNodeName();
                    String declaredPrefix = fNSBinder.getPrefix(uri);
                    if (declaredPrefix != null && declaredPrefix != XMLSymbols.EMPTY_STRING) {
                        prefix = declaredPrefix;
                        name = prefix + ':' + localpart;
                    } else {
                        if (DEBUG) {
                            System.out.println('==> cound not find prefix for the attribute: ' + prefix);
                        }
                        if (prefix != XMLSymbols.EMPTY_STRING && fLocalNSBinder.getURI(prefix) == null) {
                        } else {
                            int counter = 1;
                            prefix = fSymbolTable.addSymbol(PREFIX + counter++);
                            while (fLocalNSBinder.getURI(prefix) != null) {
                                prefix = fSymbolTable.addSymbol(PREFIX + counter++);
                            }
                            name = prefix + ':' + localpart;
                        }
                        printNamespaceAttr(prefix, uri);
                        value = fSymbolTable.addSymbol(value);
                        fLocalNSBinder.declarePrefix(prefix, value);
                        fNSBinder.declarePrefix(prefix, uri);
                    }
                }
                printAttribute(name, (value == null) ? XMLSymbols.EMPTY_STRING : value, attr.getSpecified(), attr);
            } else {
                if (attr.getLocalName() == null) {
                    if (fDOMErrorHandler != null) {
                        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, 'NullLocalAttrName', new Object[] { attr.getNodeName() });
                        modifyDOMError(msg, DOMError.SEVERITY_ERROR, attr);
                        boolean continueProcess = fDOMErrorHandler.handleError(fDOMError);
                        if (!continueProcess) {
                            throw new RuntimeException(DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'SerializationStopped', null));
                        }
                    }
                    printAttribute(name, value, attr.getSpecified(), attr);
                } else {
                    printAttribute(name, value, attr.getSpecified(), attr);
                }
            }
        }
    }
    if (elem.hasChildNodes()) {
        state = enterElementState(null, null, tagName, fPreserveSpace);
        state.doCData = _format.isCDataElement(tagName);
        state.unescaped = _format.isNonEscapingElement(tagName);
        child = elem.getFirstChild();
        while (child != null) {
            serializeNode(child);
            child = child.getNextSibling();
        }
        if (fNamespaces) {
            fNSBinder.popContext();
        }
        endElementIO(null, null, tagName);
    } else {
        if (DEBUG) {
            System.out.println('==>endElement: ' + elem.getNodeName());
        }
        if (fNamespaces) {
            fNSBinder.popContext();
        }
        _printer.unindent();
        _printer.printText('/>');
        state.afterElement = true;
        state.afterComment = false;
        state.empty = false;
        if (isDocumentState()) _printer.flush();
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.wbmp.WBMPImageWriter.write(IIOMetadata, IIOImage, ImageWriteParam)

public void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException {
    if (stream == null) {
        throw new IllegalStateException(I18N.getString('WBMPImageWriter3'));
    }
    if (image == null) {
        throw new IllegalArgumentException(I18N.getString('WBMPImageWriter4'));
    }
    clearAbortRequest();
    processImageStarted(0);
    if (param == null) param = getDefaultWriteParam();
    RenderedImage input = null;
    Raster inputRaster = null;
    boolean writeRaster = image.hasRaster();
    Rectangle sourceRegion = param.getSourceRegion();
    SampleModel sampleModel = null;
    if (writeRaster) {
        inputRaster = image.getRaster();
        sampleModel = inputRaster.getSampleModel();
    } else {
        input = image.getRenderedImage();
        sampleModel = input.getSampleModel();
        inputRaster = input.getData();
    }
    checkSampleModel(sampleModel);
    if (sourceRegion == null) sourceRegion = inputRaster.getBounds(); else sourceRegion = sourceRegion.intersection(inputRaster.getBounds());
    if (sourceRegion.isEmpty()) throw new RuntimeException(I18N.getString('WBMPImageWriter1'));
    int scaleX = param.getSourceXSubsampling();
    int scaleY = param.getSourceYSubsampling();
    int xOffset = param.getSubsamplingXOffset();
    int yOffset = param.getSubsamplingYOffset();
    sourceRegion.translate(xOffset, yOffset);
    sourceRegion.width -= xOffset;
    sourceRegion.height -= yOffset;
    int minX = sourceRegion.x / scaleX;
    int minY = sourceRegion.y / scaleY;
    int w = (sourceRegion.width + scaleX - 1) / scaleX;
    int h = (sourceRegion.height + scaleY - 1) / scaleY;
    Rectangle destinationRegion = new Rectangle(minX, minY, w, h);
    sampleModel = sampleModel.createCompatibleSampleModel(w, h);
    SampleModel destSM = sampleModel;
    if (sampleModel.getDataType() != DataBuffer.TYPE_BYTE || !(sampleModel instanceof MultiPixelPackedSampleModel) || ((MultiPixelPackedSampleModel) sampleModel).getDataBitOffset() != 0) {
        destSM = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, w, h, 1, w + 7 >> 3, 0);
    }
    if (!destinationRegion.equals(sourceRegion)) {
        if (scaleX == 1 && scaleY == 1) inputRaster = inputRaster.createChild(inputRaster.getMinX(), inputRaster.getMinY(), w, h, minX, minY, null); else {
            WritableRaster ras = Raster.createWritableRaster(destSM, new Point(minX, minY));
            byte[] data = ((DataBufferByte) ras.getDataBuffer()).getData();
            for (int j = minY, y = sourceRegion.y, k = 0; j < minY + h; j++, y += scaleY) {
                for (int i = 0, x = sourceRegion.x; i < w; i++, x += scaleX) {
                    int v = inputRaster.getSample(x, y, 0);
                    data[k + (i >> 3)] |= v << (7 - (i & 7));
                }
                k += w + 7 >> 3;
            }
            inputRaster = ras;
        }
    }
    if (!destSM.equals(inputRaster.getSampleModel())) {
        WritableRaster raster = Raster.createWritableRaster(destSM, new Point(inputRaster.getMinX(), inputRaster.getMinY()));
        raster.setRect(inputRaster);
        inputRaster = raster;
    }
    boolean isWhiteZero = false;
    if (!writeRaster && input.getColorModel() instanceof IndexColorModel) {
        IndexColorModel icm = (IndexColorModel) input.getColorModel();
        isWhiteZero = icm.getRed(0) > icm.getRed(1);
    }
    int lineStride = ((MultiPixelPackedSampleModel) destSM).getScanlineStride();
    int bytesPerRow = (w + 7) / 8;
    byte[] bdata = ((DataBufferByte) inputRaster.getDataBuffer()).getData();
    stream.write(0);
    stream.write(0);
    stream.write(intToMultiByte(w));
    stream.write(intToMultiByte(h));
    if (!isWhiteZero && lineStride == bytesPerRow) {
        stream.write(bdata, 0, h * bytesPerRow);
        processImageProgress(100.0F);
    } else {
        int offset = 0;
        if (!isWhiteZero) {
            for (int row = 0; row < h; row++) {
                if (abortRequested()) break;
                stream.write(bdata, offset, bytesPerRow);
                offset += lineStride;
                processImageProgress(100.0F * row / h);
            }
        } else {
            byte[] inverted = new byte[bytesPerRow];
            for (int row = 0; row < h; row++) {
                if (abortRequested()) break;
                for (int col = 0; col < bytesPerRow; col++) {
                    inverted[col] = (byte) (~(bdata[col + offset]));
                }
                stream.write(inverted, 0, bytesPerRow);
                offset += lineStride;
                processImageProgress(100.0F * row / h);
            }
        }
    }
    if (abortRequested()) processWriteAborted(); else {
        processImageComplete();
        stream.flushBefore(stream.getStreamPosition());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.writeLock()

/**
     * Sets the writeLock for this connection.
     * If the writeLock is already set by someone else, block till the
     * writeLock is released and can set by us.
     * IMPORTANT: this connection's lock must be acquired before
     * setting the writeLock and must be unlocked after setting the writeLock.
     */
public void writeLock() {
    try {
        if (dprintWriteLocks && orb.transportDebugFlag) {
            dprint('.writeLock->: ' + this);
        }
        while (true) {
            int localState = state;
            switch(localState) {
                case OPENING:
                    synchronized (stateEvent) {
                        if (state != OPENING) {
                            break;
                        }
                        try {
                            stateEvent.wait();
                        } catch (InterruptedException ie) {
                            if (orb.transportDebugFlag) {
                                dprint('.writeLock: OPENING InterruptedException: ' + this);
                            }
                        }
                    }
                    break;
                case ESTABLISHED:
                    synchronized (writeEvent) {
                        if (!writeLocked) {
                            writeLocked = true;
                            return;
                        }
                        try {
                            while (state == ESTABLISHED && writeLocked) {
                                writeEvent.wait(100);
                            }
                        } catch (InterruptedException ie) {
                            if (orb.transportDebugFlag) {
                                dprint('.writeLock: ESTABLISHED InterruptedException: ' + this);
                            }
                        }
                    }
                    break;
                case ABORT:
                    synchronized (stateEvent) {
                        if (state != ABORT) {
                            break;
                        }
                        throw wrapper.writeErrorSend();
                    }
                case CLOSE_RECVD:
                    synchronized (stateEvent) {
                        if (state != CLOSE_RECVD) {
                            break;
                        }
                        throw wrapper.connectionCloseRebind();
                    }
                default:
                    if (orb.transportDebugFlag) {
                        dprint('.writeLock: default: ' + this);
                    }
                    throw new RuntimeException('.writeLock: bad state');
            }
        }
    } finally {
        if (dprintWriteLocks && orb.transportDebugFlag) {
            dprint('.writeLock<-: ' + this);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RegexParser.parseSetOperations()

/**
     * '(?[' ... ']' (('-' | '+' | '&') '[' ... ']')? ')'
     */
protected RangeToken parseSetOperations() throws ParseException {
    RangeToken tok = this.parseCharacterClass(false);
    int type;
    while ((type = this.read()) != T_RPAREN) {
        int ch = this.chardata;
        if (type == T_CHAR && (ch == '-' || ch == '&') || type == T_PLUS) {
            this.next();
            if (this.read() != T_LBRACKET) throw ex('parser.ope.1', this.offset - 1);
            RangeToken t2 = this.parseCharacterClass(false);
            if (type == T_PLUS) tok.mergeRanges(t2); else if (ch == '-') tok.subtractRanges(t2); else if (ch == '&') tok.intersectRanges(t2); else throw new RuntimeException('ASSERT');
        } else {
            throw ex('parser.ope.2', this.offset - 1);
        }
    }
    this.next();
    return tok;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.undo.UndoManager.setLimit(int)

/**
     * Set the maximum number of edits this UndoManager will hold. If
     * edits need to be discarded to shrink the limit, they will be
     * told to die in the reverse of the order that they were added.
     * @see #addEdit
     * @see #getLimit
     */
public synchronized void setLimit(int l) {
    if (!inProgress) throw new RuntimeException('Attempt to call UndoManager.setLimit() after UndoManager.end() has been called');
    limit = l;
    trimForLimit();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.spi.monitoring.StatisticsAccumulator.unitTestValidate(String, double, double, long, double, double)

/**
     *  This is an internal API to test StatisticsAccumulator...
     */
public void unitTestValidate(String expectedUnit, double expectedMin, double expectedMax, long expectedSampleCount, double expectedAverage, double expectedStandardDeviation) {
    if (!expectedUnit.equals(unit)) {
        throw new RuntimeException('Unit is not same as expected Unit' + '\nUnit = ' + unit + 'ExpectedUnit = ' + expectedUnit);
    }
    if (min != expectedMin) {
        throw new RuntimeException('Minimum value is not same as expected minimum value' + '\nMin Value = ' + min + 'Expected Min Value = ' + expectedMin);
    }
    if (max != expectedMax) {
        throw new RuntimeException('Maximum value is not same as expected maximum value' + '\nMax Value = ' + max + 'Expected Max Value = ' + expectedMax);
    }
    if (sampleCount != expectedSampleCount) {
        throw new RuntimeException('Sample count is not same as expected Sample Count' + '\nSampleCount = ' + sampleCount + 'Expected Sample Count = ' + expectedSampleCount);
    }
    if (computeAverage() != expectedAverage) {
        throw new RuntimeException('Average is not same as expected Average' + '\nAverage = ' + computeAverage() + 'Expected Average = ' + expectedAverage);
    }
    double difference = Math.abs(computeStandardDeviation() - expectedStandardDeviation);
    if (difference > 1) {
        throw new RuntimeException('Standard Deviation is not same as expected Std Deviation' + '\nStandard Dev = ' + computeStandardDeviation() + 'Expected Standard Dev = ' + expectedStandardDeviation);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dv.xs.AbstractDateTimeDV.getYearMonth(String, int, int, int[])

/**
     * Parses date CCYY-MM
     * @param start
     * @param end
     * @param data
     * @exception RuntimeException
     */
protected int getYearMonth(String buffer, int start, int end, int[] date) throws RuntimeException {
    if (buffer.charAt(0) == '-') {
        start++;
    }
    int i = indexOf(buffer, start, end, '-');
    if (i == -1) throw new RuntimeException('Year separator is missing or misplaced');
    int length = i - start;
    if (length < 4) {
        throw new RuntimeException('Year must have 'CCYY' format');
    } else if (length > 4 && buffer.charAt(start) == '0') {
        throw new RuntimeException('Leading zeros are required if the year value would otherwise have fewer than four digits; otherwise they are forbidden');
    }
    date[CY] = parseIntYear(buffer, i);
    if (buffer.charAt(i) != '-') {
        throw new RuntimeException('CCYY must be followed by '-' sign');
    }
    start = ++i;
    i = start + 2;
    date[M] = parseInt(buffer, start, i);
    return i;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dv.xs.AbstractDateTimeDV.getDate(String, int, int, int[])

/**
     * Parses date CCYY-MM-DD
     * @param start
     * @param end
     * @param data
     * @exception RuntimeException
     */
protected int getDate(String buffer, int start, int end, int[] date) throws RuntimeException {
    start = getYearMonth(buffer, start, end, date);
    if (buffer.charAt(start++) != '-') {
        throw new RuntimeException('CCYY-MM must be followed by '-' sign');
    }
    int stop = start + 2;
    date[D] = parseInt(buffer, start, stop);
    return stop;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createCast(Type, Type)

/** Create conversion operation for two stack operands, this may be an I2C, instruction, e.g.,
   * if the operands are basic types and CHECKCAST if they are reference types.
   */
public Instruction createCast(Type src_type, Type dest_type) {
    if ((src_type instanceof BasicType) && (dest_type instanceof BasicType)) {
        byte dest = dest_type.getType();
        byte src = src_type.getType();
        if (dest == Constants.T_LONG && (src == Constants.T_CHAR || src == Constants.T_BYTE || src == Constants.T_SHORT)) src = Constants.T_INT;
        String[] short_names = { 'C', 'F', 'D', 'B', 'S', 'I', 'L' };
        String name = 'com.sun.org.apache.bcel.internal.generic.' + short_names[src - Constants.T_CHAR] + '2' + short_names[dest - Constants.T_CHAR];
        Instruction i = null;
        try {
            i = (Instruction) java.lang.Class.forName(name).newInstance();
        } catch (Exception e) {
            throw new RuntimeException('Could not find instruction: ' + name);
        }
        return i;
    } else if ((src_type instanceof ReferenceType) && (dest_type instanceof ReferenceType)) {
        if (dest_type instanceof ArrayType) return new CHECKCAST(cp.addArrayClass((ArrayType) dest_type)); else return new CHECKCAST(cp.addClass(((ObjectType) dest_type).getClassName()));
    } else throw new RuntimeException('Can not cast ' + src_type + ' to ' + dest_type);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.CSSParser.pushChar(int)

/**
     * Supports one character look ahead, this will throw if called twice
     * in a row.
     */
private void pushChar(int tempChar) {
    if (didPushChar) {
        throw new RuntimeException('Can not handle look ahead of more than one character');
    }
    didPushChar = true;
    pushedChar = tempChar;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.TimerQueue.start()

synchronized void start() {
    if (running) {
        throw new RuntimeException('Can't start a TimerQueue ' + 'that is already running');
    } else {
        final ThreadGroup threadGroup = AppContext.getAppContext().getThreadGroup();
        java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {

            public Object run() {
                Thread timerThread = new Thread(threadGroup, TimerQueue.this, 'TimerQueue');
                timerThread.setDaemon(true);
                timerThread.setPriority(Thread.NORM_PRIORITY);
                timerThread.start();
                return null;
            }
        });
        running = true;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.JComboBox.checkMutableComboBoxModel()

/** 
     * Checks that the <code>dataModel</code> is an instance of 
     * <code>MutableComboBoxModel</code>.  If not, it throws an exception.
     * @exception RuntimeException if <code>dataModel</code> is not an
     *  instance of <code>MutableComboBoxModel</code>.
     */
void checkMutableComboBoxModel() {
    if (!(dataModel instanceof MutableComboBoxModel)) throw new RuntimeException('Cannot use this method with a non-Mutable data model.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.setInputObject()

private void setInputObject() {
    if (getConnection().getContactInfo() != null) {
        inputObject = (CDRInputObject) getConnection().getContactInfo().createInputObject(orb, this);
    } else if (getConnection().getAcceptor() != null) {
        inputObject = (CDRInputObject) getConnection().getAcceptor().createInputObject(orb, this);
    } else {
        throw new RuntimeException('CorbaMessageMediatorImpl.setInputObject');
    }
    inputObject.setMessageMediator(this);
    setInputObject(inputObject);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.throwNotImplemented(String)

private void throwNotImplemented(String msg) {
    throw new RuntimeException('CorbaMessageMediatorImpl: not implemented ' + msg);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.gif.GIFImageMetadata.getStandardTextNode()

public IIOMetadataNode getStandardTextNode() {
    if (comments == null) {
        return null;
    }
    Iterator commentIter = comments.iterator();
    if (!commentIter.hasNext()) {
        return null;
    }
    IIOMetadataNode text_node = new IIOMetadataNode('Text');
    IIOMetadataNode node = null;
    while (commentIter.hasNext()) {
        byte[] comment = (byte[]) commentIter.next();
        String s = null;
        try {
            s = new String(comment, 'ISO-8859-1');
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException('Encoding ISO-8859-1 unknown!');
        }
        node = new IIOMetadataNode('TextEntry');
        node.setAttribute('value', s);
        node.setAttribute('encoding', 'ISO-8859-1');
        node.setAttribute('compression', 'none');
        text_node.appendChild(node);
    }
    return text_node;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dv.xs.AbstractDateTimeDV.parseTimeZone(String, int, int, int[], int[])

/**
     * Shared code from Date and YearMonth datatypes.
     * Finds if time zone sign is present
     * @param end
     * @param date
     * @exception RuntimeException
     */
protected void parseTimeZone(String buffer, int start, int end, int[] date, int[] timeZone) throws RuntimeException {
    if (start < end) {
        int sign = findUTCSign(buffer, start, end);
        if (sign < 0) {
            throw new RuntimeException('Error in month parsing');
        } else {
            getTimeZone(buffer, date, sign, end, timeZone);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dv.xs.AbstractDateTimeDV.getTime(String, int, int, int[], int[])

/**
     * Parses time hh:mm:ss.sss and time zone if any
     * @param start
     * @param end
     * @param data
     * @exception RuntimeException
     */
protected void getTime(String buffer, int start, int end, int[] data, int[] timeZone) throws RuntimeException {
    int stop = start + 2;
    data[h] = parseInt(buffer, start, stop);
    if (buffer.charAt(stop++) != ':') {
        throw new RuntimeException('Error in parsing time zone');
    }
    start = stop;
    stop = stop + 2;
    data[m] = parseInt(buffer, start, stop);
    if (buffer.charAt(stop++) != ':') {
        throw new RuntimeException('Error in parsing time zone');
    }
    start = stop;
    stop = stop + 2;
    data[s] = parseInt(buffer, start, stop);
    if (stop == end) return;
    start = stop;
    int milisec = buffer.charAt(start) == '.' ? start : -1;
    int sign = findUTCSign(buffer, start, end);
    if (milisec != -1) {
        start = sign < 0 ? end : sign;
        data[ms] = parseInt(buffer, milisec + 1, start);
    }
    if (sign > 0) {
        if (start != sign) throw new RuntimeException('Error in parsing time zone');
        getTimeZone(buffer, data, sign, end, timeZone);
    } else if (start != end) {
        throw new RuntimeException('Error in parsing time zone');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dv.xs.AbstractDateTimeDV.getTimeZone(String, int[], int, int, int[])

/**
     * Parses time zone: 'Z' or {+,-} followed by  hh:mm
     * @param data
     * @param sign
     * @exception RuntimeException
     */
protected void getTimeZone(String buffer, int[] data, int sign, int end, int[] timeZone) throws RuntimeException {
    data[utc] = buffer.charAt(sign);
    if (buffer.charAt(sign) == 'Z') {
        if (end > (++sign)) {
            throw new RuntimeException('Error in parsing time zone');
        }
        return;
    }
    if (sign <= (end - 6)) {
        int stop = ++sign + 2;
        timeZone[hh] = parseInt(buffer, sign, stop);
        if (buffer.charAt(stop++) != ':') {
            throw new RuntimeException('Error in parsing time zone');
        }
        timeZone[mm] = parseInt(buffer, stop, stop + 2);
        if (stop + 2 != end) {
            throw new RuntimeException('Error in parsing time zone');
        }
    } else {
        throw new RuntimeException('Error in parsing time zone');
    }
    if (DEBUG) {
        System.out.println('time[hh]=' + timeZone[hh] + ' time[mm]=' + timeZone[mm]);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(QName, Augmentations, boolean)

/** Handle end element. */
protected void handleEndElement(QName element, Augmentations augs, boolean isEmpty) throws XNIException {
    fElementDepth--;
    if (fPerformValidation) {
        int elementIndex = fCurrentElementIndex;
        if (elementIndex != -1 && fCurrentContentSpecType != -1) {
            QName children[] = fElementChildren;
            int childrenOffset = fElementChildrenOffsetStack[fElementDepth + 1] + 1;
            int childrenLength = fElementChildrenLength - childrenOffset;
            int result = checkContent(elementIndex, children, childrenOffset, childrenLength);
            if (result != -1) {
                fDTDGrammar.getElementDecl(elementIndex, fTempElementDecl);
                if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) {
                    fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, 'MSG_CONTENT_INVALID', new Object[] { element.rawname, 'EMPTY' }, XMLErrorReporter.SEVERITY_ERROR);
                } else {
                    String messageKey = result != childrenLength ? 'MSG_CONTENT_INVALID' : 'MSG_CONTENT_INCOMPLETE';
                    fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, messageKey, new Object[] { element.rawname, fDTDGrammar.getContentSpecAsString(elementIndex) }, XMLErrorReporter.SEVERITY_ERROR);
                }
            }
        }
        fElementChildrenLength = fElementChildrenOffsetStack[fElementDepth + 1] + 1;
    }
    endNamespaceScope(fCurrentElement, augs, isEmpty);
    if (fElementDepth < -1) {
        throw new RuntimeException('FWK008 Element stack underflow');
    }
    if (fElementDepth < 0) {
        fCurrentElement.clear();
        fCurrentElementIndex = -1;
        fCurrentContentSpecType = -1;
        fInElementContent = false;
        if (fPerformValidation) {
            String value = fValidationState.checkIDRefID();
            if (value != null) {
                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, 'MSG_ELEMENT_WITH_ID_REQUIRED', new Object[] { value }, XMLErrorReporter.SEVERITY_ERROR);
            }
        }
        return;
    }
    fCurrentElement.setValues(fElementQNamePartsStack[fElementDepth]);
    fCurrentElementIndex = fElementIndexStack[fElementDepth];
    fCurrentContentSpecType = fContentSpecTypeStack[fElementDepth];
    fInElementContent = (fCurrentContentSpecType == XMLElementDecl.TYPE_CHILDREN);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.beans.EventHandler.applyGetters(Object, String)

private Object applyGetters(Object target, String getters) {
    if (getters == null || getters.equals('')) {
        return target;
    }
    int firstDot = getters.indexOf('.');
    if (firstDot == -1) {
        firstDot = getters.length();
    }
    String first = getters.substring(0, firstDot);
    String rest = getters.substring(Math.min(firstDot + 1, getters.length()));
    try {
        Method getter = ReflectionUtils.getMethod(target.getClass(), 'get' + NameGenerator.capitalize(first), new Class[] {});
        if (getter == null) {
            getter = ReflectionUtils.getMethod(target.getClass(), 'is' + NameGenerator.capitalize(first), new Class[] {});
        }
        if (getter == null) {
            getter = ReflectionUtils.getMethod(target.getClass(), first, new Class[] {});
        }
        if (getter == null) {
            throw new RuntimeException('No method called: ' + first + ' defined on ' + target);
        }
        Object newTarget = MethodUtil.invoke(getter, target, new Object[] {});
        return applyGetters(newTarget, rest);
    } catch (Throwable e) {
        throw new RuntimeException('Failed to call method: ' + first + ' on ' + target, e);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.naming.namingutil.CorbalocURL.getIPV6Port(String)

/**
      * Returns an IPV6 Port that is after [<ipv6>]:. There is no validation
      * done here, if it is an incorrect port then the request through
      * this URL results in a COMM_FAILURE, otherwise malformed list will
      * result in BAD_PARAM exception thrown in checkcorbalocGrammer.
      */
private String getIPV6Port(String endpointInfo) {
    int squareBracketEndIndex = endpointInfo.indexOf(']');
    if ((squareBracketEndIndex + 1) != (endpointInfo.length())) {
        if (endpointInfo.charAt(squareBracketEndIndex + 1) != ':') {
            throw new RuntimeException('Host and Port is not separated by ':'');
        }
        return endpointInfo.substring(squareBracketEndIndex + 2);
    }
    return null;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dv.xs.AbstractDateTimeDV.validateDateTime(int[], int[])

/**
     * Validates given date/time object accoring to W3C PR Schema
     * [D.1 ISO 8601 Conventions]
     * @param data
     */
protected void validateDateTime(int[] data, int[] timeZone) {
    if (data[CY] == 0) {
        throw new RuntimeException('The year \'0000\' is an illegal year value');
    }
    if (data[M] < 1 || data[M] > 12) {
        throw new RuntimeException('The month must have values 1 to 12');
    }
    if (data[D] > maxDayInMonthFor(data[CY], data[M]) || data[D] < 1) {
        throw new RuntimeException('The day must have values 1 to 31');
    }
    if (data[h] > 23 || data[h] < 0) {
        if (data[h] == 24 && data[m] == 0 && data[s] == 0 && data[ms] == 0) {
            data[h] = 0;
            if (++data[D] > maxDayInMonthFor(data[CY], data[M])) {
                data[D] = 1;
                if (++data[M] > 12) {
                    data[M] = 1;
                    if (++data[CY] == 0) data[CY] = 1;
                }
            }
        } else {
            throw new RuntimeException('Hour must have values 0-23, unless 24:00:00');
        }
    }
    if (data[m] > 59 || data[m] < 0) {
        throw new RuntimeException('Minute must have values 0-59');
    }
    if (data[s] > 60 || data[s] < 0) {
        throw new RuntimeException('Second must have values 0-60');
    }
    if (timeZone[hh] > 14 || timeZone[hh] < -14) {
        throw new RuntimeException('Time zone should have range -14..+14');
    }
    if (timeZone[mm] > 59 || timeZone[mm] < -59) {
        throw new RuntimeException('Minute must have values 0-59');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.classfile.Signature.matchIdent(MyByteArrayInputStream, StringBuffer)

private static final void matchIdent(MyByteArrayInputStream in, StringBuffer buf) {
    int ch;
    if ((ch = in.read()) == -1) throw new RuntimeException('Illegal signature: ' + in.getData() + ' no ident, reaching EOF');
    if (!identStart(ch)) {
        StringBuffer buf2 = new StringBuffer();
        int count = 1;
        while (Character.isJavaIdentifierPart((char) ch)) {
            buf2.append((char) ch);
            count++;
            ch = in.read();
        }
        if (ch == ':') {
            in.skip('Ljava/lang/Object'.length());
            buf.append(buf2);
            ch = in.read();
            in.unread();
        } else {
            for (int i = 0; i < count; i++) in.unread();
        }
        return;
    }
    StringBuffer buf2 = new StringBuffer();
    ch = in.read();
    do {
        buf2.append((char) ch);
        ch = in.read();
    } while ((ch != -1) && (Character.isJavaIdentifierPart((char) ch) || (ch == '/')));
    buf.append(buf2.toString().replace('/', '.'));
    if (ch != -1) in.unread();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.classfile.Signature.matchGJIdent(MyByteArrayInputStream, StringBuffer)

private static final void matchGJIdent(MyByteArrayInputStream in, StringBuffer buf) {
    int ch;
    matchIdent(in, buf);
    ch = in.read();
    if ((ch == '<') || ch == '(') {
        buf.append((char) ch);
        matchGJIdent(in, buf);
        while (((ch = in.read()) != '>') && (ch != ')')) {
            if (ch == -1) throw new RuntimeException('Illegal signature: ' + in.getData() + ' reaching EOF');
            buf.append(', ');
            in.unread();
            matchGJIdent(in, buf);
        }
        buf.append((char) ch);
    } else in.unread();
    ch = in.read();
    if (identStart(ch)) {
        in.unread();
        matchGJIdent(in, buf);
    } else if (ch == ')') {
        in.unread();
        return;
    } else if (ch != ';') throw new RuntimeException('Illegal signature: ' + in.getData() + ' read ' + (char) ch);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.classfile.StackMapType.setType(byte)

public void setType(byte t) {
    if ((t < Constants.ITEM_Bogus) || (t > Constants.ITEM_NewObject)) throw new RuntimeException('Illegal type for StackMapType: ' + t);
    type = t;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.classfile.Utility.getSignature(String)

/** Parse Java type such as 'char', or 'java.lang.String[]' and return the
   * signature in byte code format, e.g. 'C' or '[Ljava/lang/String;' respectively.
   * @param  type Java type
   * @return byte code signature
   */
public static String getSignature(String type) {
    StringBuffer buf = new StringBuffer();
    char[] chars = type.toCharArray();
    boolean char_found = false, delim = false;
    int index = -1;
    loop: for (int i = 0; i < chars.length; i++) {
        switch(chars[i]) {
            case ' ':
            case '\t':
            case '\n':
            case '\r':
            case '\f':
                if (char_found) delim = true;
                break;
            case '[':
                if (!char_found) throw new RuntimeException('Illegal type: ' + type);
                index = i;
                break loop;
            default:
                char_found = true;
                if (!delim) buf.append(chars[i]);
        }
    }
    int brackets = 0;
    if (index > 0) brackets = countBrackets(type.substring(index));
    type = buf.toString();
    buf.setLength(0);
    for (int i = 0; i < brackets; i++) buf.append('[');
    boolean found = false;
    for (int i = Constants.T_BOOLEAN; (i <= Constants.T_VOID) && !found; i++) {
        if (Constants.TYPE_NAMES[i].equals(type)) {
            found = true;
            buf.append(Constants.SHORT_TYPE_NAMES[i]);
        }
    }
    if (!found) buf.append('L' + type.replace('.', '/') + ';');
    return buf.toString();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.classfile.Utility.countBrackets(String)

private static int countBrackets(String brackets) {
    char[] chars = brackets.toCharArray();
    int count = 0;
    boolean open = false;
    for (int i = 0; i < chars.length; i++) {
        switch(chars[i]) {
            case '[':
                if (open) throw new RuntimeException('Illegally nested brackets:' + brackets);
                open = true;
                break;
            case ']':
                if (!open) throw new RuntimeException('Illegally nested brackets:' + brackets);
                open = false;
                count++;
                break;
            default:
        }
    }
    if (open) throw new RuntimeException('Illegally nested brackets:' + brackets);
    return count;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcFirstPos(CMStateSet)

protected void calcFirstPos(CMStateSet toSet) {
    if (type() == XMLContentSpec.CONTENTSPECNODE_CHOICE) {
        toSet.setTo(fLeftChild.firstPos());
        toSet.union(fRightChild.firstPos());
    } else if (type() == XMLContentSpec.CONTENTSPECNODE_SEQ) {
        toSet.setTo(fLeftChild.firstPos());
        if (fLeftChild.isNullable()) toSet.union(fRightChild.firstPos());
    } else {
        throw new RuntimeException('ImplementationMessages.VAL_BST');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcLastPos(CMStateSet)

protected void calcLastPos(CMStateSet toSet) {
    if (type() == XMLContentSpec.CONTENTSPECNODE_CHOICE) {
        toSet.setTo(fLeftChild.lastPos());
        toSet.union(fRightChild.lastPos());
    } else if (type() == XMLContentSpec.CONTENTSPECNODE_SEQ) {
        toSet.setTo(fRightChild.lastPos());
        if (fRightChild.isNullable()) toSet.union(fLeftChild.lastPos());
    } else {
        throw new RuntimeException('ImplementationMessages.VAL_BST');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.isNullable()

public boolean isNullable() {
    if (type() == XMLContentSpec.CONTENTSPECNODE_CHOICE) return (fLeftChild.isNullable() || fRightChild.isNullable()); else if (type() == XMLContentSpec.CONTENTSPECNODE_SEQ) return (fLeftChild.isNullable() && fRightChild.isNullable()); else throw new RuntimeException('ImplementationMessages.VAL_BST');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xs.models.XSCMBinOp.calcFirstPos(CMStateSet)

protected void calcFirstPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        toSet.setTo(fLeftChild.firstPos());
        toSet.union(fRightChild.firstPos());
    } else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        toSet.setTo(fLeftChild.firstPos());
        if (fLeftChild.isNullable()) toSet.union(fRightChild.firstPos());
    } else {
        throw new RuntimeException('ImplementationMessages.VAL_BST');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xs.models.XSCMBinOp.calcLastPos(CMStateSet)

protected void calcLastPos(CMStateSet toSet) {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) {
        toSet.setTo(fLeftChild.lastPos());
        toSet.union(fRightChild.lastPos());
    } else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        toSet.setTo(fRightChild.lastPos());
        if (fRightChild.isNullable()) toSet.union(fLeftChild.lastPos());
    } else {
        throw new RuntimeException('ImplementationMessages.VAL_BST');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xs.models.XSCMBinOp.isNullable()

public boolean isNullable() {
    if (type() == XSModelGroupImpl.MODELGROUP_CHOICE) return (fLeftChild.isNullable() || fRightChild.isNullable()); else if (type() == XSModelGroupImpl.MODELGROUP_SEQUENCE) return (fLeftChild.isNullable() && fRightChild.isNullable()); else throw new RuntimeException('ImplementationMessages.VAL_BST');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet.getBit(int)

public final boolean getBit(int bitToGet) {
    if (bitToGet >= fBitCount) throw new RuntimeException('ImplementationMessages.VAL_CMSI');
    if (fBitCount < 65) {
        final int mask = (0x1 << (bitToGet % 32));
        if (bitToGet < 32) return (fBits1 & mask) != 0; else return (fBits2 & mask) != 0;
    } else {
        final byte mask = (byte) (0x1 << (bitToGet % 8));
        final int ofs = bitToGet >> 3;
        return ((fByteArray[ofs] & mask) != 0);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet.setBit(int)

public final void setBit(int bitToSet) {
    if (bitToSet >= fBitCount) throw new RuntimeException('ImplementationMessages.VAL_CMSI');
    if (fBitCount < 65) {
        final int mask = (0x1 << (bitToSet % 32));
        if (bitToSet < 32) {
            fBits1 &= ~mask;
            fBits1 |= mask;
        } else {
            fBits2 &= ~mask;
            fBits2 |= mask;
        }
    } else {
        final byte mask = (byte) (0x1 << (bitToSet % 8));
        final int ofs = bitToSet >> 3;
        fByteArray[ofs] &= ~mask;
        fByteArray[ofs] |= mask;
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet.setTo(CMStateSet)

public final void setTo(CMStateSet srcSet) {
    if (fBitCount != srcSet.fBitCount) throw new RuntimeException('ImplementationMessages.VAL_CMSI');
    if (fBitCount < 65) {
        fBits1 = srcSet.fBits1;
        fBits2 = srcSet.fBits2;
    } else {
        for (int index = fByteCount - 1; index >= 0; index--) fByteArray[index] = srcSet.fByteArray[index];
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.buildSyntaxTree(int, XMLContentSpec)

private final CMNode buildSyntaxTree(int startNode, XMLContentSpec contentSpec) {
    CMNode nodeRet = null;
    getContentSpec(startNode, contentSpec);
    if ((contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY) {
        nodeRet = new CMAny(contentSpec.type, (String) contentSpec.otherValue, fLeafCount++);
    } else if ((contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) {
        nodeRet = new CMAny(contentSpec.type, (String) contentSpec.otherValue, fLeafCount++);
    } else if ((contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL) {
        nodeRet = new CMAny(contentSpec.type, null, fLeafCount++);
    } else if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_LEAF) {
        fQName.setValues(null, (String) contentSpec.value, (String) contentSpec.value, (String) contentSpec.otherValue);
        nodeRet = new CMLeaf(fQName, fLeafCount++);
    } else {
        final int leftNode = ((int[]) contentSpec.value)[0];
        final int rightNode = ((int[]) contentSpec.otherValue)[0];
        if ((contentSpec.type == XMLContentSpec.CONTENTSPECNODE_CHOICE) || (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_SEQ)) {
            nodeRet = new CMBinOp(contentSpec.type, buildSyntaxTree(leftNode, contentSpec), buildSyntaxTree(rightNode, contentSpec));
        } else if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE) {
            nodeRet = new CMUniOp(contentSpec.type, buildSyntaxTree(leftNode, contentSpec));
        } else if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE || contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE || contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE) {
            nodeRet = new CMUniOp(contentSpec.type, buildSyntaxTree(leftNode, contentSpec));
        } else {
            throw new RuntimeException('ImplementationMessages.VAL_CST');
        }
    }
    return nodeRet;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.createChildModel(int)

/**
     * When the element has a 'CHILDREN' model, this method is called to
     * create the content model object. It looks for some special case simple
     * models and creates SimpleContentModel objects for those. For the rest
     * it creates the standard DFA style model.
     */
private ContentModelValidator createChildModel(int contentSpecIndex) {
    XMLContentSpec contentSpec = new XMLContentSpec();
    getContentSpec(contentSpecIndex, contentSpec);
    if ((contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY || (contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER || (contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL) {
    } else if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_LEAF) {
        if (contentSpec.value == null && contentSpec.otherValue == null) throw new RuntimeException('ImplementationMessages.VAL_NPCD');
        fQName.setValues(null, (String) contentSpec.value, (String) contentSpec.value, (String) contentSpec.otherValue);
        return new SimpleContentModel(contentSpec.type, fQName, null);
    } else if ((contentSpec.type == XMLContentSpec.CONTENTSPECNODE_CHOICE) || (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_SEQ)) {
        XMLContentSpec contentSpecLeft = new XMLContentSpec();
        XMLContentSpec contentSpecRight = new XMLContentSpec();
        getContentSpec(((int[]) contentSpec.value)[0], contentSpecLeft);
        getContentSpec(((int[]) contentSpec.otherValue)[0], contentSpecRight);
        if ((contentSpecLeft.type == XMLContentSpec.CONTENTSPECNODE_LEAF) && (contentSpecRight.type == XMLContentSpec.CONTENTSPECNODE_LEAF)) {
            fQName.setValues(null, (String) contentSpecLeft.value, (String) contentSpecLeft.value, (String) contentSpecLeft.otherValue);
            fQName2.setValues(null, (String) contentSpecRight.value, (String) contentSpecRight.value, (String) contentSpecRight.otherValue);
            return new SimpleContentModel(contentSpec.type, fQName, fQName2);
        }
    } else if ((contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE) || (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE) || (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE)) {
        XMLContentSpec contentSpecLeft = new XMLContentSpec();
        getContentSpec(((int[]) contentSpec.value)[0], contentSpecLeft);
        if (contentSpecLeft.type == XMLContentSpec.CONTENTSPECNODE_LEAF) {
            fQName.setValues(null, (String) contentSpecLeft.value, (String) contentSpecLeft.value, (String) contentSpecLeft.otherValue);
            return new SimpleContentModel(contentSpec.type, fQName, null);
        }
    } else {
        throw new RuntimeException('ImplementationMessages.VAL_CST');
    }
    fLeafCount = 0;
    fLeafCount = 0;
    CMNode cmn = buildSyntaxTree(contentSpecIndex, contentSpec);
    return new DFAContentModel(cmn, fLeafCount, false);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.models.SimpleContentModel.validate(QName[], int, int)

/**
     * Check that the specified content is valid according to this
     * content model. This method can also be called to do 'what if' 
     * testing of content models just to see if they would be valid.
     * A value of -1 in the children array indicates a PCDATA node. All other 
     * indexes will be positive and represent child elements. The count can be
     * zero, since some elements have the EMPTY content model and that must be 
     * confirmed.
     * @param children The children of this element.  Each integer is an index within
     *                 the <code>StringPool</code> of the child element name.  An index
     *                 of -1 is used to indicate an occurrence of non-whitespace character
     *                 data.
     * @param offset Offset into the array where the children starts.
     * @param length The number of entries in the <code>children</code> array.
     * @return The value -1 if fully valid, else the 0 based index of the child
     *         that first failed. If the value returned is equal to the number
     *         of children, then the specified children are valid but additional
     *         content is required to reach a valid ending state.
     */
public int validate(QName[] children, int offset, int length) {
    switch(fOperator) {
        case XMLContentSpec.CONTENTSPECNODE_LEAF:
            if (length == 0) return 0;
            if (children[offset].rawname != fFirstChild.rawname) {
                return 0;
            }
            if (length > 1) return 1;
            break;
        case XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE:
            if (length == 1) {
                if (children[offset].rawname != fFirstChild.rawname) {
                    return 0;
                }
            }
            if (length > 1) return 1;
            break;
        case XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE:
            if (length > 0) {
                for (int index = 0; index < length; index++) {
                    if (children[offset + index].rawname != fFirstChild.rawname) {
                        return index;
                    }
                }
            }
            break;
        case XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE:
            if (length == 0) return 0;
            for (int index = 0; index < length; index++) {
                if (children[offset + index].rawname != fFirstChild.rawname) {
                    return index;
                }
            }
            break;
        case XMLContentSpec.CONTENTSPECNODE_CHOICE:
            if (length == 0) return 0;
            if ((children[offset].rawname != fFirstChild.rawname) && (children[offset].rawname != fSecondChild.rawname)) {
                return 0;
            }
            if (length > 1) return 1;
            break;
        case XMLContentSpec.CONTENTSPECNODE_SEQ:
            if (length == 2) {
                if (children[offset].rawname != fFirstChild.rawname) {
                    return 0;
                }
                if (children[offset + 1].rawname != fSecondChild.rawname) {
                    return 1;
                }
            } else {
                if (length > 2) {
                    return 2;
                }
                return length;
            }
            break;
        default:
            throw new RuntimeException('ImplementationMessages.VAL_CST');
    }
    return -1;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel.dumpTree(CMNode, int)

/**
     * Dumps the tree of the current node to standard output.
     * @param nodeCur The current node.
     * @param level   The maximum levels to output.
     * @exception CMException Thrown on error.
     */
private void dumpTree(CMNode nodeCur, int level) {
    for (int index = 0; index < level; index++) System.out.print('   ');
    int type = nodeCur.type();
    if ((type == XMLContentSpec.CONTENTSPECNODE_CHOICE) || (type == XMLContentSpec.CONTENTSPECNODE_SEQ)) {
        if (type == XMLContentSpec.CONTENTSPECNODE_CHOICE) System.out.print('Choice Node '); else System.out.print('Seq Node ');
        if (nodeCur.isNullable()) System.out.print('Nullable ');
        System.out.print('firstPos=');
        System.out.print(nodeCur.firstPos().toString());
        System.out.print(' lastPos=');
        System.out.println(nodeCur.lastPos().toString());
        dumpTree(((CMBinOp) nodeCur).getLeft(), level + 1);
        dumpTree(((CMBinOp) nodeCur).getRight(), level + 1);
    } else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE) {
        System.out.print('Rep Node ');
        if (nodeCur.isNullable()) System.out.print('Nullable ');
        System.out.print('firstPos=');
        System.out.print(nodeCur.firstPos().toString());
        System.out.print(' lastPos=');
        System.out.println(nodeCur.lastPos().toString());
        dumpTree(((CMUniOp) nodeCur).getChild(), level + 1);
    } else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_LEAF) {
        System.out.print('Leaf: (pos=' + ((CMLeaf) nodeCur).getPosition() + '), ' + ((CMLeaf) nodeCur).getElement() + '(elemIndex=' + ((CMLeaf) nodeCur).getElement() + ') ');
        if (nodeCur.isNullable()) System.out.print(' Nullable ');
        System.out.print('firstPos=');
        System.out.print(nodeCur.firstPos().toString());
        System.out.print(' lastPos=');
        System.out.println(nodeCur.lastPos().toString());
    } else {
        throw new RuntimeException('ImplementationMessages.VAL_NIICM');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xs.models.XSDFACM.dumpTree(CMNode, int)

/**
     * Dumps the tree of the current node to standard output.
     * @param nodeCur The current node.
     * @param level   The maximum levels to output.
     * @exception RuntimeException Thrown on error.
     */
private void dumpTree(CMNode nodeCur, int level) {
    for (int index = 0; index < level; index++) System.out.print('   ');
    int type = nodeCur.type();
    switch(type) {
        case XSModelGroupImpl.MODELGROUP_CHOICE:
        case XSModelGroupImpl.MODELGROUP_SEQUENCE:
            {
                if (type == XSModelGroupImpl.MODELGROUP_CHOICE) System.out.print('Choice Node '); else System.out.print('Seq Node ');
                if (nodeCur.isNullable()) System.out.print('Nullable ');
                System.out.print('firstPos=');
                System.out.print(nodeCur.firstPos().toString());
                System.out.print(' lastPos=');
                System.out.println(nodeCur.lastPos().toString());
                dumpTree(((XSCMBinOp) nodeCur).getLeft(), level + 1);
                dumpTree(((XSCMBinOp) nodeCur).getRight(), level + 1);
                break;
            }
        case XSParticleDecl.PARTICLE_ZERO_OR_MORE:
        case XSParticleDecl.PARTICLE_ONE_OR_MORE:
        case XSParticleDecl.PARTICLE_ZERO_OR_ONE:
            {
                System.out.print('Rep Node ');
                if (nodeCur.isNullable()) System.out.print('Nullable ');
                System.out.print('firstPos=');
                System.out.print(nodeCur.firstPos().toString());
                System.out.print(' lastPos=');
                System.out.println(nodeCur.lastPos().toString());
                dumpTree(((XSCMUniOp) nodeCur).getChild(), level + 1);
                break;
            }
        case XSParticleDecl.PARTICLE_ELEMENT:
            {
                System.out.print('Leaf: (pos=' + ((XSCMLeaf) nodeCur).getPosition() + '), ' + '(elemIndex=' + ((XSCMLeaf) nodeCur).getLeaf() + ') ');
                if (nodeCur.isNullable()) System.out.print(' Nullable ');
                System.out.print('firstPos=');
                System.out.print(nodeCur.firstPos().toString());
                System.out.print(' lastPos=');
                System.out.println(nodeCur.lastPos().toString());
                break;
            }
        case XSParticleDecl.PARTICLE_WILDCARD:
            System.out.print('Any Node: ');
            System.out.print('firstPos=');
            System.out.print(nodeCur.firstPos().toString());
            System.out.print(' lastPos=');
            System.out.println(nodeCur.lastPos().toString());
            break;
        default:
            {
                throw new RuntimeException('ImplementationMessages.VAL_NIICM');
            }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xs.models.XSDFACM.postTreeBuildInit(CMNode)

/** Post tree build initialization. */
private void postTreeBuildInit(CMNode nodeCur) throws RuntimeException {
    nodeCur.setMaxStates(fLeafCount);
    XSCMLeaf leaf = null;
    int pos = 0;
    if (nodeCur.type() == XSParticleDecl.PARTICLE_WILDCARD) {
        leaf = (XSCMLeaf) nodeCur;
        pos = leaf.getPosition();
        fLeafList[pos] = leaf;
        fLeafListType[pos] = XSParticleDecl.PARTICLE_WILDCARD;
    } else if ((nodeCur.type() == XSModelGroupImpl.MODELGROUP_CHOICE) || (nodeCur.type() == XSModelGroupImpl.MODELGROUP_SEQUENCE)) {
        postTreeBuildInit(((XSCMBinOp) nodeCur).getLeft());
        postTreeBuildInit(((XSCMBinOp) nodeCur).getRight());
    } else if (nodeCur.type() == XSParticleDecl.PARTICLE_ZERO_OR_MORE || nodeCur.type() == XSParticleDecl.PARTICLE_ONE_OR_MORE || nodeCur.type() == XSParticleDecl.PARTICLE_ZERO_OR_ONE) {
        postTreeBuildInit(((XSCMUniOp) nodeCur).getChild());
    } else if (nodeCur.type() == XSParticleDecl.PARTICLE_ELEMENT) {
        leaf = (XSCMLeaf) nodeCur;
        pos = leaf.getPosition();
        fLeafList[pos] = leaf;
        fLeafListType[pos] = XSParticleDecl.PARTICLE_ELEMENT;
    } else {
        throw new RuntimeException('ImplementationMessages.VAL_NIICM');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel.postTreeBuildInit(CMNode, int)

/** Post tree build initialization. */
private int postTreeBuildInit(CMNode nodeCur, int curIndex) {
    nodeCur.setMaxStates(fLeafCount);
    if ((nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY || (nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL || (nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) {
        QName qname = new QName(null, null, null, ((CMAny) nodeCur).getURI());
        fLeafList[curIndex] = new CMLeaf(qname, ((CMAny) nodeCur).getPosition());
        fLeafListType[curIndex] = nodeCur.type();
        curIndex++;
    } else if ((nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_CHOICE) || (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_SEQ)) {
        curIndex = postTreeBuildInit(((CMBinOp) nodeCur).getLeft(), curIndex);
        curIndex = postTreeBuildInit(((CMBinOp) nodeCur).getRight(), curIndex);
    } else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE || nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE || nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE) {
        curIndex = postTreeBuildInit(((CMUniOp) nodeCur).getChild(), curIndex);
    } else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_LEAF) {
        final QName node = ((CMLeaf) nodeCur).getElement();
        if (node.localpart != fEpsilonString) {
            fLeafList[curIndex] = (CMLeaf) nodeCur;
            fLeafListType[curIndex] = XMLContentSpec.CONTENTSPECNODE_LEAF;
            curIndex++;
        }
    } else {
        throw new RuntimeException('ImplementationMessages.VAL_NIICM: type=' + nodeCur.type());
    }
    return curIndex;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RegexParser.setLocale(Locale)

public void setLocale(Locale locale) {
    try {
        this.resources = ResourceBundle.getBundle('com.sun.org.apache.xerces.internal.impl.xpath.regex.message', locale);
    } catch (MissingResourceException mre) {
        throw new RuntimeException('Installation Problem???  Couldn't load messages: ' + mre.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.util.InstructionFinder.mapName(String)

/**
   * Map symbolic instruction names like 'getfield' to a single character.
   * @param pattern instruction pattern in lower case
   * @return encoded string for a pattern such as 'BranchInstruction'.
   */
private static final String mapName(String pattern) {
    String result = (String) map.get(pattern);
    if (result != null) return result;
    for (short i = 0; i < NO_OPCODES; i++) if (pattern.equals(Constants.OPCODE_NAMES[i])) return '' + makeChar(i);
    throw new RuntimeException('Instruction unknown: ' + pattern);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.isShorterThan(Token)

private final boolean isShorterThan(Token tok) {
    if (tok == null) return false;
    int mylength;
    if (this.type == STRING) mylength = this.getString().length(); else throw new RuntimeException('Internal Error: Illegal type: ' + this.type);
    int otherlength;
    if (tok.type == STRING) otherlength = tok.getString().length(); else throw new RuntimeException('Internal Error: Illegal type: ' + tok.type);
    return mylength < otherlength;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchCharArray(Context, Op, int, int, int)

/**
 * @return -1 when not match; offset of the end of matched string when match.
 */
private int matchCharArray(Context con, Op op, int offset, int dx, int opts) {
    char[] target = con.charTarget;
    while (true) {
        if (op == null) return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset;
        if (offset > con.limit || offset < con.start) return -1;
        switch(op.type) {
            case Op.CHAR:
                if (isSet(opts, IGNORE_CASE)) {
                    int ch = op.getData();
                    if (dx > 0) {
                        if (offset >= con.limit || !matchIgnoreCase(ch, target[offset])) return -1;
                        offset++;
                    } else {
                        int o1 = offset - 1;
                        if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target[o1])) return -1;
                        offset = o1;
                    }
                } else {
                    int ch = op.getData();
                    if (dx > 0) {
                        if (offset >= con.limit || ch != target[offset]) return -1;
                        offset++;
                    } else {
                        int o1 = offset - 1;
                        if (o1 >= con.limit || o1 < 0 || ch != target[o1]) return -1;
                        offset = o1;
                    }
                }
                op = op.next;
                break;
            case Op.DOT:
                if (dx > 0) {
                    if (offset >= con.limit) return -1;
                    int ch = target[offset];
                    if (isSet(opts, SINGLE_LINE)) {
                        if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) offset++;
                    } else {
                        if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target[++offset]);
                        if (isEOLChar(ch)) return -1;
                    }
                    offset++;
                } else {
                    int o1 = offset - 1;
                    if (o1 >= con.limit || o1 < 0) return -1;
                    int ch = target[o1];
                    if (isSet(opts, SINGLE_LINE)) {
                        if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) o1--;
                    } else {
                        if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) ch = REUtil.composeFromSurrogates(target[--o1], ch);
                        if (!isEOLChar(ch)) return -1;
                    }
                    offset = o1;
                }
                op = op.next;
                break;
            case Op.RANGE:
            case Op.NRANGE:
                if (dx > 0) {
                    if (offset >= con.limit) return -1;
                    int ch = target[offset];
                    if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target[++offset]);
                    RangeToken tok = op.getToken();
                    if (isSet(opts, IGNORE_CASE)) {
                        tok = tok.getCaseInsensitiveToken();
                        if (!tok.match(ch)) {
                            if (ch >= 0x10000) return -1;
                            char uch;
                            if (!tok.match(uch = Character.toUpperCase((char) ch)) && !tok.match(Character.toLowerCase(uch))) return -1;
                        }
                    } else {
                        if (!tok.match(ch)) return -1;
                    }
                    offset++;
                } else {
                    int o1 = offset - 1;
                    if (o1 >= con.limit || o1 < 0) return -1;
                    int ch = target[o1];
                    if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) ch = REUtil.composeFromSurrogates(target[--o1], ch);
                    RangeToken tok = op.getToken();
                    if (isSet(opts, IGNORE_CASE)) {
                        tok = tok.getCaseInsensitiveToken();
                        if (!tok.match(ch)) {
                            if (ch >= 0x10000) return -1;
                            char uch;
                            if (!tok.match(uch = Character.toUpperCase((char) ch)) && !tok.match(Character.toLowerCase(uch))) return -1;
                        }
                    } else {
                        if (!tok.match(ch)) return -1;
                    }
                    offset = o1;
                }
                op = op.next;
                break;
            case Op.ANCHOR:
                boolean go = false;
                switch(op.getData()) {
                    case '^':
                        if (isSet(opts, MULTIPLE_LINES)) {
                            if (!(offset == con.start || offset > con.start && isEOLChar(target[offset - 1]))) return -1;
                        } else {
                            if (offset != con.start) return -1;
                        }
                        break;
                    case '@':
                        if (!(offset == con.start || offset > con.start && isEOLChar(target[offset - 1]))) return -1;
                        break;
                    case '$':
                        if (isSet(opts, MULTIPLE_LINES)) {
                            if (!(offset == con.limit || offset < con.limit && isEOLChar(target[offset]))) return -1;
                        } else {
                            if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target[offset]) || offset + 2 == con.limit && target[offset] == CARRIAGE_RETURN && target[offset + 1] == LINE_FEED)) return -1;
                        }
                        break;
                    case 'A':
                        if (offset != con.start) return -1;
                        break;
                    case 'Z':
                        if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target[offset]) || offset + 2 == con.limit && target[offset] == CARRIAGE_RETURN && target[offset + 1] == LINE_FEED)) return -1;
                        break;
                    case 'z':
                        if (offset != con.limit) return -1;
                        break;
                    case 'b':
                        if (con.length == 0) return -1;
                        {
                            int after = getWordType(target, con.start, con.limit, offset, opts);
                            if (after == WT_IGNORE) return -1;
                            int before = getPreviousWordType(target, con.start, con.limit, offset, opts);
                            if (after == before) return -1;
                        }
                        break;
                    case 'B':
                        if (con.length == 0) go = true; else {
                            int after = getWordType(target, con.start, con.limit, offset, opts);
                            go = after == WT_IGNORE || after == getPreviousWordType(target, con.start, con.limit, offset, opts);
                        }
                        if (!go) return -1;
                        break;
                    case '<':
                        if (con.length == 0 || offset == con.limit) return -1;
                        if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) return -1;
                        break;
                    case '>':
                        if (con.length == 0 || offset == con.start) return -1;
                        if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) return -1;
                        break;
                }
                op = op.next;
                break;
            case Op.BACKREFERENCE:
                {
                    int refno = op.getData();
                    if (refno <= 0 || refno >= this.nofparen) throw new RuntimeException('Internal Error: Reference number must be more than zero: ' + refno);
                    if (con.match.getBeginning(refno) < 0 || con.match.getEnd(refno) < 0) return -1;
                    int o2 = con.match.getBeginning(refno);
                    int literallen = con.match.getEnd(refno) - o2;
                    if (!isSet(opts, IGNORE_CASE)) {
                        if (dx > 0) {
                            if (!regionMatches(target, offset, con.limit, o2, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatches(target, offset - literallen, con.limit, o2, literallen)) return -1;
                            offset -= literallen;
                        }
                    } else {
                        if (dx > 0) {
                            if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, o2, literallen)) return -1;
                            offset -= literallen;
                        }
                    }
                }
                op = op.next;
                break;
            case Op.STRING:
                {
                    String literal = op.getString();
                    int literallen = literal.length();
                    if (!isSet(opts, IGNORE_CASE)) {
                        if (dx > 0) {
                            if (!regionMatches(target, offset, con.limit, literal, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatches(target, offset - literallen, con.limit, literal, literallen)) return -1;
                            offset -= literallen;
                        }
                    } else {
                        if (dx > 0) {
                            if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, literal, literallen)) return -1;
                            offset -= literallen;
                        }
                    }
                }
                op = op.next;
                break;
            case Op.CLOSURE:
                {
                    int id = op.getData();
                    if (id >= 0) {
                        int previousOffset = con.offsets[id];
                        if (previousOffset < 0 || previousOffset != offset) {
                            con.offsets[id] = offset;
                        } else {
                            con.offsets[id] = -1;
                            op = op.next;
                            break;
                        }
                    }
                    int ret = this.matchCharArray(con, op.getChild(), offset, dx, opts);
                    if (id >= 0) con.offsets[id] = -1;
                    if (ret >= 0) return ret;
                    op = op.next;
                }
                break;
            case Op.QUESTION:
                {
                    int ret = this.matchCharArray(con, op.getChild(), offset, dx, opts);
                    if (ret >= 0) return ret;
                    op = op.next;
                }
                break;
            case Op.NONGREEDYCLOSURE:
            case Op.NONGREEDYQUESTION:
                {
                    int ret = this.matchCharArray(con, op.next, offset, dx, opts);
                    if (ret >= 0) return ret;
                    op = op.getChild();
                }
                break;
            case Op.UNION:
                for (int i = 0; i < op.size(); i++) {
                    int ret = this.matchCharArray(con, op.elementAt(i), offset, dx, opts);
                    if (DEBUG) {
                        System.err.println('UNION: ' + i + ', ret=' + ret);
                    }
                    if (ret >= 0) return ret;
                }
                return -1;
            case Op.CAPTURE:
                int refno = op.getData();
                if (con.match != null && refno > 0) {
                    int save = con.match.getBeginning(refno);
                    con.match.setBeginning(refno, offset);
                    int ret = this.matchCharArray(con, op.next, offset, dx, opts);
                    if (ret < 0) con.match.setBeginning(refno, save);
                    return ret;
                } else if (con.match != null && refno < 0) {
                    int index = -refno;
                    int save = con.match.getEnd(index);
                    con.match.setEnd(index, offset);
                    int ret = this.matchCharArray(con, op.next, offset, dx, opts);
                    if (ret < 0) con.match.setEnd(index, save);
                    return ret;
                }
                op = op.next;
                break;
            case Op.LOOKAHEAD:
                if (0 > this.matchCharArray(con, op.getChild(), offset, 1, opts)) return -1;
                op = op.next;
                break;
            case Op.NEGATIVELOOKAHEAD:
                if (0 <= this.matchCharArray(con, op.getChild(), offset, 1, opts)) return -1;
                op = op.next;
                break;
            case Op.LOOKBEHIND:
                if (0 > this.matchCharArray(con, op.getChild(), offset, -1, opts)) return -1;
                op = op.next;
                break;
            case Op.NEGATIVELOOKBEHIND:
                if (0 <= this.matchCharArray(con, op.getChild(), offset, -1, opts)) return -1;
                op = op.next;
                break;
            case Op.INDEPENDENT:
                {
                    int ret = this.matchCharArray(con, op.getChild(), offset, dx, opts);
                    if (ret < 0) return ret;
                    offset = ret;
                    op = op.next;
                }
                break;
            case Op.MODIFIER:
                {
                    int localopts = opts;
                    localopts |= op.getData();
                    localopts &= ~op.getData2();
                    int ret = this.matchCharArray(con, op.getChild(), offset, dx, localopts);
                    if (ret < 0) return ret;
                    offset = ret;
                    op = op.next;
                }
                break;
            case Op.CONDITION:
                {
                    Op.ConditionOp cop = (Op.ConditionOp) op;
                    boolean matchp = false;
                    if (cop.refNumber > 0) {
                        if (cop.refNumber >= this.nofparen) throw new RuntimeException('Internal Error: Reference number must be more than zero: ' + cop.refNumber);
                        matchp = con.match.getBeginning(cop.refNumber) >= 0 && con.match.getEnd(cop.refNumber) >= 0;
                    } else {
                        matchp = 0 <= this.matchCharArray(con, cop.condition, offset, dx, opts);
                    }
                    if (matchp) {
                        op = cop.yes;
                    } else if (cop.no != null) {
                        op = cop.no;
                    } else {
                        op = cop.next;
                    }
                }
                break;
            default:
                throw new RuntimeException('Unknown operation type: ' + op.type);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchCharacterIterator(Context, Op, int, int, int)

/**
     * @return -1 when not match; offset of the end of matched string when match.
     */
private int matchCharacterIterator(Context con, Op op, int offset, int dx, int opts) {
    CharacterIterator target = con.ciTarget;
    while (true) {
        if (op == null) return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset;
        if (offset > con.limit || offset < con.start) return -1;
        switch(op.type) {
            case Op.CHAR:
                if (isSet(opts, IGNORE_CASE)) {
                    int ch = op.getData();
                    if (dx > 0) {
                        if (offset >= con.limit || !matchIgnoreCase(ch, target.setIndex(offset))) return -1;
                        offset++;
                    } else {
                        int o1 = offset - 1;
                        if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target.setIndex(o1))) return -1;
                        offset = o1;
                    }
                } else {
                    int ch = op.getData();
                    if (dx > 0) {
                        if (offset >= con.limit || ch != target.setIndex(offset)) return -1;
                        offset++;
                    } else {
                        int o1 = offset - 1;
                        if (o1 >= con.limit || o1 < 0 || ch != target.setIndex(o1)) return -1;
                        offset = o1;
                    }
                }
                op = op.next;
                break;
            case Op.DOT:
                if (dx > 0) {
                    if (offset >= con.limit) return -1;
                    int ch = target.setIndex(offset);
                    if (isSet(opts, SINGLE_LINE)) {
                        if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) offset++;
                    } else {
                        if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target.setIndex(++offset));
                        if (isEOLChar(ch)) return -1;
                    }
                    offset++;
                } else {
                    int o1 = offset - 1;
                    if (o1 >= con.limit || o1 < 0) return -1;
                    int ch = target.setIndex(o1);
                    if (isSet(opts, SINGLE_LINE)) {
                        if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) o1--;
                    } else {
                        if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) ch = REUtil.composeFromSurrogates(target.setIndex(--o1), ch);
                        if (!isEOLChar(ch)) return -1;
                    }
                    offset = o1;
                }
                op = op.next;
                break;
            case Op.RANGE:
            case Op.NRANGE:
                if (dx > 0) {
                    if (offset >= con.limit) return -1;
                    int ch = target.setIndex(offset);
                    if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target.setIndex(++offset));
                    RangeToken tok = op.getToken();
                    if (isSet(opts, IGNORE_CASE)) {
                        tok = tok.getCaseInsensitiveToken();
                        if (!tok.match(ch)) {
                            if (ch >= 0x10000) return -1;
                            char uch;
                            if (!tok.match(uch = Character.toUpperCase((char) ch)) && !tok.match(Character.toLowerCase(uch))) return -1;
                        }
                    } else {
                        if (!tok.match(ch)) return -1;
                    }
                    offset++;
                } else {
                    int o1 = offset - 1;
                    if (o1 >= con.limit || o1 < 0) return -1;
                    int ch = target.setIndex(o1);
                    if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) ch = REUtil.composeFromSurrogates(target.setIndex(--o1), ch);
                    RangeToken tok = op.getToken();
                    if (isSet(opts, IGNORE_CASE)) {
                        tok = tok.getCaseInsensitiveToken();
                        if (!tok.match(ch)) {
                            if (ch >= 0x10000) return -1;
                            char uch;
                            if (!tok.match(uch = Character.toUpperCase((char) ch)) && !tok.match(Character.toLowerCase(uch))) return -1;
                        }
                    } else {
                        if (!tok.match(ch)) return -1;
                    }
                    offset = o1;
                }
                op = op.next;
                break;
            case Op.ANCHOR:
                boolean go = false;
                switch(op.getData()) {
                    case '^':
                        if (isSet(opts, MULTIPLE_LINES)) {
                            if (!(offset == con.start || offset > con.start && isEOLChar(target.setIndex(offset - 1)))) return -1;
                        } else {
                            if (offset != con.start) return -1;
                        }
                        break;
                    case '@':
                        if (!(offset == con.start || offset > con.start && isEOLChar(target.setIndex(offset - 1)))) return -1;
                        break;
                    case '$':
                        if (isSet(opts, MULTIPLE_LINES)) {
                            if (!(offset == con.limit || offset < con.limit && isEOLChar(target.setIndex(offset)))) return -1;
                        } else {
                            if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target.setIndex(offset)) || offset + 2 == con.limit && target.setIndex(offset) == CARRIAGE_RETURN && target.setIndex(offset + 1) == LINE_FEED)) return -1;
                        }
                        break;
                    case 'A':
                        if (offset != con.start) return -1;
                        break;
                    case 'Z':
                        if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target.setIndex(offset)) || offset + 2 == con.limit && target.setIndex(offset) == CARRIAGE_RETURN && target.setIndex(offset + 1) == LINE_FEED)) return -1;
                        break;
                    case 'z':
                        if (offset != con.limit) return -1;
                        break;
                    case 'b':
                        if (con.length == 0) return -1;
                        {
                            int after = getWordType(target, con.start, con.limit, offset, opts);
                            if (after == WT_IGNORE) return -1;
                            int before = getPreviousWordType(target, con.start, con.limit, offset, opts);
                            if (after == before) return -1;
                        }
                        break;
                    case 'B':
                        if (con.length == 0) go = true; else {
                            int after = getWordType(target, con.start, con.limit, offset, opts);
                            go = after == WT_IGNORE || after == getPreviousWordType(target, con.start, con.limit, offset, opts);
                        }
                        if (!go) return -1;
                        break;
                    case '<':
                        if (con.length == 0 || offset == con.limit) return -1;
                        if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) return -1;
                        break;
                    case '>':
                        if (con.length == 0 || offset == con.start) return -1;
                        if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) return -1;
                        break;
                }
                op = op.next;
                break;
            case Op.BACKREFERENCE:
                {
                    int refno = op.getData();
                    if (refno <= 0 || refno >= this.nofparen) throw new RuntimeException('Internal Error: Reference number must be more than zero: ' + refno);
                    if (con.match.getBeginning(refno) < 0 || con.match.getEnd(refno) < 0) return -1;
                    int o2 = con.match.getBeginning(refno);
                    int literallen = con.match.getEnd(refno) - o2;
                    if (!isSet(opts, IGNORE_CASE)) {
                        if (dx > 0) {
                            if (!regionMatches(target, offset, con.limit, o2, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatches(target, offset - literallen, con.limit, o2, literallen)) return -1;
                            offset -= literallen;
                        }
                    } else {
                        if (dx > 0) {
                            if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, o2, literallen)) return -1;
                            offset -= literallen;
                        }
                    }
                }
                op = op.next;
                break;
            case Op.STRING:
                {
                    String literal = op.getString();
                    int literallen = literal.length();
                    if (!isSet(opts, IGNORE_CASE)) {
                        if (dx > 0) {
                            if (!regionMatches(target, offset, con.limit, literal, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatches(target, offset - literallen, con.limit, literal, literallen)) return -1;
                            offset -= literallen;
                        }
                    } else {
                        if (dx > 0) {
                            if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, literal, literallen)) return -1;
                            offset -= literallen;
                        }
                    }
                }
                op = op.next;
                break;
            case Op.CLOSURE:
                {
                    int id = op.getData();
                    if (id >= 0) {
                        int previousOffset = con.offsets[id];
                        if (previousOffset < 0 || previousOffset != offset) {
                            con.offsets[id] = offset;
                        } else {
                            con.offsets[id] = -1;
                            op = op.next;
                            break;
                        }
                    }
                    int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, opts);
                    if (id >= 0) con.offsets[id] = -1;
                    if (ret >= 0) return ret;
                    op = op.next;
                }
                break;
            case Op.QUESTION:
                {
                    int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, opts);
                    if (ret >= 0) return ret;
                    op = op.next;
                }
                break;
            case Op.NONGREEDYCLOSURE:
            case Op.NONGREEDYQUESTION:
                {
                    int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts);
                    if (ret >= 0) return ret;
                    op = op.getChild();
                }
                break;
            case Op.UNION:
                for (int i = 0; i < op.size(); i++) {
                    int ret = this.matchCharacterIterator(con, op.elementAt(i), offset, dx, opts);
                    if (DEBUG) {
                        System.err.println('UNION: ' + i + ', ret=' + ret);
                    }
                    if (ret >= 0) return ret;
                }
                return -1;
            case Op.CAPTURE:
                int refno = op.getData();
                if (con.match != null && refno > 0) {
                    int save = con.match.getBeginning(refno);
                    con.match.setBeginning(refno, offset);
                    int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts);
                    if (ret < 0) con.match.setBeginning(refno, save);
                    return ret;
                } else if (con.match != null && refno < 0) {
                    int index = -refno;
                    int save = con.match.getEnd(index);
                    con.match.setEnd(index, offset);
                    int ret = this.matchCharacterIterator(con, op.next, offset, dx, opts);
                    if (ret < 0) con.match.setEnd(index, save);
                    return ret;
                }
                op = op.next;
                break;
            case Op.LOOKAHEAD:
                if (0 > this.matchCharacterIterator(con, op.getChild(), offset, 1, opts)) return -1;
                op = op.next;
                break;
            case Op.NEGATIVELOOKAHEAD:
                if (0 <= this.matchCharacterIterator(con, op.getChild(), offset, 1, opts)) return -1;
                op = op.next;
                break;
            case Op.LOOKBEHIND:
                if (0 > this.matchCharacterIterator(con, op.getChild(), offset, -1, opts)) return -1;
                op = op.next;
                break;
            case Op.NEGATIVELOOKBEHIND:
                if (0 <= this.matchCharacterIterator(con, op.getChild(), offset, -1, opts)) return -1;
                op = op.next;
                break;
            case Op.INDEPENDENT:
                {
                    int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, opts);
                    if (ret < 0) return ret;
                    offset = ret;
                    op = op.next;
                }
                break;
            case Op.MODIFIER:
                {
                    int localopts = opts;
                    localopts |= op.getData();
                    localopts &= ~op.getData2();
                    int ret = this.matchCharacterIterator(con, op.getChild(), offset, dx, localopts);
                    if (ret < 0) return ret;
                    offset = ret;
                    op = op.next;
                }
                break;
            case Op.CONDITION:
                {
                    Op.ConditionOp cop = (Op.ConditionOp) op;
                    boolean matchp = false;
                    if (cop.refNumber > 0) {
                        if (cop.refNumber >= this.nofparen) throw new RuntimeException('Internal Error: Reference number must be more than zero: ' + cop.refNumber);
                        matchp = con.match.getBeginning(cop.refNumber) >= 0 && con.match.getEnd(cop.refNumber) >= 0;
                    } else {
                        matchp = 0 <= this.matchCharacterIterator(con, cop.condition, offset, dx, opts);
                    }
                    if (matchp) {
                        op = cop.yes;
                    } else if (cop.no != null) {
                        op = cop.no;
                    } else {
                        op = cop.next;
                    }
                }
                break;
            default:
                throw new RuntimeException('Unknown operation type: ' + op.type);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.matchString(Context, Op, int, int, int)

/**
     * @return -1 when not match; offset of the end of matched string when match.
     */
private int matchString(Context con, Op op, int offset, int dx, int opts) {
    String target = con.strTarget;
    while (true) {
        if (op == null) return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1 : offset;
        if (offset > con.limit || offset < con.start) return -1;
        switch(op.type) {
            case Op.CHAR:
                if (isSet(opts, IGNORE_CASE)) {
                    int ch = op.getData();
                    if (dx > 0) {
                        if (offset >= con.limit || !matchIgnoreCase(ch, target.charAt(offset))) return -1;
                        offset++;
                    } else {
                        int o1 = offset - 1;
                        if (o1 >= con.limit || o1 < 0 || !matchIgnoreCase(ch, target.charAt(o1))) return -1;
                        offset = o1;
                    }
                } else {
                    int ch = op.getData();
                    if (dx > 0) {
                        if (offset >= con.limit || ch != target.charAt(offset)) return -1;
                        offset++;
                    } else {
                        int o1 = offset - 1;
                        if (o1 >= con.limit || o1 < 0 || ch != target.charAt(o1)) return -1;
                        offset = o1;
                    }
                }
                op = op.next;
                break;
            case Op.DOT:
                if (dx > 0) {
                    if (offset >= con.limit) return -1;
                    int ch = target.charAt(offset);
                    if (isSet(opts, SINGLE_LINE)) {
                        if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) offset++;
                    } else {
                        if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target.charAt(++offset));
                        if (isEOLChar(ch)) return -1;
                    }
                    offset++;
                } else {
                    int o1 = offset - 1;
                    if (o1 >= con.limit || o1 < 0) return -1;
                    int ch = target.charAt(o1);
                    if (isSet(opts, SINGLE_LINE)) {
                        if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) o1--;
                    } else {
                        if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) ch = REUtil.composeFromSurrogates(target.charAt(--o1), ch);
                        if (!isEOLChar(ch)) return -1;
                    }
                    offset = o1;
                }
                op = op.next;
                break;
            case Op.RANGE:
            case Op.NRANGE:
                if (dx > 0) {
                    if (offset >= con.limit) return -1;
                    int ch = target.charAt(offset);
                    if (REUtil.isHighSurrogate(ch) && offset + 1 < con.limit) ch = REUtil.composeFromSurrogates(ch, target.charAt(++offset));
                    RangeToken tok = op.getToken();
                    if (isSet(opts, IGNORE_CASE)) {
                        tok = tok.getCaseInsensitiveToken();
                        if (!tok.match(ch)) {
                            if (ch >= 0x10000) return -1;
                            char uch;
                            if (!tok.match(uch = Character.toUpperCase((char) ch)) && !tok.match(Character.toLowerCase(uch))) return -1;
                        }
                    } else {
                        if (!tok.match(ch)) return -1;
                    }
                    offset++;
                } else {
                    int o1 = offset - 1;
                    if (o1 >= con.limit || o1 < 0) return -1;
                    int ch = target.charAt(o1);
                    if (REUtil.isLowSurrogate(ch) && o1 - 1 >= 0) ch = REUtil.composeFromSurrogates(target.charAt(--o1), ch);
                    RangeToken tok = op.getToken();
                    if (isSet(opts, IGNORE_CASE)) {
                        tok = tok.getCaseInsensitiveToken();
                        if (!tok.match(ch)) {
                            if (ch >= 0x10000) return -1;
                            char uch;
                            if (!tok.match(uch = Character.toUpperCase((char) ch)) && !tok.match(Character.toLowerCase(uch))) return -1;
                        }
                    } else {
                        if (!tok.match(ch)) return -1;
                    }
                    offset = o1;
                }
                op = op.next;
                break;
            case Op.ANCHOR:
                boolean go = false;
                switch(op.getData()) {
                    case '^':
                        if (isSet(opts, MULTIPLE_LINES)) {
                            if (!(offset == con.start || offset > con.start && isEOLChar(target.charAt(offset - 1)))) return -1;
                        } else {
                            if (offset != con.start) return -1;
                        }
                        break;
                    case '@':
                        if (!(offset == con.start || offset > con.start && isEOLChar(target.charAt(offset - 1)))) return -1;
                        break;
                    case '$':
                        if (isSet(opts, MULTIPLE_LINES)) {
                            if (!(offset == con.limit || offset < con.limit && isEOLChar(target.charAt(offset)))) return -1;
                        } else {
                            if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target.charAt(offset)) || offset + 2 == con.limit && target.charAt(offset) == CARRIAGE_RETURN && target.charAt(offset + 1) == LINE_FEED)) return -1;
                        }
                        break;
                    case 'A':
                        if (offset != con.start) return -1;
                        break;
                    case 'Z':
                        if (!(offset == con.limit || offset + 1 == con.limit && isEOLChar(target.charAt(offset)) || offset + 2 == con.limit && target.charAt(offset) == CARRIAGE_RETURN && target.charAt(offset + 1) == LINE_FEED)) return -1;
                        break;
                    case 'z':
                        if (offset != con.limit) return -1;
                        break;
                    case 'b':
                        if (con.length == 0) return -1;
                        {
                            int after = getWordType(target, con.start, con.limit, offset, opts);
                            if (after == WT_IGNORE) return -1;
                            int before = getPreviousWordType(target, con.start, con.limit, offset, opts);
                            if (after == before) return -1;
                        }
                        break;
                    case 'B':
                        if (con.length == 0) go = true; else {
                            int after = getWordType(target, con.start, con.limit, offset, opts);
                            go = after == WT_IGNORE || after == getPreviousWordType(target, con.start, con.limit, offset, opts);
                        }
                        if (!go) return -1;
                        break;
                    case '<':
                        if (con.length == 0 || offset == con.limit) return -1;
                        if (getWordType(target, con.start, con.limit, offset, opts) != WT_LETTER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_OTHER) return -1;
                        break;
                    case '>':
                        if (con.length == 0 || offset == con.start) return -1;
                        if (getWordType(target, con.start, con.limit, offset, opts) != WT_OTHER || getPreviousWordType(target, con.start, con.limit, offset, opts) != WT_LETTER) return -1;
                        break;
                }
                op = op.next;
                break;
            case Op.BACKREFERENCE:
                {
                    int refno = op.getData();
                    if (refno <= 0 || refno >= this.nofparen) throw new RuntimeException('Internal Error: Reference number must be more than zero: ' + refno);
                    if (con.match.getBeginning(refno) < 0 || con.match.getEnd(refno) < 0) return -1;
                    int o2 = con.match.getBeginning(refno);
                    int literallen = con.match.getEnd(refno) - o2;
                    if (!isSet(opts, IGNORE_CASE)) {
                        if (dx > 0) {
                            if (!regionMatches(target, offset, con.limit, o2, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatches(target, offset - literallen, con.limit, o2, literallen)) return -1;
                            offset -= literallen;
                        }
                    } else {
                        if (dx > 0) {
                            if (!regionMatchesIgnoreCase(target, offset, con.limit, o2, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, o2, literallen)) return -1;
                            offset -= literallen;
                        }
                    }
                }
                op = op.next;
                break;
            case Op.STRING:
                {
                    String literal = op.getString();
                    int literallen = literal.length();
                    if (!isSet(opts, IGNORE_CASE)) {
                        if (dx > 0) {
                            if (!regionMatches(target, offset, con.limit, literal, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatches(target, offset - literallen, con.limit, literal, literallen)) return -1;
                            offset -= literallen;
                        }
                    } else {
                        if (dx > 0) {
                            if (!regionMatchesIgnoreCase(target, offset, con.limit, literal, literallen)) return -1;
                            offset += literallen;
                        } else {
                            if (!regionMatchesIgnoreCase(target, offset - literallen, con.limit, literal, literallen)) return -1;
                            offset -= literallen;
                        }
                    }
                }
                op = op.next;
                break;
            case Op.CLOSURE:
                {
                    int id = op.getData();
                    if (id >= 0) {
                        int previousOffset = con.offsets[id];
                        if (previousOffset < 0 || previousOffset != offset) {
                            con.offsets[id] = offset;
                        } else {
                            con.offsets[id] = -1;
                            op = op.next;
                            break;
                        }
                    }
                    int ret = this.matchString(con, op.getChild(), offset, dx, opts);
                    if (id >= 0) con.offsets[id] = -1;
                    if (ret >= 0) return ret;
                    op = op.next;
                }
                break;
            case Op.QUESTION:
                {
                    int ret = this.matchString(con, op.getChild(), offset, dx, opts);
                    if (ret >= 0) return ret;
                    op = op.next;
                }
                break;
            case Op.NONGREEDYCLOSURE:
            case Op.NONGREEDYQUESTION:
                {
                    int ret = this.matchString(con, op.next, offset, dx, opts);
                    if (ret >= 0) return ret;
                    op = op.getChild();
                }
                break;
            case Op.UNION:
                for (int i = 0; i < op.size(); i++) {
                    int ret = this.matchString(con, op.elementAt(i), offset, dx, opts);
                    if (DEBUG) {
                        System.err.println('UNION: ' + i + ', ret=' + ret);
                    }
                    if (ret >= 0) return ret;
                }
                return -1;
            case Op.CAPTURE:
                int refno = op.getData();
                if (con.match != null && refno > 0) {
                    int save = con.match.getBeginning(refno);
                    con.match.setBeginning(refno, offset);
                    int ret = this.matchString(con, op.next, offset, dx, opts);
                    if (ret < 0) con.match.setBeginning(refno, save);
                    return ret;
                } else if (con.match != null && refno < 0) {
                    int index = -refno;
                    int save = con.match.getEnd(index);
                    con.match.setEnd(index, offset);
                    int ret = this.matchString(con, op.next, offset, dx, opts);
                    if (ret < 0) con.match.setEnd(index, save);
                    return ret;
                }
                op = op.next;
                break;
            case Op.LOOKAHEAD:
                if (0 > this.matchString(con, op.getChild(), offset, 1, opts)) return -1;
                op = op.next;
                break;
            case Op.NEGATIVELOOKAHEAD:
                if (0 <= this.matchString(con, op.getChild(), offset, 1, opts)) return -1;
                op = op.next;
                break;
            case Op.LOOKBEHIND:
                if (0 > this.matchString(con, op.getChild(), offset, -1, opts)) return -1;
                op = op.next;
                break;
            case Op.NEGATIVELOOKBEHIND:
                if (0 <= this.matchString(con, op.getChild(), offset, -1, opts)) return -1;
                op = op.next;
                break;
            case Op.INDEPENDENT:
                {
                    int ret = this.matchString(con, op.getChild(), offset, dx, opts);
                    if (ret < 0) return ret;
                    offset = ret;
                    op = op.next;
                }
                break;
            case Op.MODIFIER:
                {
                    int localopts = opts;
                    localopts |= op.getData();
                    localopts &= ~op.getData2();
                    int ret = this.matchString(con, op.getChild(), offset, dx, localopts);
                    if (ret < 0) return ret;
                    offset = ret;
                    op = op.next;
                }
                break;
            case Op.CONDITION:
                {
                    Op.ConditionOp cop = (Op.ConditionOp) op;
                    boolean matchp = false;
                    if (cop.refNumber > 0) {
                        if (cop.refNumber >= this.nofparen) throw new RuntimeException('Internal Error: Reference number must be more than zero: ' + cop.refNumber);
                        matchp = con.match.getBeginning(cop.refNumber) >= 0 && con.match.getEnd(cop.refNumber) >= 0;
                    } else {
                        matchp = 0 <= this.matchString(con, cop.condition, offset, dx, opts);
                    }
                    if (matchp) {
                        op = cop.yes;
                    } else if (cop.no != null) {
                        op = cop.no;
                    } else {
                        op = cop.next;
                    }
                }
                break;
            default:
                throw new RuntimeException('Unknown operation type: ' + op.type);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.ParserForXMLSchema.getTokenForShorthand(int)

Token getTokenForShorthand(int ch) {
    switch(ch) {
        case 'd':
            return ParserForXMLSchema.getRange('xml:isDigit', true);
        case 'D':
            return ParserForXMLSchema.getRange('xml:isDigit', false);
        case 'w':
            return ParserForXMLSchema.getRange('xml:isWord', true);
        case 'W':
            return ParserForXMLSchema.getRange('xml:isWord', false);
        case 's':
            return ParserForXMLSchema.getRange('xml:isSpace', true);
        case 'S':
            return ParserForXMLSchema.getRange('xml:isSpace', false);
        case 'c':
            return ParserForXMLSchema.getRange('xml:isNameChar', true);
        case 'C':
            return ParserForXMLSchema.getRange('xml:isNameChar', false);
        case 'i':
            return ParserForXMLSchema.getRange('xml:isInitialNameChar', true);
        case 'I':
            return ParserForXMLSchema.getRange('xml:isInitialNameChar', false);
        default:
            throw new RuntimeException('Internal Error: shorthands: \\u' + Integer.toString(ch, 16));
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RegexParser.getTokenForShorthand(int)

Token getTokenForShorthand(int ch) {
    Token tok;
    switch(ch) {
        case 'd':
            tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) ? Token.getRange('Nd', true) : Token.token_0to9;
            break;
        case 'D':
            tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) ? Token.getRange('Nd', false) : Token.token_not_0to9;
            break;
        case 'w':
            tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) ? Token.getRange('IsWord', true) : Token.token_wordchars;
            break;
        case 'W':
            tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) ? Token.getRange('IsWord', false) : Token.token_not_wordchars;
            break;
        case 's':
            tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) ? Token.getRange('IsSpace', true) : Token.token_spaces;
            break;
        case 'S':
            tok = this.isSet(RegularExpression.USE_UNICODE_CATEGORY) ? Token.getRange('IsSpace', false) : Token.token_not_spaces;
            break;
        default:
            throw new RuntimeException('Internal Error: shorthands: \\u' + Integer.toString(ch, 16));
    }
    return tok;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Op.elementAt(int)

Op elementAt(int index) {
    throw new RuntimeException('Internal Error: type=' + this.type);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Op.getChild()

Op getChild() {
    throw new RuntimeException('Internal Error: type=' + this.type);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Op.getData()

int getData() {
    throw new RuntimeException('Internal Error: type=' + this.type);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Op.getData2()

int getData2() {
    throw new RuntimeException('Internal Error: type=' + this.type);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Op.getString()

String getString() {
    throw new RuntimeException('Internal Error: type=' + this.type);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Op.getToken()

RangeToken getToken() {
    throw new RuntimeException('Internal Error: type=' + this.type);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.security.Provider.entrySet()

/**
     * Returns an unmodifiable Set view of the property entries contained 
     * in this Provider.
     * @see   java.util.Map.Entry
     * @since 1.2
     */
public synchronized Set<Map.Entry<Object, Object>> entrySet() {
    if (entrySet == null) {
        if (entrySetCallCount++ == 0) entrySet = Collections.unmodifiableMap(this).entrySet(); else return super.entrySet();
    }
    if (entrySetCallCount != 2) throw new RuntimeException('Internal error.');
    return entrySet;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.Repository.lookupClass(String)

/** @return class object for given fully qualified class name.
   */
public static JavaClass lookupClass(String class_name) {
    if (class_name == null || class_name.equals('')) throw new RuntimeException('Invalid class name');
    class_name = class_name.replace('/', '.');
    JavaClass clazz = (JavaClass) classes.get(class_name);
    if (clazz == null) {
        try {
            InputStream is = class_path.getInputStream(class_name);
            clazz = new ClassParser(is, class_name).parse();
            class_name = clazz.getClassName();
        } catch (IOException e) {
            return null;
        }
        classes.put(class_name, clazz);
    }
    return clazz;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.contentSpecTree(int, XMLContentSpec, ChildrenList)

/**
     * Build a vector of valid QNames from Content Spec
     * table.
     * @param contentSpecIndex
     *               Content Spec index
     * @param vectorQName
     *               Array of QName
     * @exception RuntimeException
     */
private void contentSpecTree(int contentSpecIndex, XMLContentSpec contentSpec, ChildrenList children) {
    getContentSpec(contentSpecIndex, contentSpec);
    if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_LEAF || (contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY || (contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL || (contentSpec.type & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) {
        if (children.length == children.qname.length) {
            QName[] newQName = new QName[children.length * 2];
            System.arraycopy(children.qname, 0, newQName, 0, children.length);
            children.qname = newQName;
            int[] newType = new int[children.length * 2];
            System.arraycopy(children.type, 0, newType, 0, children.length);
            children.type = newType;
        }
        children.qname[children.length] = new QName(null, (String) contentSpec.value, (String) contentSpec.value, (String) contentSpec.otherValue);
        children.type[children.length] = contentSpec.type;
        children.length++;
        return;
    }
    final int leftNode = contentSpec.value != null ? ((int[]) (contentSpec.value))[0] : -1;
    int rightNode = -1;
    if (contentSpec.otherValue != null) rightNode = ((int[]) (contentSpec.otherValue))[0]; else return;
    if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_CHOICE || contentSpec.type == XMLContentSpec.CONTENTSPECNODE_SEQ) {
        contentSpecTree(leftNode, contentSpec, children);
        contentSpecTree(rightNode, contentSpec, children);
        return;
    }
    if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE || contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE || contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE) {
        contentSpecTree(leftNode, contentSpec, children);
        return;
    }
    throw new RuntimeException('Invalid content spec type seen in contentSpecTree() method of AbstractDTDGrammar class : ' + contentSpec.type);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createBranchInstruction(short, InstructionHandle)

/** Create branch instruction by given opcode, except LOOKUPSWITCH and TABLESWITCH.
   * For those you should use the SWITCH compeund instruction.
   */
public static BranchInstruction createBranchInstruction(short opcode, InstructionHandle target) {
    switch(opcode) {
        case Constants.IFEQ:
            return new IFEQ(target);
        case Constants.IFNE:
            return new IFNE(target);
        case Constants.IFLT:
            return new IFLT(target);
        case Constants.IFGE:
            return new IFGE(target);
        case Constants.IFGT:
            return new IFGT(target);
        case Constants.IFLE:
            return new IFLE(target);
        case Constants.IF_ICMPEQ:
            return new IF_ICMPEQ(target);
        case Constants.IF_ICMPNE:
            return new IF_ICMPNE(target);
        case Constants.IF_ICMPLT:
            return new IF_ICMPLT(target);
        case Constants.IF_ICMPGE:
            return new IF_ICMPGE(target);
        case Constants.IF_ICMPGT:
            return new IF_ICMPGT(target);
        case Constants.IF_ICMPLE:
            return new IF_ICMPLE(target);
        case Constants.IF_ACMPEQ:
            return new IF_ACMPEQ(target);
        case Constants.IF_ACMPNE:
            return new IF_ACMPNE(target);
        case Constants.GOTO:
            return new GOTO(target);
        case Constants.JSR:
            return new JSR(target);
        case Constants.IFNULL:
            return new IFNULL(target);
        case Constants.IFNONNULL:
            return new IFNONNULL(target);
        case Constants.GOTO_W:
            return new GOTO_W(target);
        case Constants.JSR_W:
            return new JSR_W(target);
        default:
            throw new RuntimeException('Invalid opcode: ' + opcode);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createBinaryDoubleOp(char)

private static final ArithmeticInstruction createBinaryDoubleOp(char op) {
    switch(op) {
        case '-':
            return DSUB;
        case '+':
            return DADD;
        case '*':
            return DMUL;
        case '/':
            return DDIV;
        default:
            throw new RuntimeException('Invalid operand ' + op);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createBinaryFloatOp(char)

private static final ArithmeticInstruction createBinaryFloatOp(char op) {
    switch(op) {
        case '-':
            return FSUB;
        case '+':
            return FADD;
        case '*':
            return FMUL;
        case '/':
            return FDIV;
        default:
            throw new RuntimeException('Invalid operand ' + op);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createBinaryIntOp(char, String)

private static final ArithmeticInstruction createBinaryIntOp(char first, String op) {
    switch(first) {
        case '-':
            return ISUB;
        case '+':
            return IADD;
        case '%':
            return IREM;
        case '*':
            return IMUL;
        case '/':
            return IDIV;
        case '&':
            return IAND;
        case '|':
            return IOR;
        case '^':
            return IXOR;
        case '<':
            return ISHL;
        case '>':
            return op.equals('>>>') ? (ArithmeticInstruction) IUSHR : (ArithmeticInstruction) ISHR;
        default:
            throw new RuntimeException('Invalid operand ' + op);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createBinaryLongOp(char, String)

private static final ArithmeticInstruction createBinaryLongOp(char first, String op) {
    switch(first) {
        case '-':
            return LSUB;
        case '+':
            return LADD;
        case '%':
            return LREM;
        case '*':
            return LMUL;
        case '/':
            return LDIV;
        case '&':
            return LAND;
        case '|':
            return LOR;
        case '^':
            return LXOR;
        case '<':
            return LSHL;
        case '>':
            return op.equals('>>>') ? (ArithmeticInstruction) LUSHR : (ArithmeticInstruction) LSHR;
        default:
            throw new RuntimeException('Invalid operand ' + op);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createArrayLoad(Type)

/**
   * @param type type of elements of array, i.e., array.getElementType()
   */
public static ArrayInstruction createArrayLoad(Type type) {
    switch(type.getType()) {
        case Constants.T_BOOLEAN:
        case Constants.T_BYTE:
            return BALOAD;
        case Constants.T_CHAR:
            return CALOAD;
        case Constants.T_SHORT:
            return SALOAD;
        case Constants.T_INT:
            return IALOAD;
        case Constants.T_FLOAT:
            return FALOAD;
        case Constants.T_DOUBLE:
            return DALOAD;
        case Constants.T_LONG:
            return LALOAD;
        case Constants.T_ARRAY:
        case Constants.T_OBJECT:
            return AALOAD;
        default:
            throw new RuntimeException('Invalid type ' + type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createArrayStore(Type)

/**
   * @param type type of elements of array, i.e., array.getElementType()
   */
public static ArrayInstruction createArrayStore(Type type) {
    switch(type.getType()) {
        case Constants.T_BOOLEAN:
        case Constants.T_BYTE:
            return BASTORE;
        case Constants.T_CHAR:
            return CASTORE;
        case Constants.T_SHORT:
            return SASTORE;
        case Constants.T_INT:
            return IASTORE;
        case Constants.T_FLOAT:
            return FASTORE;
        case Constants.T_DOUBLE:
            return DASTORE;
        case Constants.T_LONG:
            return LASTORE;
        case Constants.T_ARRAY:
        case Constants.T_OBJECT:
            return AASTORE;
        default:
            throw new RuntimeException('Invalid type ' + type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createBinaryOperation(String, Type)

/**
   * Create binary operation for simple basic types, such as int and float.
   * @param op operation, such as '+', '*', '<<', etc.
   */
public static ArithmeticInstruction createBinaryOperation(String op, Type type) {
    char first = op.toCharArray()[0];
    switch(type.getType()) {
        case Constants.T_BYTE:
        case Constants.T_SHORT:
        case Constants.T_INT:
        case Constants.T_CHAR:
            return createBinaryIntOp(first, op);
        case Constants.T_LONG:
            return createBinaryLongOp(first, op);
        case Constants.T_FLOAT:
            return createBinaryFloatOp(first);
        case Constants.T_DOUBLE:
            return createBinaryDoubleOp(first);
        default:
            throw new RuntimeException('Invalid type ' + type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createLoad(Type, int)

/**
   * @param index index of local variable
   */
public static LocalVariableInstruction createLoad(Type type, int index) {
    switch(type.getType()) {
        case Constants.T_BOOLEAN:
        case Constants.T_CHAR:
        case Constants.T_BYTE:
        case Constants.T_SHORT:
        case Constants.T_INT:
            return new ILOAD(index);
        case Constants.T_FLOAT:
            return new FLOAD(index);
        case Constants.T_DOUBLE:
            return new DLOAD(index);
        case Constants.T_LONG:
            return new LLOAD(index);
        case Constants.T_ARRAY:
        case Constants.T_OBJECT:
            return new ALOAD(index);
        default:
            throw new RuntimeException('Invalid type ' + type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createStore(Type, int)

/**
   * @param index index of local variable
   */
public static LocalVariableInstruction createStore(Type type, int index) {
    switch(type.getType()) {
        case Constants.T_BOOLEAN:
        case Constants.T_CHAR:
        case Constants.T_BYTE:
        case Constants.T_SHORT:
        case Constants.T_INT:
            return new ISTORE(index);
        case Constants.T_FLOAT:
            return new FSTORE(index);
        case Constants.T_DOUBLE:
            return new DSTORE(index);
        case Constants.T_LONG:
            return new LSTORE(index);
        case Constants.T_ARRAY:
        case Constants.T_OBJECT:
            return new ASTORE(index);
        default:
            throw new RuntimeException('Invalid type ' + type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createNull(Type)

/** Create 'null' value for reference types, 0 for basic types like int
   */
public static Instruction createNull(Type type) {
    switch(type.getType()) {
        case Constants.T_ARRAY:
        case Constants.T_OBJECT:
            return ACONST_NULL;
        case Constants.T_INT:
        case Constants.T_SHORT:
        case Constants.T_BOOLEAN:
        case Constants.T_CHAR:
        case Constants.T_BYTE:
            return ICONST_0;
        case Constants.T_FLOAT:
            return FCONST_0;
        case Constants.T_DOUBLE:
            return DCONST_0;
        case Constants.T_LONG:
            return LCONST_0;
        case Constants.T_VOID:
            return NOP;
        default:
            throw new RuntimeException('Invalid type: ' + type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createReturn(Type)

/** Create typed return
   */
public static ReturnInstruction createReturn(Type type) {
    switch(type.getType()) {
        case Constants.T_ARRAY:
        case Constants.T_OBJECT:
            return ARETURN;
        case Constants.T_INT:
        case Constants.T_SHORT:
        case Constants.T_BOOLEAN:
        case Constants.T_CHAR:
        case Constants.T_BYTE:
            return IRETURN;
        case Constants.T_FLOAT:
            return FRETURN;
        case Constants.T_DOUBLE:
            return DRETURN;
        case Constants.T_LONG:
            return LRETURN;
        case Constants.T_VOID:
            return RETURN;
        default:
            throw new RuntimeException('Invalid type: ' + type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.JOptionPane.setOptionType(int)

/**
     * Sets the options to display. 
     * The option type is used by the Look and Feel to
     * determine what buttons to show (unless options are supplied).
     * @param newType an integer specifying the options the L&F is to display:
     *                 <code>DEFAULT_OPTION</code>, 
     *   <code>YES_NO_OPTION</code>,
     *   <code>YES_NO_CANCEL_OPTION</code>,
     *                 or <code>OK_CANCEL_OPTION</code>
     * @exception RuntimeException if <code>newType</code> is not one of
     *  the legal values listed above
     * @see #getOptionType
     * @see #setOptions
     * @beaninfo
     *   preferred: true
     *       bound: true
     * description: The option pane's option type.
      */
public void setOptionType(int newType) {
    if (newType != DEFAULT_OPTION && newType != YES_NO_OPTION && newType != YES_NO_CANCEL_OPTION && newType != OK_CANCEL_OPTION) throw new RuntimeException('JOptionPane: option type must be one of JOptionPane.DEFAULT_OPTION, JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_CANCEL_OPTION or JOptionPane.OK_CANCEL_OPTION');
    int oldType = optionType;
    optionType = newType;
    firePropertyChange(OPTION_TYPE_PROPERTY, oldType, optionType);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.JOptionPane.createInternalFrame(Component, String)

/**
     * Creates and returns an instance of <code>JInternalFrame</code>. 
     * The internal frame is created with the specified title,
     * and wrapping the <code>JOptionPane</code>.
     * The returned <code>JInternalFrame</code> is
     * added to the <code>JDesktopPane</code> ancestor of
     * <code>parentComponent</code>, or components
     * parent if one its ancestors isn't a <code>JDesktopPane</code>,
     * or if <code>parentComponent</code>
     * doesn't have a parent then a <code>RuntimeException</code> is thrown.
     * @param parentComponent  the parent <code>Component</code> for
     *  the internal frame
     * @param title    the <code>String</code> to display in the
     *  frame's title bar
     * @return a <code>JInternalFrame</code> containing a
     *  <code>JOptionPane</code>
     * @exception RuntimeException if <code>parentComponent</code> does
     *  not have a valid parent
     */
public JInternalFrame createInternalFrame(Component parentComponent, String title) {
    Container parent = JOptionPane.getDesktopPaneForComponent(parentComponent);
    if (parent == null && (parentComponent == null || (parent = parentComponent.getParent()) == null)) {
        throw new RuntimeException('JOptionPane: parentComponent does ' + 'not have a valid parent');
    }
    final JInternalFrame iFrame = new JInternalFrame(title, false, true, false, false);
    iFrame.putClientProperty('JInternalFrame.frameType', 'optionDialog');
    iFrame.putClientProperty('JInternalFrame.messageType', new Integer(getMessageType()));
    iFrame.addInternalFrameListener(new InternalFrameAdapter() {

        public void internalFrameClosing(InternalFrameEvent e) {
            if (getValue() == UNINITIALIZED_VALUE) {
                setValue(null);
            }
        }
    });
    addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (iFrame.isVisible() && event.getSource() == JOptionPane.this && event.getPropertyName().equals(VALUE_PROPERTY)) {
                try {
                    Object obj;
                    obj = AccessController.doPrivileged(new ModalPrivilegedAction(Container.class, 'stopLWModal'));
                    if (obj != null) {
                        ((Method) obj).invoke(iFrame, null);
                    }
                } catch (IllegalAccessException ex) {
                } catch (IllegalArgumentException ex) {
                } catch (InvocationTargetException ex) {
                }
                try {
                    iFrame.setClosed(true);
                } catch (java.beans.PropertyVetoException e) {
                }
                iFrame.setVisible(false);
            }
        }
    });
    iFrame.getContentPane().add(this, BorderLayout.CENTER);
    if (parent instanceof JDesktopPane) {
        parent.add(iFrame, JLayeredPane.MODAL_LAYER);
    } else {
        parent.add(iFrame, BorderLayout.CENTER);
    }
    Dimension iFrameSize = iFrame.getPreferredSize();
    Dimension rootSize = parent.getSize();
    Dimension parentSize = parentComponent.getSize();
    iFrame.setBounds((rootSize.width - iFrameSize.width) / 2, (rootSize.height - iFrameSize.height) / 2, iFrameSize.width, iFrameSize.height);
    Point iFrameCoord = SwingUtilities.convertPoint(parentComponent, 0, 0, parent);
    int x = (parentSize.width - iFrameSize.width) / 2 + iFrameCoord.x;
    int y = (parentSize.height - iFrameSize.height) / 2 + iFrameCoord.y;
    int ovrx = x + iFrameSize.width - rootSize.width;
    int ovry = y + iFrameSize.height - rootSize.height;
    x = Math.max((ovrx > 0 ? x - ovrx : x), 0);
    y = Math.max((ovry > 0 ? y - ovry : y), 0);
    iFrame.setBounds(x, y, iFrameSize.width, iFrameSize.height);
    parent.validate();
    try {
        iFrame.setSelected(true);
    } catch (java.beans.PropertyVetoException e) {
    }
    return iFrame;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.JOptionPane.setMessageType(int)

/**
     * Sets the option pane's message type.
     * The message type is used by the Look and Feel to determine the
     * icon to display (if not supplied) as well as potentially how to
     * lay out the <code>parentComponent</code>.
     * @param newType an integer specifying the kind of message to display:
     *                <code>ERROR_MESSAGE</code>, <code>INFORMATION_MESSAGE</code>,
     *                <code>WARNING_MESSAGE</code>,
     *                <code>QUESTION_MESSAGE</code>, or <code>PLAIN_MESSAGE</code>
     * @exception RuntimeException if <code>newType</code> is not one of the
     *  legal values listed above

     * @see #getMessageType
     * @beaninfo
     *   preferred: true
     *       bound: true
     * description: The option pane's message type.
     */
public void setMessageType(int newType) {
    if (newType != ERROR_MESSAGE && newType != INFORMATION_MESSAGE && newType != WARNING_MESSAGE && newType != QUESTION_MESSAGE && newType != PLAIN_MESSAGE) throw new RuntimeException('JOptionPane: type must be one of JOptionPane.ERROR_MESSAGE, JOptionPane.INFORMATION_MESSAGE, JOptionPane.WARNING_MESSAGE, JOptionPane.QUESTION_MESSAGE or JOptionPane.PLAIN_MESSAGE');
    int oldType = messageType;
    messageType = newType;
    firePropertyChange(MESSAGE_TYPE_PROPERTY, oldType, messageType);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.png.PNGImageWriter.read()

public int read() throws IOException {
    throw new RuntimeException('Method not available');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.png.PNGImageWriter.read(byte[], int, int)

public int read(byte[] b, int off, int len) throws IOException {
    throw new RuntimeException('Method not available');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.match(int)

boolean match(int ch) {
    throw new RuntimeException('NFAArrow#match(): Internal error: ' + this.type);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.addChild(Token)

void addChild(Token tok) {
    throw new RuntimeException('Not supported.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.addRange(int, int)

protected void addRange(int start, int end) {
    throw new RuntimeException('Not supported.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.compactRanges()

protected void compactRanges() {
    throw new RuntimeException('Not supported.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.intersectRanges(Token)

protected void intersectRanges(Token tok) {
    throw new RuntimeException('Not supported.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.mergeRanges(Token)

protected void mergeRanges(Token tok) {
    throw new RuntimeException('Not supported.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.sortRanges()

protected void sortRanges() {
    throw new RuntimeException('Not supported.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.subtractRanges(Token)

protected void subtractRanges(Token tok) {
    throw new RuntimeException('Not supported.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.imageio.plugins.png.PNGMetadata.initialize(ImageTypeSpecifier, int)

/**
     * Sets the IHDR_bitDepth and IHDR_colorType variables.
     * The <code>numBands</code> parameter is necessary since
     * we may only be writing a subset of the image bands.
     */
public void initialize(ImageTypeSpecifier imageType, int numBands) {
    ColorModel colorModel = imageType.getColorModel();
    SampleModel sampleModel = imageType.getSampleModel();
    int[] sampleSize = sampleModel.getSampleSize();
    int bitDepth = sampleSize[0];
    for (int i = 1; i < sampleSize.length; i++) {
        if (sampleSize[i] > bitDepth) {
            bitDepth = sampleSize[i];
        }
    }
    if (sampleSize.length > 1 && bitDepth < 8) {
        bitDepth = 8;
    }
    if (bitDepth > 2 && bitDepth < 4) {
        bitDepth = 4;
    } else if (bitDepth > 4 && bitDepth < 8) {
        bitDepth = 8;
    } else if (bitDepth > 8 && bitDepth < 16) {
        bitDepth = 16;
    } else if (bitDepth > 16) {
        throw new RuntimeException('bitDepth > 16!');
    }
    IHDR_bitDepth = bitDepth;
    if (colorModel instanceof IndexColorModel) {
        IndexColorModel icm = (IndexColorModel) colorModel;
        int size = icm.getMapSize();
        byte[] reds = new byte[size];
        icm.getReds(reds);
        byte[] greens = new byte[size];
        icm.getGreens(greens);
        byte[] blues = new byte[size];
        icm.getBlues(blues);
        boolean isGray = false;
        if (!IHDR_present || (IHDR_colorType != PNGImageReader.PNG_COLOR_PALETTE)) {
            isGray = true;
            int scale = 255 / ((1 << IHDR_bitDepth) - 1);
            for (int i = 0; i < size; i++) {
                byte red = reds[i];
                if ((red != (byte) (i * scale)) || (red != greens[i]) || (red != blues[i])) {
                    isGray = false;
                    break;
                }
            }
        }
        boolean hasAlpha = colorModel.hasAlpha();
        byte[] alpha = null;
        if (hasAlpha) {
            alpha = new byte[size];
            icm.getAlphas(alpha);
        }
        if (isGray && hasAlpha && (bitDepth == 8 || bitDepth == 16)) {
            IHDR_colorType = PNGImageReader.PNG_COLOR_GRAY_ALPHA;
        } else if (isGray && !hasAlpha) {
            IHDR_colorType = PNGImageReader.PNG_COLOR_GRAY;
        } else {
            IHDR_colorType = PNGImageReader.PNG_COLOR_PALETTE;
            PLTE_present = true;
            PLTE_order = null;
            PLTE_red = (byte[]) reds.clone();
            PLTE_green = (byte[]) greens.clone();
            PLTE_blue = (byte[]) blues.clone();
            if (hasAlpha) {
                tRNS_present = true;
                tRNS_colorType = PNGImageReader.PNG_COLOR_PALETTE;
                PLTE_order = new int[alpha.length];
                byte[] newAlpha = new byte[alpha.length];
                int newIndex = 0;
                for (int i = 0; i < alpha.length; i++) {
                    if (alpha[i] != (byte) 255) {
                        PLTE_order[i] = newIndex;
                        newAlpha[newIndex] = alpha[i];
                        ++newIndex;
                    }
                }
                int numTransparent = newIndex;
                for (int i = 0; i < alpha.length; i++) {
                    if (alpha[i] == (byte) 255) {
                        PLTE_order[i] = newIndex++;
                    }
                }
                byte[] oldRed = PLTE_red;
                byte[] oldGreen = PLTE_green;
                byte[] oldBlue = PLTE_blue;
                int len = oldRed.length;
                PLTE_red = new byte[len];
                PLTE_green = new byte[len];
                PLTE_blue = new byte[len];
                for (int i = 0; i < len; i++) {
                    PLTE_red[PLTE_order[i]] = oldRed[i];
                    PLTE_green[PLTE_order[i]] = oldGreen[i];
                    PLTE_blue[PLTE_order[i]] = oldBlue[i];
                }
                tRNS_alpha = new byte[numTransparent];
                System.arraycopy(newAlpha, 0, tRNS_alpha, 0, numTransparent);
            }
        }
    } else {
        if (numBands == 1) {
            IHDR_colorType = PNGImageReader.PNG_COLOR_GRAY;
        } else if (numBands == 2) {
            IHDR_colorType = PNGImageReader.PNG_COLOR_GRAY_ALPHA;
        } else if (numBands == 3) {
            IHDR_colorType = PNGImageReader.PNG_COLOR_RGB;
        } else if (numBands == 4) {
            IHDR_colorType = PNGImageReader.PNG_COLOR_RGB_ALPHA;
        } else {
            throw new RuntimeException('Number of bands not 1-4!');
        }
    }
    IHDR_present = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createAppend(Type)

public Instruction createAppend(Type type) {
    byte t = type.getType();
    if (isString(type)) return createInvoke(append_mos[0], Constants.INVOKEVIRTUAL);
    switch(t) {
        case Constants.T_BOOLEAN:
        case Constants.T_CHAR:
        case Constants.T_FLOAT:
        case Constants.T_DOUBLE:
        case Constants.T_BYTE:
        case Constants.T_SHORT:
        case Constants.T_INT:
        case Constants.T_LONG:
            return createInvoke(append_mos[t], Constants.INVOKEVIRTUAL);
        case Constants.T_ARRAY:
        case Constants.T_OBJECT:
            return createInvoke(append_mos[1], Constants.INVOKEVIRTUAL);
        default:
            throw new RuntimeException('Oops: No append for this type? ' + type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.FieldGen.addConstant()

private int addConstant() {
    switch(type.getType()) {
        case Constants.T_INT:
        case Constants.T_CHAR:
        case Constants.T_BYTE:
        case Constants.T_BOOLEAN:
        case Constants.T_SHORT:
            return cp.addInteger(((Integer) value).intValue());
        case Constants.T_FLOAT:
            return cp.addFloat(((Float) value).floatValue());
        case Constants.T_DOUBLE:
            return cp.addDouble(((Double) value).doubleValue());
        case Constants.T_LONG:
            return cp.addLong(((Long) value).longValue());
        case Constants.T_REFERENCE:
            return cp.addString(((String) value));
        default:
            throw new RuntimeException('Oops: Unhandled : ' + type.getType());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createFieldAccess(String, String, Type, short)

/** Create a field instruction.
   * @param class_name name of the accessed class
   * @param name name of the referenced field
   * @param type  type of field
   * @param kind how to access, i.e., GETFIELD, PUTFIELD, GETSTATIC, PUTSTATIC
   * @see Constants
   */
public FieldInstruction createFieldAccess(String class_name, String name, Type type, short kind) {
    int index;
    String signature = type.getSignature();
    index = cp.addFieldref(class_name, name, signature);
    switch(kind) {
        case Constants.GETFIELD:
            return new GETFIELD(index);
        case Constants.PUTFIELD:
            return new PUTFIELD(index);
        case Constants.GETSTATIC:
            return new GETSTATIC(index);
        case Constants.PUTSTATIC:
            return new PUTSTATIC(index);
        default:
            throw new RuntimeException('Oops: Unknown getfield kind:' + kind);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.InstructionFactory.createInvoke(String, String, Type, Type[], short)

/** Create an invoke instruction.
   * @param class_name name of the called class
   * @param name name of the called method
   * @param ret_type return type of method
   * @param arg_types argument types of method
   * @param kind how to invoke, i.e., INVOKEINTERFACE, INVOKESTATIC, INVOKEVIRTUAL,
   * or INVOKESPECIAL
   * @see Constants
   */
public InvokeInstruction createInvoke(String class_name, String name, Type ret_type, Type[] arg_types, short kind) {
    int index;
    int nargs = 0;
    String signature = Type.getMethodSignature(ret_type, arg_types);
    for (int i = 0; i < arg_types.length; i++) nargs += arg_types[i].getSize();
    if (kind == Constants.INVOKEINTERFACE) index = cp.addInterfaceMethodref(class_name, name, signature); else index = cp.addMethodref(class_name, name, signature);
    switch(kind) {
        case Constants.INVOKESPECIAL:
            return new INVOKESPECIAL(index);
        case Constants.INVOKEVIRTUAL:
            return new INVOKEVIRTUAL(index);
        case Constants.INVOKESTATIC:
            return new INVOKESTATIC(index);
        case Constants.INVOKEINTERFACE:
            return new INVOKEINTERFACE(index, nargs + 1);
        default:
            throw new RuntimeException('Oops: Unknown invoke kind:' + kind);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.SourceTreeManager.putDocumentInCache(int, Source)

/**
   * Put the source tree root node in the document cache.
   * TODO: This function needs to be a LOT more sophisticated.
   * @param n The node to cache.
   * @param source The Source object to cache.
   */
public void putDocumentInCache(int n, Source source) {
    int cachedNode = getNode(source);
    if (DTM.NULL != cachedNode) {
        if (!(cachedNode == n)) throw new RuntimeException('Programmer's Error!  ' + 'putDocumentInCache found reparse of doc: ' + source.getSystemId());
        return;
    }
    if (null != source.getSystemId()) {
        m_sourceTree.addElement(new SourceTree(n, source.getSystemId()));
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.beans.PropertyDescriptor.createPropertyEditor(Object)

/**
     * Constructs an instance of a property editor using the current
     * property editor class.
     * If the property editor class has a public constructor that takes an
     * Object argument then it will be invoked using the bean parameter
     * as the argument. Otherwise, the default constructor will be invoked.
     * @param bean the source object
     * @return a property editor instance or null if a property editor has
     *         not been defined or cannot be created
     * @since 1.5
     */
public PropertyEditor createPropertyEditor(Object bean) {
    Object editor = null;
    Class cls = getPropertyEditorClass();
    if (cls != null) {
        Constructor ctor = null;
        if (bean != null) {
            try {
                ctor = cls.getConstructor(new Class[] { Object.class });
            } catch (Exception ex) {
            }
        }
        try {
            if (ctor == null) {
                editor = cls.newInstance();
            } else {
                editor = ctor.newInstance(new Object[] { bean });
            }
        } catch (Exception ex) {
            throw new RuntimeException('PropertyEditor not instantiated', ex);
        }
    }
    return (PropertyEditor) editor;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SelectorImpl.registerForEvent(EventHandler)

public void registerForEvent(EventHandler eventHandler) {
    if (orb.transportDebugFlag) {
        dprint('.registerForEvent: ' + eventHandler);
    }
    if (isClosed()) {
        if (orb.transportDebugFlag) {
            dprint('.registerForEvent: closed: ' + eventHandler);
        }
        return;
    }
    if (eventHandler.shouldUseSelectThreadToWait()) {
        synchronized (deferredRegistrations) {
            deferredRegistrations.add(eventHandler);
        }
        if (!selectorStarted) {
            startSelector();
        }
        selector.wakeup();
        return;
    }
    switch(eventHandler.getInterestOps()) {
        case SelectionKey.OP_ACCEPT:
            createListenerThread(eventHandler);
            break;
        case SelectionKey.OP_READ:
            createReaderThread(eventHandler);
            break;
        default:
            if (orb.transportDebugFlag) {
                dprint('.registerForEvent: default: ' + eventHandler);
            }
            throw new RuntimeException('SelectorImpl.registerForEvent: unknown interest ops');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SelectorImpl.unregisterForEvent(EventHandler)

public void unregisterForEvent(EventHandler eventHandler) {
    if (orb.transportDebugFlag) {
        dprint('.unregisterForEvent: ' + eventHandler);
    }
    if (isClosed()) {
        if (orb.transportDebugFlag) {
            dprint('.unregisterForEvent: closed: ' + eventHandler);
        }
        return;
    }
    if (eventHandler.shouldUseSelectThreadToWait()) {
        SelectionKey selectionKey = eventHandler.getSelectionKey();
        selectionKey.cancel();
        selector.wakeup();
        return;
    }
    switch(eventHandler.getInterestOps()) {
        case SelectionKey.OP_ACCEPT:
            destroyListenerThread(eventHandler);
            break;
        case SelectionKey.OP_READ:
            destroyReaderThread(eventHandler);
            break;
        default:
            if (orb.transportDebugFlag) {
                dprint('.unregisterForEvent: default: ' + eventHandler);
            }
            throw new RuntimeException('SelectorImpl.uregisterForEvent: unknown interest ops');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl.getConnection()

public Connection getConnection() {
    throw new RuntimeException('Should not happen.');
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.finishReadingBits(MessageMediator)

protected CorbaMessageMediator finishReadingBits(MessageMediator messageMediator) {
    try {
        if (orb.transportDebugFlag) {
            dprint('.finishReadingBits->: ' + this);
        }
        if (contactInfo != null) {
            messageMediator = contactInfo.finishCreatingMessageMediator(orb, this, messageMediator);
        } else if (acceptor != null) {
            messageMediator = acceptor.finishCreatingMessageMediator(orb, this, messageMediator);
        } else {
            throw new RuntimeException('SocketOrChannelConnectionImpl.finishReadingBits');
        }
        return (CorbaMessageMediator) messageMediator;
    } catch (ThreadDeath td) {
        if (orb.transportDebugFlag) {
            dprint('.finishReadingBits: ' + this + ': ThreadDeath: ' + td, td);
        }
        try {
            purgeCalls(wrapper.connectionAbort(td), false, false);
        } catch (Throwable t) {
            if (orb.transportDebugFlag) {
                dprint('.finishReadingBits: ' + this + ': purgeCalls: Throwable: ' + t, t);
            }
        }
        throw td;
    } catch (Throwable ex) {
        if (orb.transportDebugFlag) {
            dprint('.finishReadingBits: ' + this + ': Throwable: ' + ex, ex);
        }
        try {
            if (ex instanceof INTERNAL) {
                sendMessageError(GIOPVersion.DEFAULT_VERSION);
            }
        } catch (IOException e) {
            if (orb.transportDebugFlag) {
                dprint('.finishReadingBits: ' + this + ': sendMessageError: IOException: ' + e, e);
            }
        }
        orb.getTransportManager().getSelector(0).unregisterForEvent(this);
        purgeCalls(wrapper.connectionAbort(ex), true, false);
    } finally {
        if (orb.transportDebugFlag) {
            dprint('.finishReadingBits<-: ' + this);
        }
    }
    return null;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readBits()

protected CorbaMessageMediator readBits() {
    try {
        if (orb.transportDebugFlag) {
            dprint('.readBits->: ' + this);
        }
        MessageMediator messageMediator;
        if (contactInfo != null) {
            messageMediator = contactInfo.createMessageMediator(orb, this);
        } else if (acceptor != null) {
            messageMediator = acceptor.createMessageMediator(orb, this);
        } else {
            throw new RuntimeException('SocketOrChannelConnectionImpl.readBits');
        }
        return (CorbaMessageMediator) messageMediator;
    } catch (ThreadDeath td) {
        if (orb.transportDebugFlag) {
            dprint('.readBits: ' + this + ': ThreadDeath: ' + td, td);
        }
        try {
            purgeCalls(wrapper.connectionAbort(td), false, false);
        } catch (Throwable t) {
            if (orb.transportDebugFlag) {
                dprint('.readBits: ' + this + ': purgeCalls: Throwable: ' + t, t);
            }
        }
        throw td;
    } catch (Throwable ex) {
        if (orb.transportDebugFlag) {
            dprint('.readBits: ' + this + ': Throwable: ' + ex, ex);
        }
        try {
            if (ex instanceof INTERNAL) {
                sendMessageError(GIOPVersion.DEFAULT_VERSION);
            }
        } catch (IOException e) {
            if (orb.transportDebugFlag) {
                dprint('.readBits: ' + this + ': sendMessageError: IOException: ' + e, e);
            }
        }
        orb.getTransportManager().getSelector(0).unregisterForEvent(this);
        purgeCalls(wrapper.connectionAbort(ex), true, false);
    } finally {
        if (orb.transportDebugFlag) {
            dprint('.readBits<-: ' + this);
        }
    }
    return null;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.oa.toa.TOAImpl.connect(org.omg.CORBA.Object)

public void connect(org.omg.CORBA.Object objref) {
    byte[] key = servants.storeServant(objref, null);
    String id = StubAdapter.getTypeIds(objref)[0];
    ObjectReferenceFactory orf = getCurrentFactory();
    org.omg.CORBA.Object obj = orf.make_object(id, key);
    org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate(obj);
    CorbaContactInfoList ccil = (CorbaContactInfoList) ((ClientDelegate) delegate).getContactInfoList();
    LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher();
    if (lcs instanceof JIDLLocalCRDImpl) {
        JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl) lcs;
        jlcs.setServant(objref);
    } else {
        throw new RuntimeException('TOAImpl.connect can not be called on ' + lcs);
    }
    StubAdapter.setDelegate(objref, delegate);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.oa.toa.TOAImpl.disconnect(org.omg.CORBA.Object)

public void disconnect(org.omg.CORBA.Object objref) {
    org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(objref);
    CorbaContactInfoList ccil = (CorbaContactInfoList) ((ClientDelegate) del).getContactInfoList();
    LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher();
    if (lcs instanceof JIDLLocalCRDImpl) {
        JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl) lcs;
        byte[] oid = jlcs.getObjectId();
        servants.deleteServant(oid);
        jlcs.unexport();
    } else {
        throw new RuntimeException('TOAImpl.disconnect can not be called on ' + lcs);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xpath.internal.NodeSetDTM.getCurrentNode()

/**
   * Return the last fetched node.  Needed to support the UnionPathIterator.
   * @return the last fetched node.
   * @throws RuntimeException thrown if this NodeSetDTM is not of 
   * a cached type, and thus doesn't permit indexed access.
   */
public int getCurrentNode() {
    if (!m_cacheNodes) throw new RuntimeException('This NodeSetDTM can not do indexing or counting functions!');
    int saved = m_next;
    int current = (m_next > 0) ? m_next - 1 : m_next;
    int n = (current < m_firstFree) ? elementAt(current) : DTM.NULL;
    m_next = saved;
    return n;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.colorchooser.AbstractColorChooserPanel.installChooserPanel(JColorChooser)

/**
     * Invoked when the panel is added to the chooser.
     * If you override this, be sure to call <code>super</code>.
     * @param enclosingChooser  the panel to be added
     * @exception RuntimeException  if the chooser panel has already been
     *    installed
     */
public void installChooserPanel(JColorChooser enclosingChooser) {
    if (chooser != null) {
        throw new RuntimeException('This chooser panel is already installed');
    }
    chooser = enclosingChooser;
    buildChooser();
    updateChooser();
    colorListener = new ModelListener();
    getColorSelectionModel().addChangeListener(colorListener);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.analyzeFirstCharacter(RangeToken, int)

final int analyzeFirstCharacter(RangeToken result, int options) {
    switch(this.type) {
        case CONCAT:
            int ret = FC_CONTINUE;
            for (int i = 0; i < this.size(); i++) if ((ret = this.getChild(i).analyzeFirstCharacter(result, options)) != FC_CONTINUE) break;
            return ret;
        case UNION:
            if (this.size() == 0) return FC_CONTINUE;
            int ret2 = FC_CONTINUE;
            boolean hasEmpty = false;
            for (int i = 0; i < this.size(); i++) {
                ret2 = this.getChild(i).analyzeFirstCharacter(result, options);
                if (ret2 == FC_ANY) break; else if (ret2 == FC_CONTINUE) hasEmpty = true;
            }
            return hasEmpty ? FC_CONTINUE : ret2;
        case CONDITION:
            int ret3 = this.getChild(0).analyzeFirstCharacter(result, options);
            if (this.size() == 1) return FC_CONTINUE;
            if (ret3 == FC_ANY) return ret3;
            int ret4 = this.getChild(1).analyzeFirstCharacter(result, options);
            if (ret4 == FC_ANY) return ret4;
            return ret3 == FC_CONTINUE || ret4 == FC_CONTINUE ? FC_CONTINUE : FC_TERMINAL;
        case CLOSURE:
        case NONGREEDYCLOSURE:
            this.getChild(0).analyzeFirstCharacter(result, options);
            return FC_CONTINUE;
        case EMPTY:
        case ANCHOR:
            return FC_CONTINUE;
        case CHAR:
            int ch = this.getChar();
            result.addRange(ch, ch);
            if (ch < 0x10000 && isSet(options, RegularExpression.IGNORE_CASE)) {
                ch = Character.toUpperCase((char) ch);
                result.addRange(ch, ch);
                ch = Character.toLowerCase((char) ch);
                result.addRange(ch, ch);
            }
            return FC_TERMINAL;
        case DOT:
            if (isSet(options, RegularExpression.SINGLE_LINE)) {
                return FC_CONTINUE;
            } else {
                return FC_CONTINUE;
            }
        case RANGE:
            if (isSet(options, RegularExpression.IGNORE_CASE)) {
                result.mergeRanges(((RangeToken) this).getCaseInsensitiveToken());
            } else {
                result.mergeRanges(this);
            }
            return FC_TERMINAL;
        case NRANGE:
            if (isSet(options, RegularExpression.IGNORE_CASE)) {
                result.mergeRanges(Token.complementRanges(((RangeToken) this).getCaseInsensitiveToken()));
            } else {
                result.mergeRanges(Token.complementRanges(this));
            }
            return FC_TERMINAL;
        case INDEPENDENT:
        case PAREN:
            return this.getChild(0).analyzeFirstCharacter(result, options);
        case MODIFIERGROUP:
            options |= ((ModifierToken) this).getOptions();
            options &= ~((ModifierToken) this).getOptionsMask();
            return this.getChild(0).analyzeFirstCharacter(result, options);
        case BACKREFERENCE:
            result.addRange(0, UTF16_MAX);
            return FC_ANY;
        case STRING:
            int cha = this.getString().charAt(0);
            int ch2;
            if (REUtil.isHighSurrogate(cha) && this.getString().length() >= 2 && REUtil.isLowSurrogate((ch2 = this.getString().charAt(1)))) cha = REUtil.composeFromSurrogates(cha, ch2);
            result.addRange(cha, cha);
            if (cha < 0x10000 && isSet(options, RegularExpression.IGNORE_CASE)) {
                cha = Character.toUpperCase((char) cha);
                result.addRange(cha, cha);
                cha = Character.toLowerCase((char) cha);
                result.addRange(cha, cha);
            }
            return FC_TERMINAL;
        case LOOKAHEAD:
        case NEGATIVELOOKAHEAD:
        case LOOKBEHIND:
        case NEGATIVELOOKBEHIND:
            return FC_CONTINUE;
        default:
            throw new RuntimeException('Token#analyzeHeadCharacter(): Invalid Type: ' + this.type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RangeToken.compactRanges()

/**
     * this.ranges is sorted.
     */
protected void compactRanges() {
    boolean DEBUG = false;
    if (this.ranges == null || this.ranges.length <= 2) return;
    if (this.isCompacted()) return;
    int base = 0;
    int target = 0;
    while (target < this.ranges.length) {
        if (base != target) {
            this.ranges[base] = this.ranges[target++];
            this.ranges[base + 1] = this.ranges[target++];
        } else target += 2;
        int baseend = this.ranges[base + 1];
        while (target < this.ranges.length) {
            if (baseend + 1 < this.ranges[target]) break;
            if (baseend + 1 == this.ranges[target]) {
                if (DEBUG) System.err.println('Token#compactRanges(): Compaction: [' + this.ranges[base] + ', ' + this.ranges[base + 1] + '], [' + this.ranges[target] + ', ' + this.ranges[target + 1] + '] -> [' + this.ranges[base] + ', ' + this.ranges[target + 1] + ']');
                this.ranges[base + 1] = this.ranges[target + 1];
                baseend = this.ranges[base + 1];
                target += 2;
            } else if (baseend >= this.ranges[target + 1]) {
                if (DEBUG) System.err.println('Token#compactRanges(): Compaction: [' + this.ranges[base] + ', ' + this.ranges[base + 1] + '], [' + this.ranges[target] + ', ' + this.ranges[target + 1] + '] -> [' + this.ranges[base] + ', ' + this.ranges[base + 1] + ']');
                target += 2;
            } else if (baseend < this.ranges[target + 1]) {
                if (DEBUG) System.err.println('Token#compactRanges(): Compaction: [' + this.ranges[base] + ', ' + this.ranges[base + 1] + '], [' + this.ranges[target] + ', ' + this.ranges[target + 1] + '] -> [' + this.ranges[base] + ', ' + this.ranges[target + 1] + ']');
                this.ranges[base + 1] = this.ranges[target + 1];
                baseend = this.ranges[base + 1];
                target += 2;
            } else {
                throw new RuntimeException('Token#compactRanges(): Internel Error: [' + this.ranges[base] + ',' + this.ranges[base + 1] + '] [' + this.ranges[target] + ',' + this.ranges[target + 1] + ']');
            }
        }
        base += 2;
    }
    if (base != this.ranges.length) {
        int[] result = new int[base];
        System.arraycopy(this.ranges, 0, result, 0, base);
        this.ranges = result;
    }
    this.setCompacted();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.findFixedString(FixedStringContainer, int)

final void findFixedString(FixedStringContainer container, int options) {
    switch(this.type) {
        case CONCAT:
            Token prevToken = null;
            int prevOptions = 0;
            for (int i = 0; i < this.size(); i++) {
                this.getChild(i).findFixedString(container, options);
                if (prevToken == null || prevToken.isShorterThan(container.token)) {
                    prevToken = container.token;
                    prevOptions = container.options;
                }
            }
            container.token = prevToken;
            container.options = prevOptions;
            return;
        case UNION:
        case CLOSURE:
        case NONGREEDYCLOSURE:
        case EMPTY:
        case ANCHOR:
        case RANGE:
        case DOT:
        case NRANGE:
        case BACKREFERENCE:
        case LOOKAHEAD:
        case NEGATIVELOOKAHEAD:
        case LOOKBEHIND:
        case NEGATIVELOOKBEHIND:
        case CONDITION:
            container.token = null;
            return;
        case CHAR:
            container.token = null;
            return;
        case STRING:
            container.token = this;
            container.options = options;
            return;
        case INDEPENDENT:
        case PAREN:
            this.getChild(0).findFixedString(container, options);
            return;
        case MODIFIERGROUP:
            options |= ((ModifierToken) this).getOptions();
            options &= ~((ModifierToken) this).getOptionsMask();
            this.getChild(0).findFixedString(container, options);
            return;
        default:
            throw new RuntimeException('Token#findFixedString(): Invalid Type: ' + this.type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.getMaxLength()

final int getMaxLength() {
    switch(this.type) {
        case CONCAT:
            int sum = 0;
            for (int i = 0; i < this.size(); i++) {
                int d = this.getChild(i).getMaxLength();
                if (d < 0) return -1;
                sum += d;
            }
            return sum;
        case CONDITION:
        case UNION:
            if (this.size() == 0) return 0;
            int ret = this.getChild(0).getMaxLength();
            for (int i = 1; ret >= 0 && i < this.size(); i++) {
                int max = this.getChild(i).getMaxLength();
                if (max < 0) {
                    ret = -1;
                    break;
                }
                if (max > ret) ret = max;
            }
            return ret;
        case CLOSURE:
        case NONGREEDYCLOSURE:
            if (this.getMax() >= 0) return this.getMax() * this.getChild(0).getMaxLength();
            return -1;
        case EMPTY:
        case ANCHOR:
            return 0;
        case CHAR:
            return 1;
        case DOT:
        case RANGE:
        case NRANGE:
            return 2;
        case INDEPENDENT:
        case PAREN:
        case MODIFIERGROUP:
            return this.getChild(0).getMaxLength();
        case BACKREFERENCE:
            return -1;
        case STRING:
            return this.getString().length();
        case LOOKAHEAD:
        case NEGATIVELOOKAHEAD:
        case LOOKBEHIND:
        case NEGATIVELOOKBEHIND:
            return 0;
        default:
            throw new RuntimeException('Token#getMaxLength(): Invalid Type: ' + this.type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.getMinLength()

/**
     * How many characters are needed?
     */
final int getMinLength() {
    switch(this.type) {
        case CONCAT:
            int sum = 0;
            for (int i = 0; i < this.size(); i++) sum += this.getChild(i).getMinLength();
            return sum;
        case CONDITION:
        case UNION:
            if (this.size() == 0) return 0;
            int ret = this.getChild(0).getMinLength();
            for (int i = 1; i < this.size(); i++) {
                int min = this.getChild(i).getMinLength();
                if (min < ret) ret = min;
            }
            return ret;
        case CLOSURE:
        case NONGREEDYCLOSURE:
            if (this.getMin() >= 0) return this.getMin() * this.getChild(0).getMinLength();
            return 0;
        case EMPTY:
        case ANCHOR:
            return 0;
        case DOT:
        case CHAR:
        case RANGE:
        case NRANGE:
            return 1;
        case INDEPENDENT:
        case PAREN:
        case MODIFIERGROUP:
            return this.getChild(0).getMinLength();
        case BACKREFERENCE:
            return 0;
        case STRING:
            return this.getString().length();
        case LOOKAHEAD:
        case NEGATIVELOOKAHEAD:
        case LOOKBEHIND:
        case NEGATIVELOOKBEHIND:
            return 0;
        default:
            throw new RuntimeException('Token#getMinLength(): Invalid Type: ' + this.type);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RangeToken.intersectRanges(Token)

/**
     * @param tok Ignore whether it is NRANGE or not.
     */
protected void intersectRanges(Token token) {
    RangeToken tok = (RangeToken) token;
    if (tok.ranges == null || this.ranges == null) return;
    this.icaseCache = null;
    this.sortRanges();
    this.compactRanges();
    tok.sortRanges();
    tok.compactRanges();
    int[] result = new int[this.ranges.length + tok.ranges.length];
    int wp = 0, src1 = 0, src2 = 0;
    while (src1 < this.ranges.length && src2 < tok.ranges.length) {
        int src1begin = this.ranges[src1];
        int src1end = this.ranges[src1 + 1];
        int src2begin = tok.ranges[src2];
        int src2end = tok.ranges[src2 + 1];
        if (src1end < src2begin) {
            src1 += 2;
        } else if (src1end >= src2begin && src1begin <= src2end) {
            if (src2begin <= src2begin && src1end <= src2end) {
                result[wp++] = src1begin;
                result[wp++] = src1end;
                src1 += 2;
            } else if (src2begin <= src1begin) {
                result[wp++] = src1begin;
                result[wp++] = src2end;
                this.ranges[src1] = src2end + 1;
                src2 += 2;
            } else if (src1end <= src2end) {
                result[wp++] = src2begin;
                result[wp++] = src1end;
                src1 += 2;
            } else {
                result[wp++] = src2begin;
                result[wp++] = src2end;
                this.ranges[src1] = src2end + 1;
            }
        } else if (src2end < src1begin) {
            src2 += 2;
        } else {
            throw new RuntimeException('Token#intersectRanges(): Internal Error: [' + this.ranges[src1] + ',' + this.ranges[src1 + 1] + '] & [' + tok.ranges[src2] + ',' + tok.ranges[src2 + 1] + ']');
        }
    }
    while (src1 < this.ranges.length) {
        result[wp++] = this.ranges[src1++];
        result[wp++] = this.ranges[src1++];
    }
    this.ranges = new int[wp];
    System.arraycopy(result, 0, this.ranges, 0, wp);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RangeToken.subtractRanges(Token)

protected void subtractRanges(Token token) {
    if (token.type == NRANGE) {
        this.intersectRanges(token);
        return;
    }
    RangeToken tok = (RangeToken) token;
    if (tok.ranges == null || this.ranges == null) return;
    this.icaseCache = null;
    this.sortRanges();
    this.compactRanges();
    tok.sortRanges();
    tok.compactRanges();
    int[] result = new int[this.ranges.length + tok.ranges.length];
    int wp = 0, src = 0, sub = 0;
    while (src < this.ranges.length && sub < tok.ranges.length) {
        int srcbegin = this.ranges[src];
        int srcend = this.ranges[src + 1];
        int subbegin = tok.ranges[sub];
        int subend = tok.ranges[sub + 1];
        if (srcend < subbegin) {
            result[wp++] = this.ranges[src++];
            result[wp++] = this.ranges[src++];
        } else if (srcend >= subbegin && srcbegin <= subend) {
            if (subbegin <= srcbegin && srcend <= subend) {
                src += 2;
            } else if (subbegin <= srcbegin) {
                this.ranges[src] = subend + 1;
                sub += 2;
            } else if (srcend <= subend) {
                result[wp++] = srcbegin;
                result[wp++] = subbegin - 1;
                src += 2;
            } else {
                result[wp++] = srcbegin;
                result[wp++] = subbegin - 1;
                this.ranges[src] = subend + 1;
                sub += 2;
            }
        } else if (subend < srcbegin) {
            sub += 2;
        } else {
            throw new RuntimeException('Token#subtractRanges(): Internal Error: [' + this.ranges[src] + ',' + this.ranges[src + 1] + '] - [' + tok.ranges[sub] + ',' + tok.ranges[sub + 1] + ']');
        }
    }
    while (src < this.ranges.length) {
        result[wp++] = this.ranges[src++];
        result[wp++] = this.ranges[src++];
    }
    this.ranges = new int[wp];
    System.arraycopy(result, 0, this.ranges, 0, wp);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.dynamicany.DynAnyImpl.factory()

protected DynAnyFactory factory() {
    try {
        return (DynAnyFactory) orb.resolve_initial_references(ORBConstants.DYN_ANY_FACTORY_NAME);
    } catch (InvalidName in) {
        throw new RuntimeException('Unable to find DynAnyFactory');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.CSSParser.readTill(char)

/**
     * Reads till a <code>stopChar</code> is encountered, escaping characters
     * as necessary.
     */
private void readTill(char stopChar) throws IOException {
    boolean lastWasEscape = false;
    int escapeCount = 0;
    int escapeChar = 0;
    int nextChar;
    boolean done = false;
    int intStopChar = (int) stopChar;
    short type;
    int escapeOffset = 0;
    tokenBufferLength = 0;
    while (!done) {
        nextChar = readChar();
        switch(nextChar) {
            case '\\':
                type = 1;
                break;
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                type = 2;
                escapeOffset = nextChar - '0';
                break;
            case 'a':
            case 'b':
            case 'c':
            case 'd':
            case 'e':
            case 'f':
                type = 2;
                escapeOffset = nextChar - 'a' + 10;
                break;
            case 'A':
            case 'B':
            case 'C':
            case 'D':
            case 'E':
            case 'F':
                type = 2;
                escapeOffset = nextChar - 'A' + 10;
                break;
            case -1:
                throw new RuntimeException('Unclosed ' + stopChar);
            default:
                type = 0;
                break;
        }
        if (lastWasEscape) {
            if (type == 2) {
                escapeChar = escapeChar * 16 + escapeOffset;
                if (++escapeCount == 4) {
                    lastWasEscape = false;
                    append((char) escapeChar);
                }
            } else {
                if (escapeCount > 0) {
                    append((char) escapeChar);
                    if (type == 1) {
                        lastWasEscape = true;
                        escapeChar = escapeCount = 0;
                    } else {
                        if (nextChar == intStopChar) {
                            done = true;
                        }
                        append((char) nextChar);
                        lastWasEscape = false;
                    }
                } else {
                    append((char) nextChar);
                    lastWasEscape = false;
                }
            }
        } else if (type == 1) {
            lastWasEscape = true;
            escapeChar = escapeCount = 0;
        } else {
            if (nextChar == intStopChar) {
                done = true;
            }
            append((char) nextChar);
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.CSSParser.parseTillClosed(int)

/**
     * Parses till a matching block close is encountered. This is only
     * appropriate to be called at the top level (no nesting).
     */
private void parseTillClosed(int openToken) throws IOException {
    int nextToken;
    boolean done = false;
    startBlock(openToken);
    while (!done) {
        nextToken = nextToken((char) 0);
        switch(nextToken) {
            case IDENTIFIER:
                if (unitBuffer.length() > 0 && readWS) {
                    unitBuffer.append(' ');
                }
                if (tokenBufferLength > 0) {
                    unitBuffer.append(tokenBuffer, 0, tokenBufferLength);
                }
                break;
            case BRACKET_OPEN:
            case BRACE_OPEN:
            case PAREN_OPEN:
                if (unitBuffer.length() > 0 && readWS) {
                    unitBuffer.append(' ');
                }
                unitBuffer.append(charMapping[nextToken]);
                startBlock(nextToken);
                break;
            case BRACKET_CLOSE:
            case BRACE_CLOSE:
            case PAREN_CLOSE:
                if (unitBuffer.length() > 0 && readWS) {
                    unitBuffer.append(' ');
                }
                unitBuffer.append(charMapping[nextToken]);
                endBlock(nextToken);
                if (!inBlock()) {
                    done = true;
                }
                break;
            case END:
                throw new RuntimeException('Unclosed block');
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.CSSParser.readComment()

/**
     * Parses a comment block.
     */
private void readComment() throws IOException {
    int nextChar;
    for (; ; ) {
        nextChar = readChar();
        switch(nextChar) {
            case -1:
                throw new RuntimeException('Unclosed comment');
            case '*':
                nextChar = readChar();
                if (nextChar == '/') {
                    return;
                } else if (nextChar == -1) {
                    throw new RuntimeException('Unclosed comment');
                } else {
                    pushChar(nextChar);
                }
                break;
            default:
                break;
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.CSSParser.parseSelectors()

/**
     * Parses a set of selectors, returning false if the end of the stream
     * is reached.
     */
private boolean parseSelectors() throws IOException {
    int nextToken;
    if (tokenBufferLength > 0) {
        callback.handleSelector(new String(tokenBuffer, 0, tokenBufferLength));
    }
    unitBuffer.setLength(0);
    for (; ; ) {
        while ((nextToken = nextToken((char) 0)) == IDENTIFIER) {
            if (tokenBufferLength > 0) {
                callback.handleSelector(new String(tokenBuffer, 0, tokenBufferLength));
            }
        }
        switch(nextToken) {
            case BRACE_OPEN:
                return true;
            case BRACKET_OPEN:
            case PAREN_OPEN:
                parseTillClosed(nextToken);
                unitBuffer.setLength(0);
                break;
            case BRACKET_CLOSE:
            case BRACE_CLOSE:
            case PAREN_CLOSE:
                throw new RuntimeException('Unexpected block close in selector');
            case END:
                return false;
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.CSSParser.parseAtRule()

/**
     * Parses an @ rule, stopping at a matching brace pair, or ;.
     */
private void parseAtRule() throws IOException {
    boolean done = false;
    boolean isImport = (tokenBufferLength == 7 && tokenBuffer[0] == '@' && tokenBuffer[1] == 'i' && tokenBuffer[2] == 'm' && tokenBuffer[3] == 'p' && tokenBuffer[4] == 'o' && tokenBuffer[5] == 'r' && tokenBuffer[6] == 't');
    unitBuffer.setLength(0);
    while (!done) {
        int nextToken = nextToken(';');
        switch(nextToken) {
            case IDENTIFIER:
                if (tokenBufferLength > 0 && tokenBuffer[tokenBufferLength - 1] == ';') {
                    --tokenBufferLength;
                    done = true;
                }
                if (tokenBufferLength > 0) {
                    if (unitBuffer.length() > 0 && readWS) {
                        unitBuffer.append(' ');
                    }
                    unitBuffer.append(tokenBuffer, 0, tokenBufferLength);
                }
                break;
            case BRACE_OPEN:
                if (unitBuffer.length() > 0 && readWS) {
                    unitBuffer.append(' ');
                }
                unitBuffer.append(charMapping[nextToken]);
                parseTillClosed(nextToken);
                done = true;
                {
                    int nextChar = readWS();
                    if (nextChar != -1 && nextChar != ';') {
                        pushChar(nextChar);
                    }
                }
                break;
            case BRACKET_OPEN:
            case PAREN_OPEN:
                unitBuffer.append(charMapping[nextToken]);
                parseTillClosed(nextToken);
                break;
            case BRACKET_CLOSE:
            case BRACE_CLOSE:
            case PAREN_CLOSE:
                throw new RuntimeException('Unexpected close in @ rule');
            case END:
                done = true;
                break;
        }
    }
    if (isImport && !encounteredRuleSet) {
        callback.handleImport(unitBuffer.toString());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.CSSParser.parseDeclarationBlock()

/**
     * Parses a declaration block. Which a number of declarations followed
     * by a })].
     */
private void parseDeclarationBlock() throws IOException {
    for (; ; ) {
        int token = parseDeclaration();
        switch(token) {
            case END:
            case BRACE_CLOSE:
                return;
            case BRACKET_CLOSE:
            case PAREN_CLOSE:
                throw new RuntimeException('Unexpected close in declaration block');
            case IDENTIFIER:
                break;
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.CSSParser.getNextStatement()

/**
     * Gets the next statement, returning false if the end is reached. A
     * statement is either an @rule, or a ruleset.
     */
private boolean getNextStatement() throws IOException {
    unitBuffer.setLength(0);
    int token = nextToken((char) 0);
    switch(token) {
        case IDENTIFIER:
            if (tokenBufferLength > 0) {
                if (tokenBuffer[0] == '@') {
                    parseAtRule();
                } else {
                    encounteredRuleSet = true;
                    parseRuleSet();
                }
            }
            return true;
        case BRACKET_OPEN:
        case BRACE_OPEN:
        case PAREN_OPEN:
            parseTillClosed(token);
            return true;
        case BRACKET_CLOSE:
        case BRACE_CLOSE:
        case PAREN_CLOSE:
            throw new RuntimeException('Unexpected top level block close');
        case END:
            return false;
    }
    return true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.classfile.ConstantPool.constantToString(Constant)

/**
   * Resolve constant to a string representation.
   * @param  constant Constant to be printed
   * @return String representation
   */
public String constantToString(Constant c) throws ClassFormatError {
    String str;
    int i;
    byte tag = c.getTag();
    switch(tag) {
        case Constants.CONSTANT_Class:
            i = ((ConstantClass) c).getNameIndex();
            c = getConstant(i, Constants.CONSTANT_Utf8);
            str = Utility.compactClassName(((ConstantUtf8) c).getBytes(), false);
            break;
        case Constants.CONSTANT_String:
            i = ((ConstantString) c).getStringIndex();
            c = getConstant(i, Constants.CONSTANT_Utf8);
            str = '\'' + escape(((ConstantUtf8) c).getBytes()) + '\'';
            break;
        case Constants.CONSTANT_Utf8:
            str = ((ConstantUtf8) c).getBytes();
            break;
        case Constants.CONSTANT_Double:
            str = '' + ((ConstantDouble) c).getBytes();
            break;
        case Constants.CONSTANT_Float:
            str = '' + ((ConstantFloat) c).getBytes();
            break;
        case Constants.CONSTANT_Long:
            str = '' + ((ConstantLong) c).getBytes();
            break;
        case Constants.CONSTANT_Integer:
            str = '' + ((ConstantInteger) c).getBytes();
            break;
        case Constants.CONSTANT_NameAndType:
            str = (constantToString(((ConstantNameAndType) c).getNameIndex(), Constants.CONSTANT_Utf8) + ' ' + constantToString(((ConstantNameAndType) c).getSignatureIndex(), Constants.CONSTANT_Utf8));
            break;
        case Constants.CONSTANT_InterfaceMethodref:
        case Constants.CONSTANT_Methodref:
        case Constants.CONSTANT_Fieldref:
            str = (constantToString(((ConstantCP) c).getClassIndex(), Constants.CONSTANT_Class) + '.' + constantToString(((ConstantCP) c).getNameAndTypeIndex(), Constants.CONSTANT_NameAndType));
            break;
        default:
            throw new RuntimeException('Unknown constant type ' + tag);
    }
    return str;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.ConstantPoolGen.addConstant(Constant, ConstantPoolGen)

/** Import constant from another ConstantPool and return new index.
   */
public int addConstant(Constant c, ConstantPoolGen cp) {
    Constant[] constants = cp.getConstantPool().getConstantPool();
    switch(c.getTag()) {
        case Constants.CONSTANT_String:
            {
                ConstantString s = (ConstantString) c;
                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getStringIndex()];
                return addString(u8.getBytes());
            }
        case Constants.CONSTANT_Class:
            {
                ConstantClass s = (ConstantClass) c;
                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getNameIndex()];
                return addClass(u8.getBytes());
            }
        case Constants.CONSTANT_NameAndType:
            {
                ConstantNameAndType n = (ConstantNameAndType) c;
                ConstantUtf8 u8 = (ConstantUtf8) constants[n.getNameIndex()];
                ConstantUtf8 u8_2 = (ConstantUtf8) constants[n.getSignatureIndex()];
                return addNameAndType(u8.getBytes(), u8_2.getBytes());
            }
        case Constants.CONSTANT_Utf8:
            return addUtf8(((ConstantUtf8) c).getBytes());
        case Constants.CONSTANT_Double:
            return addDouble(((ConstantDouble) c).getBytes());
        case Constants.CONSTANT_Float:
            return addFloat(((ConstantFloat) c).getBytes());
        case Constants.CONSTANT_Long:
            return addLong(((ConstantLong) c).getBytes());
        case Constants.CONSTANT_Integer:
            return addInteger(((ConstantInteger) c).getBytes());
        case Constants.CONSTANT_InterfaceMethodref:
        case Constants.CONSTANT_Methodref:
        case Constants.CONSTANT_Fieldref:
            {
                ConstantCP m = (ConstantCP) c;
                ConstantClass clazz = (ConstantClass) constants[m.getClassIndex()];
                ConstantNameAndType n = (ConstantNameAndType) constants[m.getNameAndTypeIndex()];
                ConstantUtf8 u8 = (ConstantUtf8) constants[clazz.getNameIndex()];
                String class_name = u8.getBytes().replace('/', '.');
                u8 = (ConstantUtf8) constants[n.getNameIndex()];
                String name = u8.getBytes();
                u8 = (ConstantUtf8) constants[n.getSignatureIndex()];
                String signature = u8.getBytes();
                switch(c.getTag()) {
                    case Constants.CONSTANT_InterfaceMethodref:
                        return addInterfaceMethodref(class_name, name, signature);
                    case Constants.CONSTANT_Methodref:
                        return addMethodref(class_name, name, signature);
                    case Constants.CONSTANT_Fieldref:
                        return addFieldref(class_name, name, signature);
                    default:
                        throw new RuntimeException('Unknown constant type ' + c);
                }
            }
        default:
            throw new RuntimeException('Unknown constant type ' + c);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.LDC2_W.getType(ConstantPoolGen)

public Type getType(ConstantPoolGen cpg) {
    switch(cpg.getConstantPool().getConstant(index).getTag()) {
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Long:
            return Type.LONG;
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Double:
            return Type.DOUBLE;
        default:
            throw new RuntimeException('Unknown constant type ' + opcode);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.getElementContentModelValidator(int)

/**
     * getElementContentModelValidator
     * @param elementDeclIndex 
     * @return its ContentModelValidator if any.
     */
protected ContentModelValidator getElementContentModelValidator(int elementDeclIndex) {
    int chunk = elementDeclIndex >> CHUNK_SHIFT;
    int index = elementDeclIndex & CHUNK_MASK;
    ContentModelValidator contentModel = fElementDeclContentModelValidator[chunk][index];
    if (contentModel != null) {
        return contentModel;
    }
    int contentType = fElementDeclType[chunk][index];
    if (contentType == XMLElementDecl.TYPE_SIMPLE) {
        return null;
    }
    int contentSpecIndex = fElementDeclContentSpecIndex[chunk][index];
    XMLContentSpec contentSpec = new XMLContentSpec();
    getContentSpec(contentSpecIndex, contentSpec);
    if (contentType == XMLElementDecl.TYPE_MIXED) {
        ChildrenList children = new ChildrenList();
        contentSpecTree(contentSpecIndex, contentSpec, children);
        contentModel = new MixedContentModel(children.qname, children.type, 0, children.length, false);
    } else if (contentType == XMLElementDecl.TYPE_CHILDREN) {
        contentModel = createChildModel(contentSpecIndex);
    } else {
        throw new RuntimeException('Unknown content type for a element decl ' + 'in getElementContentModelValidator() in AbstractDTDGrammar class');
    }
    fElementDeclContentModelValidator[chunk][index] = contentModel;
    return contentModel;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.LDC.getType(ConstantPoolGen)

public Type getType(ConstantPoolGen cpg) {
    switch(cpg.getConstantPool().getConstant(index).getTag()) {
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_String:
            return Type.STRING;
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Float:
            return Type.FLOAT;
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Integer:
            return Type.INT;
        default:
            throw new RuntimeException('Unknown or invalid constant type at ' + index);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.LDC.getValue(ConstantPoolGen)

public Object getValue(ConstantPoolGen cpg) {
    com.sun.org.apache.bcel.internal.classfile.Constant c = cpg.getConstantPool().getConstant(index);
    switch(c.getTag()) {
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_String:
            int i = ((com.sun.org.apache.bcel.internal.classfile.ConstantString) c).getStringIndex();
            c = cpg.getConstantPool().getConstant(i);
            return ((com.sun.org.apache.bcel.internal.classfile.ConstantUtf8) c).getBytes();
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Float:
            return new Float(((com.sun.org.apache.bcel.internal.classfile.ConstantFloat) c).getBytes());
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Integer:
            return new Integer(((com.sun.org.apache.bcel.internal.classfile.ConstantInteger) c).getBytes());
        default:
            throw new RuntimeException('Unknown or invalid constant type at ' + index);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.LDC2_W.getValue(ConstantPoolGen)

public Number getValue(ConstantPoolGen cpg) {
    com.sun.org.apache.bcel.internal.classfile.Constant c = cpg.getConstantPool().getConstant(index);
    switch(c.getTag()) {
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Long:
            return new Long(((com.sun.org.apache.bcel.internal.classfile.ConstantLong) c).getBytes());
        case com.sun.org.apache.bcel.internal.Constants.CONSTANT_Double:
            return new Double(((com.sun.org.apache.bcel.internal.classfile.ConstantDouble) c).getBytes());
        default:
            throw new RuntimeException('Unknown or invalid constant type at ' + index);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression.compile(Token, Op, boolean)

/**
     * Converts a token to an operation.
     */
private Op compile(Token tok, Op next, boolean reverse) {
    Op ret;
    switch(tok.type) {
        case Token.DOT:
            ret = Op.createDot();
            ret.next = next;
            break;
        case Token.CHAR:
            ret = Op.createChar(tok.getChar());
            ret.next = next;
            break;
        case Token.ANCHOR:
            ret = Op.createAnchor(tok.getChar());
            ret.next = next;
            break;
        case Token.RANGE:
        case Token.NRANGE:
            ret = Op.createRange(tok);
            ret.next = next;
            break;
        case Token.CONCAT:
            ret = next;
            if (!reverse) {
                for (int i = tok.size() - 1; i >= 0; i--) {
                    ret = compile(tok.getChild(i), ret, false);
                }
            } else {
                for (int i = 0; i < tok.size(); i++) {
                    ret = compile(tok.getChild(i), ret, true);
                }
            }
            break;
        case Token.UNION:
            Op.UnionOp uni = Op.createUnion(tok.size());
            for (int i = 0; i < tok.size(); i++) {
                uni.addElement(compile(tok.getChild(i), next, reverse));
            }
            ret = uni;
            break;
        case Token.CLOSURE:
        case Token.NONGREEDYCLOSURE:
            Token child = tok.getChild(0);
            int min = tok.getMin();
            int max = tok.getMax();
            if (min >= 0 && min == max) {
                ret = next;
                for (int i = 0; i < min; i++) {
                    ret = compile(child, ret, reverse);
                }
                break;
            }
            if (min > 0 && max > 0) max -= min;
            if (max > 0) {
                ret = next;
                for (int i = 0; i < max; i++) {
                    Op.ChildOp q = Op.createQuestion(tok.type == Token.NONGREEDYCLOSURE);
                    q.next = next;
                    q.setChild(compile(child, ret, reverse));
                    ret = q;
                }
            } else {
                Op.ChildOp op;
                if (tok.type == Token.NONGREEDYCLOSURE) {
                    op = Op.createNonGreedyClosure();
                } else {
                    if (child.getMinLength() == 0) op = Op.createClosure(this.numberOfClosures++); else op = Op.createClosure(-1);
                }
                op.next = next;
                op.setChild(compile(child, op, reverse));
                ret = op;
            }
            if (min > 0) {
                for (int i = 0; i < min; i++) {
                    ret = compile(child, ret, reverse);
                }
            }
            break;
        case Token.EMPTY:
            ret = next;
            break;
        case Token.STRING:
            ret = Op.createString(tok.getString());
            ret.next = next;
            break;
        case Token.BACKREFERENCE:
            ret = Op.createBackReference(tok.getReferenceNumber());
            ret.next = next;
            break;
        case Token.PAREN:
            if (tok.getParenNumber() == 0) {
                ret = compile(tok.getChild(0), next, reverse);
            } else if (reverse) {
                next = Op.createCapture(tok.getParenNumber(), next);
                next = compile(tok.getChild(0), next, reverse);
                ret = Op.createCapture(-tok.getParenNumber(), next);
            } else {
                next = Op.createCapture(-tok.getParenNumber(), next);
                next = compile(tok.getChild(0), next, reverse);
                ret = Op.createCapture(tok.getParenNumber(), next);
            }
            break;
        case Token.LOOKAHEAD:
            ret = Op.createLook(Op.LOOKAHEAD, next, compile(tok.getChild(0), null, false));
            break;
        case Token.NEGATIVELOOKAHEAD:
            ret = Op.createLook(Op.NEGATIVELOOKAHEAD, next, compile(tok.getChild(0), null, false));
            break;
        case Token.LOOKBEHIND:
            ret = Op.createLook(Op.LOOKBEHIND, next, compile(tok.getChild(0), null, true));
            break;
        case Token.NEGATIVELOOKBEHIND:
            ret = Op.createLook(Op.NEGATIVELOOKBEHIND, next, compile(tok.getChild(0), null, true));
            break;
        case Token.INDEPENDENT:
            ret = Op.createIndependent(next, compile(tok.getChild(0), null, reverse));
            break;
        case Token.MODIFIERGROUP:
            ret = Op.createModifier(next, compile(tok.getChild(0), null, reverse), ((Token.ModifierToken) tok).getOptions(), ((Token.ModifierToken) tok).getOptionsMask());
            break;
        case Token.CONDITION:
            Token.ConditionToken ctok = (Token.ConditionToken) tok;
            int ref = ctok.refNumber;
            Op condition = ctok.condition == null ? null : compile(ctok.condition, null, reverse);
            Op yes = compile(ctok.yes, next, reverse);
            Op no = ctok.no == null ? null : compile(ctok.no, next, reverse);
            ret = Op.createCondition(next, ref, condition, yes, no);
            break;
        default:
            throw new RuntimeException('Unknown token type: ' + tok.type);
    }
    return ret;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.swing.text.html.CSSParser.endBlock(int)

/**
     * Called when an end block is encountered )]}
     */
private void endBlock(int endToken) {
    int startToken;
    switch(endToken) {
        case BRACKET_CLOSE:
            startToken = BRACKET_OPEN;
            break;
        case BRACE_CLOSE:
            startToken = BRACE_OPEN;
            break;
        case PAREN_CLOSE:
            startToken = PAREN_OPEN;
            break;
        default:
            startToken = -1;
            break;
    }
    if (stackCount > 0 && unitStack[stackCount - 1] == startToken) {
        stackCount--;
    } else {
        throw new RuntimeException('Unmatched block');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.beans.MetaData.instantiate(Object, Encoder)

protected Expression instantiate(Object oldInstance, Encoder out) {
    throw new RuntimeException('Unrecognized instance: ' + oldInstance);
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.xml.xpath.XPathFactory.newInstance()

/**
     * Get a new <code>XPathFactory</code> instance using the default object model,
     * {@link #DEFAULT_OBJECT_MODEL_URI},
     * the W3C DOM.
     * This method is functionally equivalent to:
     *   newInstance(DEFAULT_OBJECT_MODEL_URI)
     * 
     * Since the implementation for the W3C DOM is always available, this method will never fail. 
     * @return Instance of an <code>XPathFactory</code>.
     */
public static final XPathFactory newInstance() {
    try {
        return newInstance(DEFAULT_OBJECT_MODEL_URI);
    } catch (XPathFactoryConfigurationException xpathFactoryConfigurationException) {
        throw new RuntimeException('XPathFactory#newInstance() failed to create an XPathFactory for the default object model: ' + DEFAULT_OBJECT_MODEL_URI + ' with the XPathFactoryConfigurationException: ' + xpathFactoryConfigurationException.toString());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.xpath.regex.Token.getRange(String, boolean)

protected static RangeToken getRange(String name, boolean positive) {
    if (Token.categories.size() == 0) {
        synchronized (Token.categories) {
            Token[] ranges = new Token[Token.categoryNames.length];
            for (int i = 0; i < ranges.length; i++) {
                ranges[i] = Token.createRange();
            }
            int type;
            for (int i = 0; i < 0x10000; i++) {
                type = Character.getType((char) i);
                if (type == Character.START_PUNCTUATION || type == Character.END_PUNCTUATION) {
                    if (i == 0x00AB || i == 0x2018 || i == 0x201B || i == 0x201C || i == 0x201F || i == 0x2039) {
                        type = CHAR_INIT_QUOTE;
                    }
                    if (i == 0x00BB || i == 0x2019 || i == 0x201D || i == 0x203A) {
                        type = CHAR_FINAL_QUOTE;
                    }
                }
                ranges[type].addRange(i, i);
                switch(type) {
                    case Character.UPPERCASE_LETTER:
                    case Character.LOWERCASE_LETTER:
                    case Character.TITLECASE_LETTER:
                    case Character.MODIFIER_LETTER:
                    case Character.OTHER_LETTER:
                        type = CHAR_LETTER;
                        break;
                    case Character.NON_SPACING_MARK:
                    case Character.COMBINING_SPACING_MARK:
                    case Character.ENCLOSING_MARK:
                        type = CHAR_MARK;
                        break;
                    case Character.DECIMAL_DIGIT_NUMBER:
                    case Character.LETTER_NUMBER:
                    case Character.OTHER_NUMBER:
                        type = CHAR_NUMBER;
                        break;
                    case Character.SPACE_SEPARATOR:
                    case Character.LINE_SEPARATOR:
                    case Character.PARAGRAPH_SEPARATOR:
                        type = CHAR_SEPARATOR;
                        break;
                    case Character.CONTROL:
                    case Character.FORMAT:
                    case Character.SURROGATE:
                    case Character.PRIVATE_USE:
                    case Character.UNASSIGNED:
                        type = CHAR_OTHER;
                        break;
                    case Character.CONNECTOR_PUNCTUATION:
                    case Character.DASH_PUNCTUATION:
                    case Character.START_PUNCTUATION:
                    case Character.END_PUNCTUATION:
                    case CHAR_INIT_QUOTE:
                    case CHAR_FINAL_QUOTE:
                    case Character.OTHER_PUNCTUATION:
                        type = CHAR_PUNCTUATION;
                        break;
                    case Character.MATH_SYMBOL:
                    case Character.CURRENCY_SYMBOL:
                    case Character.MODIFIER_SYMBOL:
                    case Character.OTHER_SYMBOL:
                        type = CHAR_SYMBOL;
                        break;
                    default:
                        throw new RuntimeException('com.sun.org.apache.xerces.internal.utils.regex.Token#getRange(): Unknown Unicode category: ' + type);
                }
                ranges[type].addRange(i, i);
            }
            ranges[Character.UNASSIGNED].addRange(0x10000, Token.UTF16_MAX);
            for (int i = 0; i < ranges.length; i++) {
                if (Token.categoryNames[i] != null) {
                    if (i == Character.UNASSIGNED) {
                        ranges[i].addRange(0x10000, Token.UTF16_MAX);
                    }
                    Token.categories.put(Token.categoryNames[i], ranges[i]);
                    Token.categories2.put(Token.categoryNames[i], Token.complementRanges(ranges[i]));
                }
            }
            StringBuffer buffer = new StringBuffer(50);
            for (int i = 0; i < Token.blockNames.length; i++) {
                Token r1 = Token.createRange();
                int location;
                if (i < NONBMP_BLOCK_START) {
                    location = i * 2;
                    int rstart = Token.blockRanges.charAt(location);
                    int rend = Token.blockRanges.charAt(location + 1);
                    r1.addRange(rstart, rend);
                } else {
                    location = (i - NONBMP_BLOCK_START) * 2;
                    r1.addRange(Token.nonBMPBlockRanges[location], Token.nonBMPBlockRanges[location + 1]);
                }
                String n = Token.blockNames[i];
                if (n.equals('Specials')) r1.addRange(0xfff0, 0xfffd);
                if (n.equals('Private Use')) {
                    r1.addRange(0xF0000, 0xFFFFD);
                    r1.addRange(0x100000, 0x10FFFD);
                }
                Token.categories.put(n, r1);
                Token.categories2.put(n, Token.complementRanges(r1));
                buffer.setLength(0);
                buffer.append('Is');
                if (n.indexOf(' ') >= 0) {
                    for (int ci = 0; ci < n.length(); ci++) if (n.charAt(ci) != ' ') buffer.append((char) n.charAt(ci));
                } else {
                    buffer.append(n);
                }
                Token.setAlias(buffer.toString(), n, true);
            }
            Token.setAlias('ASSIGNED', 'Cn', false);
            Token.setAlias('UNASSIGNED', 'Cn', true);
            Token all = Token.createRange();
            all.addRange(0, Token.UTF16_MAX);
            Token.categories.put('ALL', all);
            Token.categories2.put('ALL', Token.complementRanges(all));
            Token.registerNonXS('ASSIGNED');
            Token.registerNonXS('UNASSIGNED');
            Token.registerNonXS('ALL');
            Token isalpha = Token.createRange();
            isalpha.mergeRanges(ranges[Character.UPPERCASE_LETTER]);
            isalpha.mergeRanges(ranges[Character.LOWERCASE_LETTER]);
            isalpha.mergeRanges(ranges[Character.OTHER_LETTER]);
            Token.categories.put('IsAlpha', isalpha);
            Token.categories2.put('IsAlpha', Token.complementRanges(isalpha));
            Token.registerNonXS('IsAlpha');
            Token isalnum = Token.createRange();
            isalnum.mergeRanges(isalpha);
            isalnum.mergeRanges(ranges[Character.DECIMAL_DIGIT_NUMBER]);
            Token.categories.put('IsAlnum', isalnum);
            Token.categories2.put('IsAlnum', Token.complementRanges(isalnum));
            Token.registerNonXS('IsAlnum');
            Token isspace = Token.createRange();
            isspace.mergeRanges(Token.token_spaces);
            isspace.mergeRanges(ranges[CHAR_SEPARATOR]);
            Token.categories.put('IsSpace', isspace);
            Token.categories2.put('IsSpace', Token.complementRanges(isspace));
            Token.registerNonXS('IsSpace');
            Token isword = Token.createRange();
            isword.mergeRanges(isalnum);
            isword.addRange('_', '_');
            Token.categories.put('IsWord', isword);
            Token.categories2.put('IsWord', Token.complementRanges(isword));
            Token.registerNonXS('IsWord');
            Token isascii = Token.createRange();
            isascii.addRange(0, 127);
            Token.categories.put('IsASCII', isascii);
            Token.categories2.put('IsASCII', Token.complementRanges(isascii));
            Token.registerNonXS('IsASCII');
            Token isnotgraph = Token.createRange();
            isnotgraph.mergeRanges(ranges[CHAR_OTHER]);
            isnotgraph.addRange(' ', ' ');
            Token.categories.put('IsGraph', Token.complementRanges(isnotgraph));
            Token.categories2.put('IsGraph', isnotgraph);
            Token.registerNonXS('IsGraph');
            Token isxdigit = Token.createRange();
            isxdigit.addRange('0', '9');
            isxdigit.addRange('A', 'F');
            isxdigit.addRange('a', 'f');
            Token.categories.put('IsXDigit', Token.complementRanges(isxdigit));
            Token.categories2.put('IsXDigit', isxdigit);
            Token.registerNonXS('IsXDigit');
            Token.setAlias('IsDigit', 'Nd', true);
            Token.setAlias('IsUpper', 'Lu', true);
            Token.setAlias('IsLower', 'Ll', true);
            Token.setAlias('IsCntrl', 'C', true);
            Token.setAlias('IsPrint', 'C', false);
            Token.setAlias('IsPunct', 'P', true);
            Token.registerNonXS('IsDigit');
            Token.registerNonXS('IsUpper');
            Token.registerNonXS('IsLower');
            Token.registerNonXS('IsCntrl');
            Token.registerNonXS('IsPrint');
            Token.registerNonXS('IsPunct');
            Token.setAlias('alpha', 'IsAlpha', true);
            Token.setAlias('alnum', 'IsAlnum', true);
            Token.setAlias('ascii', 'IsASCII', true);
            Token.setAlias('cntrl', 'IsCntrl', true);
            Token.setAlias('digit', 'IsDigit', true);
            Token.setAlias('graph', 'IsGraph', true);
            Token.setAlias('lower', 'IsLower', true);
            Token.setAlias('print', 'IsPrint', true);
            Token.setAlias('punct', 'IsPunct', true);
            Token.setAlias('space', 'IsSpace', true);
            Token.setAlias('upper', 'IsUpper', true);
            Token.setAlias('word', 'IsWord', true);
            Token.setAlias('xdigit', 'IsXDigit', true);
            Token.registerNonXS('alpha');
            Token.registerNonXS('alnum');
            Token.registerNonXS('ascii');
            Token.registerNonXS('cntrl');
            Token.registerNonXS('digit');
            Token.registerNonXS('graph');
            Token.registerNonXS('lower');
            Token.registerNonXS('print');
            Token.registerNonXS('punct');
            Token.registerNonXS('space');
            Token.registerNonXS('upper');
            Token.registerNonXS('word');
            Token.registerNonXS('xdigit');
        }
    }
    RangeToken tok = positive ? (RangeToken) Token.categories.get(name) : (RangeToken) Token.categories2.get(name);
    return tok;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.corba.se.impl.transport.SharedCDRContactInfoImpl.createMessageMediator(Broker, ContactInfo, Connection, String, boolean)

public MessageMediator createMessageMediator(Broker broker, ContactInfo contactInfo, Connection connection, String methodName, boolean isOneWay) {
    if (connection != null) {
        throw new RuntimeException('connection is not null');
    }
    CorbaMessageMediator messageMediator = new CorbaMessageMediatorImpl((ORB) broker, contactInfo, null, GIOPVersion.chooseRequestVersion((ORB) broker, effectiveTargetIOR), effectiveTargetIOR, requestId++, getAddressingDisposition(), methodName, isOneWay);
    return messageMediator;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.beans.Encoder.getValue(Expression)

Object getValue(Expression exp) {
    try {
        return (exp == null) ? null : exp.getValue();
    } catch (Exception e) {
        getExceptionListener().exceptionThrown(e);
        throw new RuntimeException('failed to evaluate: ' + exp.toString());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.dnd.DragSource.load(String)

private static Cursor load(String name) {
    if (GraphicsEnvironment.isHeadless()) {
        return null;
    }
    try {
        return (Cursor) Toolkit.getDefaultToolkit().getDesktopProperty(name);
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException('failed to load system cursor: ' + name + ' : ' + e.getMessage());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.classfile.ConstantPool.getConstantString(int, byte)

/**
   * Get string from constant pool and bypass the indirection of 
   * `ConstantClass' and `ConstantString' objects. I.e. these classes have
   * an index field that points to another entry of the constant pool of
   * type `ConstantUtf8' which contains the real data.
   * @param  index Index in constant pool
   * @param  tag Tag of expected constant, either ConstantClass or ConstantString
   * @return Contents of string reference
   * @see    ConstantClass
   * @see    ConstantString
   * @throw  ClassFormatError
   */
public String getConstantString(int index, byte tag) throws ClassFormatError {
    Constant c;
    int i;
    String s;
    c = getConstant(index, tag);
    switch(tag) {
        case Constants.CONSTANT_Class:
            i = ((ConstantClass) c).getNameIndex();
            break;
        case Constants.CONSTANT_String:
            i = ((ConstantString) c).getStringIndex();
            break;
        default:
            throw new RuntimeException('getConstantString called with illegal tag ' + tag);
    }
    c = getConstant(i, Constants.CONSTANT_Utf8);
    return ((ConstantUtf8) c).getBytes();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dv.xs.XSSimpleTypeDecl.applyFacets1(XSFacets, short, short)

/**
     * built-in derived types by restriction
     */
void applyFacets1(XSFacets facets, short presentFacet, short fixedFacet) {
    try {
        applyFacets(facets, presentFacet, fixedFacet, SPECIAL_PATTERN_NONE, fDummyContext);
    } catch (InvalidDatatypeFacetException e) {
        throw new RuntimeException('internal error');
    }
    fIsImmutable = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.xerces.internal.impl.dv.xs.XSSimpleTypeDecl.applyFacets1(XSFacets, short, short, short)

/**
     * built-in derived types by restriction
     */
void applyFacets1(XSFacets facets, short presentFacet, short fixedFacet, short patternType) {
    try {
        applyFacets(facets, presentFacet, fixedFacet, patternType, fDummyContext);
    } catch (InvalidDatatypeFacetException e) {
        throw new RuntimeException('internal error');
    }
    fIsImmutable = true;
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.xml.transform.stream.StreamResult.setSystemId(File)

/**
     * Set the system ID from a <code>File</code> reference.
     * Note the use of {@link File#toURI()} and {@link File#toURL()}.
     * <code>toURI()</code> is prefered and used if possible.
     * To allow JAXP 1.3 to run on J2SE 1.3, <code>toURL()</code>
     * is used if a {@link NoSuchMethodException} is thrown by the attempt
     * to use <code>toURI()</code>.
     * @param f Must a non-null File reference.
     */
public void setSystemId(File f) {
    try {
        this.systemId = f.toURI().toString();
    } catch (java.lang.NoSuchMethodError nme) {
        try {
            this.systemId = f.toURL().toString();
        } catch (MalformedURLException malformedURLException) {
            this.systemId = null;
            throw new RuntimeException('javax.xml.transform.stream.StreamResult#setSystemId(File f) with MalformedURLException: ' + malformedURLException.toString());
        }
    } catch (Exception exception) {
        throw new RuntimeException('javax.xml.transform.stream.StreamResult#setSystemId(File f):' + ' unexpected Exception: ' + exception.toString());
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

java.awt.PopupMenu.show(Component, int, int)

/**
     * Shows the popup menu at the x, y position relative to an origin
     * component.
     * The origin component must be contained within the component
     * hierarchy of the popup menu's parent.  Both the origin and the parent 
     * must be showing on the screen for this method to be valid.
     * If this <code>PopupMenu</code> is being used as a <code>Menu</code>
     * (i.e., it has a non-<code>Component</code> parent),
     * then you cannot call this method on the <code>PopupMenu</code>.
     * @param origin the component which defines the coordinate space
     * @param x the x coordinate position to popup the menu
     * @param y the y coordinate position to popup the menu
     * @exception NullPointerException  if the parent is <code>null</code>
     * @exception IllegalArgumentException  if this <code>PopupMenu</code>
     *                has a non-<code>Component</code> parent
     * @exception IllegalArgumentException if the origin is not in the
     *                parent's heirarchy
     * @exception RuntimeException if the parent is not showing on screen
     */
public void show(Component origin, int x, int y) {
    MenuContainer localParent = parent;
    if (localParent == null) {
        throw new NullPointerException('parent is null');
    }
    if (!(localParent instanceof Component)) {
        throw new IllegalArgumentException('PopupMenus with non-Component parents cannot be shown');
    }
    Component compParent = (Component) localParent;
    if (compParent != origin && compParent instanceof Container && !((Container) compParent).isAncestorOf(origin)) {
        throw new IllegalArgumentException('origin not in parent's hierarchy');
    }
    if (compParent.getPeer() == null || !compParent.isShowing()) {
        throw new RuntimeException('parent not showing on screen');
    }
    if (peer == null) {
        addNotify();
    }
    synchronized (getTreeLock()) {
        if (peer != null) {
            ((PopupMenuPeer) peer).show(new Event(origin, 0, Event.MOUSE_DOWN, x, y, 0, 0));
        }
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

com.sun.org.apache.bcel.internal.generic.JsrInstruction.physicalSuccessor()

/**
  * Returns an InstructionHandle to the physical successor
  * of this JsrInstruction. <B>For this method to work,
  * this JsrInstruction object must not be shared between
  * multiple InstructionHandle objects!</B>
  * Formally, there must not be InstructionHandle objects
  * i, j where i != j and i.getInstruction() == this ==
  * j.getInstruction().
  * @return an InstructionHandle to the 'next' instruction that
  * will be executed when RETurned from a subroutine.
  */
public InstructionHandle physicalSuccessor() {
    InstructionHandle ih = this.target;
    while (ih.getPrev() != null) ih = ih.getPrev();
    while (ih.getInstruction() != this) ih = ih.getNext();
    InstructionHandle toThis = ih;
    while (ih != null) {
        ih = ih.getNext();
        if ((ih != null) && (ih.getInstruction() == this)) throw new RuntimeException('physicalSuccessor() called on a shared JsrInstruction.');
    }
    return toThis.getNext();
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

javax.security.auth.x500.X500Principal.getEncoded()

/**
     * Returns the distinguished name in ASN.1 DER encoded form. The ASN.1
     * notation for this structure is supplied in the documentation for
     * {@link #X500Principal(byte[] name) X500Principal(byte[] name)}.
     * Note that the byte array returned is cloned to protect against
     * subsequent modifications.
     * @return a byte array containing the distinguished name in ASN.1 DER 
     * encoded form
     */
public byte[] getEncoded() {
    try {
        return thisX500Name.getEncoded();
    } catch (IOException e) {
        throw new RuntimeException('unable to get encoding', e);
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Comments

Popular posts from this blog

NullPointerException

java.lang.NullPointerException NullPointerException is described in the javadoc comments as: Thrown when an application attempts to use null in a case where an object is required. These include: Calling the instance method of a null object. Accessing or modifying the field of a null object. Taking the length of null as if it were an array. Accessing or modifying the slots of null as if it were an array. Throwing null as if it were a Throwable value. Applications should throw instances of this class to indicate other illegal uses of the null object. author: unascribed version: 1.19, 12/19/03 since: JDK1.0 Where is this exception thrown? Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown. The message ' java.lang.NullPointerException: ' is thrown within the method: com.sun.corba.se.impl.interceptors.ClientRequestInfoImpl.get_r

Connection refused: No available router to destination

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators. Symptom The following exception occurs in WebLogic server logs. Most likely to occur during WebLogic server start-up, but similar exceptions may occur at other times. java.net.ConnectException: t3://myserver:8000: Destination unreachable; nested exception is: java.net.ConnectException: Connection refused: connect; No available router to destination] at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:49) at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:773) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:363) at weblogic.jndi.Environment.getContext(Environment.java:307) at weblogic.jndi.Environment.getContext(Environment.java:277) Cause This message (Connection refused: connect; No available

Recovering WebLogic Passwords

In one of my previous articles ( here ) I explained that the SerializedSystemIni.dat file in WebLogic contains the key used to encrypt and decrypt passwords. If you're not currently keeping this file secure I suggest you do, as with it someone can (to name a few things): Decrypt the WebLogic admin username and password from boot.properties. Recover database passwords, if JDBC Connection pools are configured, from config.xml. Recover the keystore passwords from config.xml and obtain SSL certificates stored in the jks keystores. Essentially, they can do whatever they want, so if you don't know who can read your SerializedSystemIni.dat files, look... now. In this article I will show how easy it is for this file to be used to recover lost passwords via a simple WLST script. The Script The script I use to decrypt passwords is incredibly short, and it works with WebLogic 8, 9 and 10 (probably for version 7 too). To use it, just create a new file called decryptpwd.py and paste the fol