Skip to main content

IllegalStateException

java.lang.IllegalStateException

IllegalStateException is described in the javadoc comments as:

Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.
author: Jonni Kanerva version: 1.15, 12/19/03 since: JDK1.1

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.org.apache.xerces.internal.jaxp.datatype.DurationImpl.add(Duration)

/**
     * Computes a new duration whose value is <code>this+rhs</code>.
     * For example,
     * '1 day' + '-3 days' = '-2 days'
     * '1 year' + '1 day' = '1 year and 1 day'
     * '-(1 hour,50 minutes)' + '-20 minutes' = '-(1 hours,70 minutes)'
     * '15 hours' + '-3 days' = '-(2 days,9 hours)'
     * '1 year' + '-1 day' = IllegalStateException
     * 
     * Since there's no way to meaningfully subtract 1 day from 1 month,
     * there are cases where the operation fails in
     * {@link IllegalStateException}. 
     * 
     * Formally, the computation is defined as follows.
     * Firstly, we can assume that two {@link Duration}s to be added
     * are both positive without losing generality (i.e.,
     * <code>(-X)+Y=Y-X</code>, <code>X+(-Y)=X-Y</code>,
     * <code>(-X)+(-Y)=-(X+Y)</code>)
     * 
     * Addition of two positive {@link Duration}s are simply defined as  
     * field by field addition where missing fields are treated as 0.
     * A field of the resulting {@link Duration} will be unset if and
     * only if respective fields of two input {@link Duration}s are unset. 
     * Note that <code>lhs.add(rhs)</code> will be always successful if
     * <code>lhs.signum()*rhs.signum()!=-1</code> or both of them are
     * normalized.
     * @param rhs <code>Duration</code> to add to this <code>Duration</code>
     * @return
     *      non-null valid Duration object.
     * @throws NullPointerException
     *      If the rhs parameter is null.
     * @throws IllegalStateException
     *      If two durations cannot be meaningfully added. For
     *      example, adding negative one day to one month causes
     *      this exception.
     * 
     * @see #subtract(Duration)
     */
public Duration add(final Duration rhs) {
    Duration lhs = this;
    BigDecimal[] buf = new BigDecimal[6];
    buf[0] = sanitize((BigInteger) lhs.getField(DatatypeConstants.YEARS), lhs.getSign()).add(sanitize((BigInteger) rhs.getField(DatatypeConstants.YEARS), rhs.getSign()));
    buf[1] = sanitize((BigInteger) lhs.getField(DatatypeConstants.MONTHS), lhs.getSign()).add(sanitize((BigInteger) rhs.getField(DatatypeConstants.MONTHS), rhs.getSign()));
    buf[2] = sanitize((BigInteger) lhs.getField(DatatypeConstants.DAYS), lhs.getSign()).add(sanitize((BigInteger) rhs.getField(DatatypeConstants.DAYS), rhs.getSign()));
    buf[3] = sanitize((BigInteger) lhs.getField(DatatypeConstants.HOURS), lhs.getSign()).add(sanitize((BigInteger) rhs.getField(DatatypeConstants.HOURS), rhs.getSign()));
    buf[4] = sanitize((BigInteger) lhs.getField(DatatypeConstants.MINUTES), lhs.getSign()).add(sanitize((BigInteger) rhs.getField(DatatypeConstants.MINUTES), rhs.getSign()));
    buf[5] = sanitize((BigDecimal) lhs.getField(DatatypeConstants.SECONDS), lhs.getSign()).add(sanitize((BigDecimal) rhs.getField(DatatypeConstants.SECONDS), rhs.getSign()));
    alignSigns(buf, 0, 2);
    alignSigns(buf, 2, 6);
    int s = 0;
    for (int i = 0; i < 6; i++) {
        if (s * buf[i].signum() < 0) {
            throw new IllegalStateException();
        }
        if (s == 0) {
            s = buf[i].signum();
        }
    }
    return new DurationImpl(s >= 0, toBigInteger(sanitize(buf[0], s), lhs.getField(DatatypeConstants.YEARS) == null && rhs.getField(DatatypeConstants.YEARS) == null), toBigInteger(sanitize(buf[1], s), lhs.getField(DatatypeConstants.MONTHS) == null && rhs.getField(DatatypeConstants.MONTHS) == null), toBigInteger(sanitize(buf[2], s), lhs.getField(DatatypeConstants.DAYS) == null && rhs.getField(DatatypeConstants.DAYS) == null), toBigInteger(sanitize(buf[3], s), lhs.getField(DatatypeConstants.HOURS) == null && rhs.getField(DatatypeConstants.HOURS) == null), toBigInteger(sanitize(buf[4], s), lhs.getField(DatatypeConstants.MINUTES) == null && rhs.getField(DatatypeConstants.MINUTES) == null), (buf[5].signum() == 0 && lhs.getField(DatatypeConstants.SECONDS) == null && rhs.getField(DatatypeConstants.SECONDS) == null) ? null : sanitize(buf[5], 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.xerces.internal.jaxp.datatype.DurationImpl.multiply(BigDecimal)

/**
     * Computes a new duration whose value is <code>factor</code> times
     * longer than the value of this duration.
     * 
     * For example,
     * 'P1M' (1 month) * '12' = 'P12M' (12 months)
     * 'PT1M' (1 min) * '0.3' = 'PT18S' (18 seconds)
     * 'P1M' (1 month) * '1.5' = IllegalStateException
     *  
     * Since the {@link Duration} class is immutable, this method
     * doesn't change the value of this object. It simply computes
     * a new Duration object and returns it.
     * 
     * The operation will be performed field by field with the precision
     * of {@link BigDecimal}. Since all the fields except seconds are
     * restricted to hold integers,
     * any fraction produced by the computation will be
     * carried down toward the next lower unit. For example,
     * if you multiply 'P1D' (1 day) with '0.5', then it will be 0.5 day,
     * which will be carried down to 'PT12H' (12 hours).
     * When fractions of month cannot be meaningfully carried down
     * to days, or year to months, this will cause an
     * {@link IllegalStateException} to be thrown. 
     * For example if you multiple one month by 0.5.
     * 
     * To avoid {@link IllegalStateException}, use
     * the {@link #normalizeWith(Calendar)} method to remove the years
     * and months fields.
     * @param factor to multiply by
     * @return
     *      returns a non-null valid {@link Duration} object
     * @throws IllegalStateException if operation produces fraction in 
     * the months field.
     * @throws NullPointerException if the <code>factor</code> parameter is 
     * <code>null</code>.
     */
public Duration multiply(BigDecimal factor) {
    BigDecimal carry = ZERO;
    int factorSign = factor.signum();
    factor = factor.abs();
    BigDecimal[] buf = new BigDecimal[6];
    for (int i = 0; i < 5; i++) {
        BigDecimal bd = getFieldAsBigDecimal(FIELDS[i]);
        bd = bd.multiply(factor).add(carry);
        buf[i] = bd.setScale(0, BigDecimal.ROUND_DOWN);
        bd = bd.subtract(buf[i]);
        if (i == 1) {
            if (bd.signum() != 0) {
                throw new IllegalStateException();
            } else {
                carry = ZERO;
            }
        } else {
            carry = bd.multiply(FACTORS[i]);
        }
    }
    if (seconds != null) {
        buf[5] = seconds.multiply(factor).add(carry);
    } else {
        buf[5] = carry;
    }
    return new DurationImpl(this.signum * factorSign >= 0, toBigInteger(buf[0], null == years), toBigInteger(buf[1], null == months), toBigInteger(buf[2], null == days), toBigInteger(buf[3], null == hours), toBigInteger(buf[4], null == minutes), (buf[5].signum() == 0 && seconds == null) ? null : buf[5]);
}

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.jaxp.validation.XNI2SAXEx.getCurrentAttributes()

/**
     * @return
     */
public XMLAttributes getCurrentAttributes() {
    if (fCurrentAtts == null) throw new IllegalStateException();
    return fCurrentAtts;
}

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

java.beans.beancontext.BeanContextSupport.add(Object)

/**
     * Adds/nests a child within this <tt>BeanContext</tt>.
     * Invoked as a side effect of java.beans.Beans.instantiate().
     * If the child object is not valid for adding then this method
     * throws an IllegalStateException.
     *
     * @param targetChild The child objects to nest 
     * within this <tt>BeanContext</tt>
     * @return true if the child was added successfully.
     * @see #validatePendingAdd
     */
public boolean add(Object targetChild) {
    if (targetChild == null) throw new IllegalArgumentException();
    if (children.containsKey(targetChild)) return false;
    synchronized (BeanContext.globalHierarchyLock) {
        if (children.containsKey(targetChild)) return false;
        if (!validatePendingAdd(targetChild)) {
            throw new IllegalStateException();
        }
        BeanContextChild cbcc = getChildBeanContextChild(targetChild);
        BeanContextChild bccp = null;
        synchronized (targetChild) {
            if (targetChild instanceof BeanContextProxy) {
                bccp = ((BeanContextProxy) targetChild).getBeanContextProxy();
                if (bccp == null) throw new NullPointerException('BeanContextPeer.getBeanContextProxy()');
            }
            BCSChild bcsc = createBCSChild(targetChild, bccp);
            BCSChild pbcsc = null;
            synchronized (children) {
                children.put(targetChild, bcsc);
                if (bccp != null) children.put(bccp, pbcsc = createBCSChild(bccp, targetChild));
            }
            if (cbcc != null) synchronized (cbcc) {
                try {
                    cbcc.setBeanContext(getBeanContextPeer());
                } catch (PropertyVetoException pve) {
                    synchronized (children) {
                        children.remove(targetChild);
                        if (bccp != null) children.remove(bccp);
                    }
                    throw new IllegalStateException();
                }
                cbcc.addPropertyChangeListener('beanContext', childPCL);
                cbcc.addVetoableChangeListener('beanContext', childVCL);
            }
            Visibility v = getChildVisibility(targetChild);
            if (v != null) {
                if (okToUseGui) v.okToUseGui(); else v.dontUseGui();
            }
            if (getChildSerializable(targetChild) != null) serializable++;
            childJustAddedHook(targetChild, bcsc);
            if (bccp != null) {
                v = getChildVisibility(bccp);
                if (v != null) {
                    if (okToUseGui) v.okToUseGui(); else v.dontUseGui();
                }
                if (getChildSerializable(bccp) != null) serializable++;
                childJustAddedHook(bccp, pbcsc);
            }
        }
        fireChildrenAdded(new BeanContextMembershipEvent(getBeanContextPeer(), bccp == null ? new Object[] { targetChild } : new Object[] { targetChild, bccp }));
    }
    return true;
}

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

java.beans.beancontext.BeanContextSupport.remove(Object, boolean)

/**
     * internal remove used when removal caused by 
     * unexpected <tt>setBeanContext</tt> or
     * by <tt>remove()</tt> invocation.
     * @param targetChild the JavaBean, BeanContext, or Object to be removed
     * @param callChildSetBC used to indicate that 
     * the child should be notified that it is no 
     * longer nested in this <tt>BeanContext</tt>.
     */
protected boolean remove(Object targetChild, boolean callChildSetBC) {
    if (targetChild == null) throw new IllegalArgumentException();
    synchronized (BeanContext.globalHierarchyLock) {
        if (!containsKey(targetChild)) return false;
        if (!validatePendingRemove(targetChild)) {
            throw new IllegalStateException();
        }
        BCSChild bcsc = (BCSChild) children.get(targetChild);
        BCSChild pbcsc = null;
        Object peer = null;
        synchronized (targetChild) {
            if (callChildSetBC) {
                BeanContextChild cbcc = getChildBeanContextChild(targetChild);
                if (cbcc != null) synchronized (cbcc) {
                    cbcc.removePropertyChangeListener('beanContext', childPCL);
                    cbcc.removeVetoableChangeListener('beanContext', childVCL);
                    try {
                        cbcc.setBeanContext(null);
                    } catch (PropertyVetoException pve1) {
                        cbcc.addPropertyChangeListener('beanContext', childPCL);
                        cbcc.addVetoableChangeListener('beanContext', childVCL);
                        throw new IllegalStateException();
                    }
                }
            }
            synchronized (children) {
                children.remove(targetChild);
                if (bcsc.isProxyPeer()) {
                    pbcsc = (BCSChild) children.get(peer = bcsc.getProxyPeer());
                    children.remove(peer);
                }
            }
            if (getChildSerializable(targetChild) != null) serializable--;
            childJustRemovedHook(targetChild, bcsc);
            if (peer != null) {
                if (getChildSerializable(peer) != null) serializable--;
                childJustRemovedHook(peer, pbcsc);
            }
        }
        fireChildrenRemoved(new BeanContextMembershipEvent(getBeanContextPeer(), peer == null ? new Object[] { targetChild } : new Object[] { targetChild, peer }));
    }
    return true;
}

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

java.io.StreamTokenizer.read()

/** Read the next character */
private int read() throws IOException {
    if (reader != null) return reader.read(); else if (input != null) return input.read(); else throw new IllegalStateException();
}

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

org.xml.sax.helpers.NamespaceSupport.setNamespaceDeclUris(boolean)

/**
     * Controls whether namespace declaration attributes are placed
     * into the {@link #NSDECL NSDECL} namespace
     * by {@link #processName processName()}.  This may only be
     * changed before any contexts have been pushed.
     * @since SAX 2.1alpha
     * @exception IllegalStateException when attempting to set this
     * after any context has been pushed.
     */
public void setNamespaceDeclUris(boolean value) {
    if (contextPos != 0) throw new IllegalStateException();
    if (value == namespaceDeclUris) return;
    namespaceDeclUris = value;
    if (value) currentContext.declarePrefix('xmlns', NSDECL); else {
        contexts[contextPos] = currentContext = new Context();
        currentContext.declarePrefix('xml', XMLNS);
    }
}

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

org.xml.sax.helpers.ParserAdapter.setupParser()

/**
     * Initialize the parser before each run.
     */
private void setupParser() {
    if (!prefixes && !namespaces) throw new IllegalStateException();
    nsSupport.reset();
    if (uris) nsSupport.setNamespaceDeclUris(true);
    if (entityResolver != null) {
        parser.setEntityResolver(entityResolver);
    }
    if (dtdHandler != null) {
        parser.setDTDHandler(dtdHandler);
    }
    if (errorHandler != null) {
        parser.setErrorHandler(errorHandler);
    }
    parser.setDocumentHandler(this);
    locator = 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.jaxp.DocumentBuilderImpl.isNamespaceAware()

public boolean isNamespaceAware() {
    try {
        return domParser.getFeature(Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE);
    } catch (SAXException x) {
        throw new IllegalStateException(x.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.xerces.internal.jaxp.DocumentBuilderImpl.isValidating()

public boolean isValidating() {
    try {
        return domParser.getFeature(Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE);
    } catch (SAXException x) {
        throw new IllegalStateException(x.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.xerces.internal.jaxp.SAXParserImpl.isNamespaceAware()

public boolean isNamespaceAware() {
    try {
        return xmlReader.getFeature(Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE);
    } catch (SAXException x) {
        throw new IllegalStateException(x.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.xerces.internal.jaxp.SAXParserImpl.isValidating()

public boolean isValidating() {
    try {
        return xmlReader.getFeature(Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE);
    } catch (SAXException x) {
        throw new IllegalStateException(x.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.xml.internal.serialize.BaseMarkupSerializer.leaveElementState()

/**
     * Leave the current element state and return to the
     * state of the parent element. If this was the root
     * element, return to the state of the document.
     * @return Previous element state
     */
protected ElementState leaveElementState() {
    if (_elementStateCount > 0) {
        _prefixes = null;
        --_elementStateCount;
        return _elementStates[_elementStateCount];
    } else {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'Internal', null);
        throw new IllegalStateException(msg);
    }
}

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.BaseMarkupSerializer.reset()

public boolean reset() {
    if (_elementStateCount > 1) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'ResetInMiddle', null);
        throw new IllegalStateException(msg);
    }
    _prepared = false;
    fCurrentNode = null;
    fStrBuffer.setLength(0);
    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.xml.internal.serialize.SerializerFactoryImpl.getSerializer(OutputFormat)

private Serializer getSerializer(OutputFormat format) {
    if (_method.equals(Method.XML)) {
        return new XMLSerializer(format);
    } else if (_method.equals(Method.HTML)) {
        return new HTMLSerializer(format);
    } else if (_method.equals(Method.XHTML)) {
        return new XHTMLSerializer(format);
    } else if (_method.equals(Method.TEXT)) {
        return new TextSerializer();
    } else {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'MethodNotSupported', new Object[] { _method });
        throw new IllegalStateException(msg);
    }
}

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.startElement(String, AttributeList)

public void startElement(String tagName, AttributeList attrs) throws SAXException {
    int i;
    boolean preserveSpace;
    ElementState state;
    String name;
    String value;
    if (DEBUG) {
        System.out.println('==>startElement(' + tagName + ')');
    }
    try {
        if (_printer == null) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'NoWriterSupplied', null);
            throw new IllegalStateException(msg);
        }
        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();
        }
        preserveSpace = state.preserveSpace;
        _printer.printText('<');
        _printer.printText(tagName);
        _printer.indent();
        if (attrs != null) {
            for (i = 0; i < attrs.getLength(); ++i) {
                _printer.printSpace();
                name = attrs.getName(i);
                value = attrs.getValue(i);
                if (value != null) {
                    _printer.printText(name);
                    _printer.printText('=\'');
                    printEscaped(value);
                    _printer.printText(''');
                }
                if (name.equals('xml:space')) {
                    if (value.equals('preserve')) preserveSpace = true; else preserveSpace = _format.getPreserveSpace();
                }
            }
        }
        state = enterElementState(null, null, tagName, preserveSpace);
        state.doCData = _format.isCDataElement(tagName);
        state.unescaped = _format.isNonEscapingElement(tagName);
    } catch (IOException except) {
        throw new SAXException(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.startElement(String, String, String, Attributes)

public void startElement(String namespaceURI, String localName, String rawName, Attributes attrs) throws SAXException {
    int i;
    boolean preserveSpace;
    ElementState state;
    String name;
    String value;
    boolean addNSAttr = false;
    if (DEBUG) {
        System.out.println('==>startElement(' + namespaceURI + ',' + localName + ',' + rawName + ')');
    }
    try {
        if (_printer == null) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'NoWriterSupplied', null);
            throw new IllegalStateException(msg);
        }
        state = getElementState();
        if (isDocumentState()) {
            if (!_started) startDocument((localName == null || localName.length() == 0) ? rawName : localName);
        } 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();
        }
        preserveSpace = state.preserveSpace;
        attrs = extractNamespaces(attrs);
        if (rawName == null || rawName.length() == 0) {
            if (localName == null) {
                String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'NoName', null);
                throw new SAXException(msg);
            }
            if (namespaceURI != null && !namespaceURI.equals('')) {
                String prefix;
                prefix = getPrefix(namespaceURI);
                if (prefix != null && prefix.length() > 0) rawName = prefix + ':' + localName; else rawName = localName;
            } else rawName = localName;
            addNSAttr = true;
        }
        _printer.printText('<');
        _printer.printText(rawName);
        _printer.indent();
        if (attrs != null) {
            for (i = 0; i < attrs.getLength(); ++i) {
                _printer.printSpace();
                name = attrs.getQName(i);
                if (name != null && name.length() == 0) {
                    String prefix;
                    String attrURI;
                    name = attrs.getLocalName(i);
                    attrURI = attrs.getURI(i);
                    if ((attrURI != null && attrURI.length() != 0) && (namespaceURI == null || namespaceURI.length() == 0 || !attrURI.equals(namespaceURI))) {
                        prefix = getPrefix(attrURI);
                        if (prefix != null && prefix.length() > 0) name = prefix + ':' + name;
                    }
                }
                value = attrs.getValue(i);
                if (value == null) value = '';
                _printer.printText(name);
                _printer.printText('=\'');
                printEscaped(value);
                _printer.printText(''');
                if (name.equals('xml:space')) {
                    if (value.equals('preserve')) preserveSpace = true; else preserveSpace = _format.getPreserveSpace();
                }
            }
        }
        if (_prefixes != null) {
            Enumeration keys;
            keys = _prefixes.keys();
            while (keys.hasMoreElements()) {
                _printer.printSpace();
                value = (String) keys.nextElement();
                name = (String) _prefixes.get(value);
                if (name.length() == 0) {
                    _printer.printText('xmlns=\'');
                    printEscaped(value);
                    _printer.printText(''');
                } else {
                    _printer.printText('xmlns:');
                    _printer.printText(name);
                    _printer.printText('=\'');
                    printEscaped(value);
                    _printer.printText(''');
                }
            }
        }
        state = enterElementState(namespaceURI, localName, rawName, preserveSpace);
        name = (localName == null || localName.length() == 0) ? rawName : namespaceURI + '^' + localName;
        state.doCData = _format.isCDataElement(name);
        state.unescaped = _format.isNonEscapingElement(name);
    } catch (IOException except) {
        throw new SAXException(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.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.getXMLSchemaType()

/**
     * Return the name of the XML Schema date/time type that this instance 
     * maps to. Type is computed based on fields that are set.
     * <table border='2' rules='all' cellpadding='2'>
     *   <thead>
     *     <tr>
     *       <th align='center' colspan='7'>
     *         Required fields for XML Schema 1.0 Date/Time Datatypes.<br/>
     *         <i>(timezone is optional for all date/time datatypes)</i>
     *       </th>
     *     </tr>
     *   </thead>
     *   <tbody>
     *     <tr>
     *       <td>Datatype</td>
     *       <td>year</td>
     *       <td>month</td>
     *       <td>day</td>
     *       <td>hour</td>
     *       <td>minute</td>
     *       <td>second</td>
     *     </tr>
     *     <tr>
     *       <td>{@link DatatypeConstants#DATETIME}</td>
     *       <td>X</td>
     *       <td>X</td>
     *       <td>X</td>
     *       <td>X</td>
     *       <td>X</td>
     *       <td>X</td>
     *     </tr>
     *     <tr>
     *       <td>{@link DatatypeConstants#DATE}</td>
     *       <td>X</td>
     *       <td>X</td>
     *       <td>X</td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *     </tr>
     *     <tr>
     *       <td>{@link DatatypeConstants#TIME}</td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *       <td>X</td>
     *       <td>X</td>
     *       <td>X</td>
     *     </tr>
     *     <tr>
     *       <td>{@link DatatypeConstants#GYEARMONTH}</td>
     *       <td>X</td>
     *       <td>X</td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *     </tr>
     *     <tr>
     *       <td>{@link DatatypeConstants#GMONTHDAY}</td>
     *       <td></td>
     *       <td>X</td>
     *       <td>X</td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *     </tr>
     *     <tr>
     *       <td>{@link DatatypeConstants#GYEAR}</td>
     *       <td>X</td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *     </tr>
     *     <tr>
     *       <td>{@link DatatypeConstants#GMONTH}</td>
     *       <td></td>
     *       <td>X</td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *     </tr>
     *     <tr>
     *       <td>{@link DatatypeConstants#GDAY}</td>
     *       <td></td>
     *       <td></td>
     *       <td>X</td>
     *       <td></td>
     *       <td></td>
     *       <td></td>
     *     </tr>
     *   </tbody>
     * </table>
     * @throws java.lang.IllegalStateException if the combination of set fields
     *    does not match one of the eight defined XML Schema builtin 
     *    date/time datatypes.
     * @return One of the following class constants:
     *   {@link DatatypeConstants#DATETIME},
     *   {@link DatatypeConstants#TIME},
     *   {@link DatatypeConstants#DATE},
     *   {@link DatatypeConstants#GYEARMONTH},
     *   {@link DatatypeConstants#GMONTHDAY},
     *   {@link DatatypeConstants#GYEAR},
     *   {@link DatatypeConstants#GMONTH} or
     *   {@link DatatypeConstants#GDAY}.
     */
public QName getXMLSchemaType() {
    if (year != DatatypeConstants.FIELD_UNDEFINED && month != DatatypeConstants.FIELD_UNDEFINED && day != DatatypeConstants.FIELD_UNDEFINED && hour != DatatypeConstants.FIELD_UNDEFINED && minute != DatatypeConstants.FIELD_UNDEFINED && second != DatatypeConstants.FIELD_UNDEFINED) {
        return DatatypeConstants.DATETIME;
    }
    if (year != DatatypeConstants.FIELD_UNDEFINED && month != DatatypeConstants.FIELD_UNDEFINED && day != DatatypeConstants.FIELD_UNDEFINED && hour == DatatypeConstants.FIELD_UNDEFINED && minute == DatatypeConstants.FIELD_UNDEFINED && second == DatatypeConstants.FIELD_UNDEFINED) {
        return DatatypeConstants.DATE;
    }
    if (year == DatatypeConstants.FIELD_UNDEFINED && month == DatatypeConstants.FIELD_UNDEFINED && day == DatatypeConstants.FIELD_UNDEFINED && hour != DatatypeConstants.FIELD_UNDEFINED && minute != DatatypeConstants.FIELD_UNDEFINED && second != DatatypeConstants.FIELD_UNDEFINED) {
        return DatatypeConstants.TIME;
    }
    if (year != DatatypeConstants.FIELD_UNDEFINED && month != DatatypeConstants.FIELD_UNDEFINED && day == DatatypeConstants.FIELD_UNDEFINED && hour == DatatypeConstants.FIELD_UNDEFINED && minute == DatatypeConstants.FIELD_UNDEFINED && second == DatatypeConstants.FIELD_UNDEFINED) {
        return DatatypeConstants.GYEARMONTH;
    }
    if (year == DatatypeConstants.FIELD_UNDEFINED && month != DatatypeConstants.FIELD_UNDEFINED && day != DatatypeConstants.FIELD_UNDEFINED && hour == DatatypeConstants.FIELD_UNDEFINED && minute == DatatypeConstants.FIELD_UNDEFINED && second == DatatypeConstants.FIELD_UNDEFINED) {
        return DatatypeConstants.GMONTHDAY;
    }
    if (year != DatatypeConstants.FIELD_UNDEFINED && month == DatatypeConstants.FIELD_UNDEFINED && day == DatatypeConstants.FIELD_UNDEFINED && hour == DatatypeConstants.FIELD_UNDEFINED && minute == DatatypeConstants.FIELD_UNDEFINED && second == DatatypeConstants.FIELD_UNDEFINED) {
        return DatatypeConstants.GYEAR;
    }
    if (year == DatatypeConstants.FIELD_UNDEFINED && month != DatatypeConstants.FIELD_UNDEFINED && day == DatatypeConstants.FIELD_UNDEFINED && hour == DatatypeConstants.FIELD_UNDEFINED && minute == DatatypeConstants.FIELD_UNDEFINED && second == DatatypeConstants.FIELD_UNDEFINED) {
        return DatatypeConstants.GMONTH;
    }
    if (year == DatatypeConstants.FIELD_UNDEFINED && month == DatatypeConstants.FIELD_UNDEFINED && day != DatatypeConstants.FIELD_UNDEFINED && hour == DatatypeConstants.FIELD_UNDEFINED && minute == DatatypeConstants.FIELD_UNDEFINED && second == DatatypeConstants.FIELD_UNDEFINED) {
        return DatatypeConstants.GDAY;
    }
    throw new IllegalStateException(this.getClass().getName() + '#getXMLSchemaType() :' + DatatypeMessageFormatter.formatMessage(null, 'InvalidXGCFields', null));
}

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.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.BMPMetadata.mergeTree(String, Node)

public void mergeTree(String formatName, Node root) {
    throw new IllegalStateException(I18N.getString('BMPMetadata1'));
}

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.BMPMetadata.reset()

public void reset() {
    throw new IllegalStateException(I18N.getString('BMPMetadata1'));
}

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.BMPMetadata.setFromTree(String, Node)

public void setFromTree(String formatName, Node root) {
    throw new IllegalStateException(I18N.getString('BMPMetadata1'));
}

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.getNumImages(boolean)

/** Overrides the method defined in the superclass. */
public int getNumImages(boolean allowSearch) throws IOException {
    if (iis == null) {
        throw new IllegalStateException(I18N.getString('GetNumImages0'));
    }
    if (seekForwardOnly && allowSearch) {
        throw new IllegalStateException(I18N.getString('GetNumImages1'));
    }
    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.imageio.plugins.wbmp.WBMPImageReader.getNumImages(boolean)

/** Overrides the method defined in the superclass. */
public int getNumImages(boolean allowSearch) throws IOException {
    if (iis == null) {
        throw new IllegalStateException(I18N.getString('GetNumImages0'));
    }
    if (seekForwardOnly && allowSearch) {
        throw new IllegalStateException(I18N.getString('GetNumImages1'));
    }
    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.xml.internal.serialize.HTMLSerializer.startElement(String, AttributeList)

public void startElement(String tagName, AttributeList attrs) throws SAXException {
    int i;
    boolean preserveSpace;
    ElementState state;
    String name;
    String value;
    try {
        if (_printer == null) throw new IllegalStateException(DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'NoWriterSupplied', null));
        state = getElementState();
        if (isDocumentState()) {
            if (!_started) startDocument(tagName);
        } else {
            if (state.empty) _printer.printText('>');
            if (_indenting && !state.preserveSpace && (state.empty || state.afterElement)) _printer.breakLine();
        }
        preserveSpace = state.preserveSpace;
        _printer.printText('<');
        if (_xhtml) _printer.printText(tagName.toLowerCase(Locale.ENGLISH)); else _printer.printText(tagName);
        _printer.indent();
        if (attrs != null) {
            for (i = 0; i < attrs.getLength(); ++i) {
                _printer.printSpace();
                name = attrs.getName(i).toLowerCase(Locale.ENGLISH);
                value = attrs.getValue(i);
                if (_xhtml) {
                    if (value == null) {
                        _printer.printText(name);
                        _printer.printText('=\'\'');
                    } else {
                        _printer.printText(name);
                        _printer.printText('=\'');
                        printEscaped(value);
                        _printer.printText(''');
                    }
                } else {
                    if (value == null) {
                        value = '';
                    }
                    if (!_format.getPreserveEmptyAttributes() && value.length() == 0) _printer.printText(name); else if (HTMLdtd.isURI(tagName, name)) {
                        _printer.printText(name);
                        _printer.printText('=\'');
                        _printer.printText(escapeURI(value));
                        _printer.printText(''');
                    } else if (HTMLdtd.isBoolean(tagName, name)) _printer.printText(name); else {
                        _printer.printText(name);
                        _printer.printText('=\'');
                        printEscaped(value);
                        _printer.printText(''');
                    }
                }
            }
        }
        if (HTMLdtd.isPreserveSpace(tagName)) preserveSpace = true;
        state = enterElementState(null, null, tagName, preserveSpace);
        if (tagName.equalsIgnoreCase('A') || tagName.equalsIgnoreCase('TD')) {
            state.empty = false;
            _printer.printText('>');
        }
        if (tagName.equalsIgnoreCase('SCRIPT') || tagName.equalsIgnoreCase('STYLE')) {
            if (_xhtml) {
                state.doCData = true;
            } else {
                state.unescaped = true;
            }
        }
    } catch (IOException except) {
        throw new SAXException(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.HTMLSerializer.startElement(String, String, String, Attributes)

public void startElement(String namespaceURI, String localName, String rawName, Attributes attrs) throws SAXException {
    int i;
    boolean preserveSpace;
    ElementState state;
    String name;
    String value;
    String htmlName;
    boolean addNSAttr = false;
    try {
        if (_printer == null) throw new IllegalStateException(DOMMessageFormatter.formatMessage(DOMMessageFormatter.SERIALIZER_DOMAIN, 'NoWriterSupplied', null));
        state = getElementState();
        if (isDocumentState()) {
            if (!_started) startDocument((localName == null || localName.length() == 0) ? rawName : localName);
        } else {
            if (state.empty) _printer.printText('>');
            if (_indenting && !state.preserveSpace && (state.empty || state.afterElement)) _printer.breakLine();
        }
        preserveSpace = state.preserveSpace;
        boolean hasNamespaceURI = (namespaceURI != null && namespaceURI.length() != 0);
        if (rawName == null || rawName.length() == 0) {
            rawName = localName;
            if (hasNamespaceURI) {
                String prefix;
                prefix = getPrefix(namespaceURI);
                if (prefix != null && prefix.length() != 0) rawName = prefix + ':' + localName;
            }
            addNSAttr = true;
        }
        if (!hasNamespaceURI) htmlName = rawName; else {
            if (namespaceURI.equals(XHTMLNamespace) || (fUserXHTMLNamespace != null && fUserXHTMLNamespace.equals(namespaceURI))) htmlName = localName; else htmlName = null;
        }
        _printer.printText('<');
        if (_xhtml) _printer.printText(rawName.toLowerCase(Locale.ENGLISH)); else _printer.printText(rawName);
        _printer.indent();
        if (attrs != null) {
            for (i = 0; i < attrs.getLength(); ++i) {
                _printer.printSpace();
                name = attrs.getQName(i).toLowerCase(Locale.ENGLISH);
                value = attrs.getValue(i);
                if (_xhtml || hasNamespaceURI) {
                    if (value == null) {
                        _printer.printText(name);
                        _printer.printText('=\'\'');
                    } else {
                        _printer.printText(name);
                        _printer.printText('=\'');
                        printEscaped(value);
                        _printer.printText(''');
                    }
                } else {
                    if (value == null) {
                        value = '';
                    }
                    if (!_format.getPreserveEmptyAttributes() && value.length() == 0) _printer.printText(name); else if (HTMLdtd.isURI(rawName, name)) {
                        _printer.printText(name);
                        _printer.printText('=\'');
                        _printer.printText(escapeURI(value));
                        _printer.printText(''');
                    } else if (HTMLdtd.isBoolean(rawName, name)) _printer.printText(name); else {
                        _printer.printText(name);
                        _printer.printText('=\'');
                        printEscaped(value);
                        _printer.printText(''');
                    }
                }
            }
        }
        if (htmlName != null && HTMLdtd.isPreserveSpace(htmlName)) preserveSpace = true;
        if (addNSAttr) {
            Enumeration keys;
            keys = _prefixes.keys();
            while (keys.hasMoreElements()) {
                _printer.printSpace();
                value = (String) keys.nextElement();
                name = (String) _prefixes.get(value);
                if (name.length() == 0) {
                    _printer.printText('xmlns=\'');
                    printEscaped(value);
                    _printer.printText(''');
                } else {
                    _printer.printText('xmlns:');
                    _printer.printText(name);
                    _printer.printText('=\'');
                    printEscaped(value);
                    _printer.printText(''');
                }
            }
        }
        state = enterElementState(namespaceURI, localName, rawName, preserveSpace);
        if (htmlName != null && (htmlName.equalsIgnoreCase('A') || htmlName.equalsIgnoreCase('TD'))) {
            state.empty = false;
            _printer.printText('>');
        }
        if (htmlName != null && (rawName.equalsIgnoreCase('SCRIPT') || rawName.equalsIgnoreCase('STYLE'))) {
            if (_xhtml) {
                state.doCData = true;
            } else {
                state.unescaped = true;
            }
        }
    } catch (IOException except) {
        throw new SAXException(except);
    }
}

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.WBMPImageReader.read(int, ImageReadParam)

public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException {
    if (iis == null) {
        throw new IllegalStateException(I18N.getString('WBMPImageReader1'));
    }
    checkIndex(imageIndex);
    clearAbortRequest();
    processImageStarted(imageIndex);
    if (param == null) param = getDefaultReadParam();
    readHeader();
    Rectangle sourceRegion = new Rectangle(0, 0, 0, 0);
    Rectangle destinationRegion = new Rectangle(0, 0, 0, 0);
    computeRegions(param, this.width, this.height, param.getDestination(), sourceRegion, destinationRegion);
    int scaleX = param.getSourceXSubsampling();
    int scaleY = param.getSourceYSubsampling();
    int xOffset = param.getSubsamplingXOffset();
    int yOffset = param.getSubsamplingYOffset();
    BufferedImage bi = param.getDestination();
    if (bi == null) bi = new BufferedImage(destinationRegion.x + destinationRegion.width, destinationRegion.y + destinationRegion.height, BufferedImage.TYPE_BYTE_BINARY);
    boolean noTransform = destinationRegion.equals(new Rectangle(0, 0, width, height)) && destinationRegion.equals(new Rectangle(0, 0, bi.getWidth(), bi.getHeight()));
    WritableRaster tile = bi.getWritableTile(0, 0);
    MultiPixelPackedSampleModel sm = (MultiPixelPackedSampleModel) bi.getSampleModel();
    if (noTransform) {
        if (abortRequested()) {
            processReadAborted();
            return bi;
        }
        iis.read(((DataBufferByte) tile.getDataBuffer()).getData(), 0, height * sm.getScanlineStride());
        processImageUpdate(bi, 0, 0, width, height, 1, 1, new int[] { 0 });
        processImageProgress(100.0F);
    } else {
        int len = (this.width + 7) / 8;
        byte[] buf = new byte[len];
        byte[] data = ((DataBufferByte) tile.getDataBuffer()).getData();
        int lineStride = sm.getScanlineStride();
        iis.skipBytes(len * sourceRegion.y);
        int skipLength = len * (scaleY - 1);
        int[] srcOff = new int[destinationRegion.width];
        int[] destOff = new int[destinationRegion.width];
        int[] srcPos = new int[destinationRegion.width];
        int[] destPos = new int[destinationRegion.width];
        for (int i = destinationRegion.x, x = sourceRegion.x, j = 0; i < destinationRegion.x + destinationRegion.width; i++, j++, x += scaleX) {
            srcPos[j] = x >> 3;
            srcOff[j] = 7 - (x & 7);
            destPos[j] = i >> 3;
            destOff[j] = 7 - (i & 7);
        }
        for (int j = 0, y = sourceRegion.y, k = destinationRegion.y * lineStride; j < destinationRegion.height; j++, y += scaleY) {
            if (abortRequested()) break;
            iis.read(buf, 0, len);
            for (int i = 0; i < destinationRegion.width; i++) {
                int v = (buf[srcPos[i]] >> srcOff[i]) & 1;
                data[k + destPos[i]] |= v << destOff[i];
            }
            k += lineStride;
            iis.skipBytes(skipLength);
            processImageUpdate(bi, 0, j, destinationRegion.width, 1, 1, 1, new int[] { 0 });
            processImageProgress(100.0F * j / destinationRegion.height);
        }
    }
    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.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.imageio.plugins.wbmp.WBMPMetadata.mergeTree(String, Node)

public void mergeTree(String formatName, Node root) {
    throw new IllegalStateException(I18N.getString('WBMPMetadata1'));
}

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.WBMPMetadata.reset()

public void reset() {
    throw new IllegalStateException(I18N.getString('WBMPMetadata1'));
}

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.WBMPMetadata.setFromTree(String, Node)

public void setFromTree(String formatName, Node root) {
    throw new IllegalStateException(I18N.getString('WBMPMetadata1'));
}

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.Match.getBeginning(int)

/**
     * Return a start position in the target text matched to specified regular expression group.
     * @param index Less than <code>getNumberOfGroups()</code>.
     */
public int getBeginning(int index) {
    if (this.beginpos == null) throw new IllegalStateException('A result is not set.');
    if (index < 0 || this.nofgroups <= index) throw new IllegalArgumentException('The parameter must be less than ' + this.nofgroups + ': ' + index);
    return this.beginpos[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.Match.getEnd(int)

/**
     * Return an end position in the target text matched to specified regular expression group.
     * @param index Less than <code>getNumberOfGroups()</code>.
     */
public int getEnd(int index) {
    if (this.endpos == null) throw new IllegalStateException('A result is not set.');
    if (index < 0 || this.nofgroups <= index) throw new IllegalArgumentException('The parameter must be less than ' + this.nofgroups + ': ' + index);
    return this.endpos[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.Match.getNumberOfGroups()

/**
     * Return the number of regular expression groups.
     * This method returns 1 when the regular expression has no capturing-parenthesis.
     */
public int getNumberOfGroups() {
    if (this.nofgroups <= 0) throw new IllegalStateException('A result is not set.');
    return this.nofgroups;
}

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

java.net.HttpURLConnection.setFixedLengthStreamingMode(int)

/**
     * This method is used to enable streaming of a HTTP request body
     * without internal buffering, when the content length is known in
     * advance. 
     * An exception will be thrown if the application
     * attempts to write more data than the indicated
     * content-length, or if the application closes the OutputStream
     * before writing the indicated amount.
     * When output streaming is enabled, authentication
     * and redirection cannot be handled automatically.
     * A HttpRetryException will be thrown when reading
     * the response if authentication or redirection are required.
     * This exception can be queried for the details of the error.
     * This method must be called before the URLConnection is connected.
     * @param   contentLength The number of bytes which will be written
     *  to the OutputStream.
     * @throws  IllegalStateException if URLConnection is already connected 
     *  or if a different streaming mode is already enabled.
     * @throws  IllegalArgumentException if a content length less than 
     *  zero is specified.
     * @see     #setChunkedStreamingMode(int)
     */
public void setFixedLengthStreamingMode(int contentLength) {
    if (connected) {
        throw new IllegalStateException('Already connected');
    }
    if (chunkLength != -1) {
        throw new IllegalStateException('Chunked encoding streaming mode set');
    }
    if (contentLength < 0) {
        throw new IllegalArgumentException('invalid content length');
    }
    fixedContentLength = contentLength;
}

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

java.net.URLConnection.addRequestProperty(String, String)

/**
     * Adds a general request property specified by a
     * key-value pair.  This method will not overwrite
     * existing values associated with the same key.
     * @param   key     the keyword by which the request is known
     *                  (e.g., '<code>accept</code>').
     * @param   value  the value associated with it.
     * @throws IllegalStateException if already connected
     * @throws NullPointerException if key is null
     * @see #getRequestProperties()
     * @since 1.4
     */
public void addRequestProperty(String key, String value) {
    if (connected) throw new IllegalStateException('Already connected');
    if (key == null) throw new NullPointerException('key is null');
}

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

java.net.URLConnection.getRequestProperties()

/**
     * Returns an unmodifiable Map of general request
     * properties for this connection. The Map keys
     * are Strings that represent the request-header
     * field names. Each Map value is a unmodifiable List 
     * of Strings that represents the corresponding 
     * field values.
     * @return  a Map of the general request properties for this connection.
     * @throws IllegalStateException if already connected
     * @since 1.4
     */
public Map<String, List<String>> getRequestProperties() {
    if (connected) throw new IllegalStateException('Already connected');
    return Collections.EMPTY_MAP;
}

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

java.net.URLConnection.getRequestProperty(String)

/**
     * Returns the value of the named general request property for this
     * connection.
     * @param key the keyword by which the request is known (e.g., 'accept').
     * @return  the value of the named general request property for this
     *           connection. If key is null, then null is returned.
     * @throws IllegalStateException if already connected
     * @see #setRequestProperty(java.lang.String, java.lang.String)
     */
public String getRequestProperty(String key) {
    if (connected) throw new IllegalStateException('Already connected');
    return null;
}

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

java.net.URLConnection.setAllowUserInteraction(boolean)

/**
     * Set the value of the <code>allowUserInteraction</code> field of 
     * this <code>URLConnection</code>. 
     * @param   allowuserinteraction   the new value.
     * @throws IllegalStateException if already connected
     * @see     #getAllowUserInteraction()
     */
public void setAllowUserInteraction(boolean allowuserinteraction) {
    if (connected) throw new IllegalStateException('Already connected');
    allowUserInteraction = allowuserinteraction;
}

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

java.net.URLConnection.setDoInput(boolean)

/**
     * Sets the value of the <code>doInput</code> field for this 
     * <code>URLConnection</code> to the specified value. 
     * A URL connection can be used for input and/or output.  Set the DoInput
     * flag to true if you intend to use the URL connection for input,
     * false if not.  The default is true.
     * @param   doinput   the new value.
     * @throws IllegalStateException if already connected
     * @see     java.net.URLConnection#doInput
     * @see #getDoInput()
     */
public void setDoInput(boolean doinput) {
    if (connected) throw new IllegalStateException('Already connected');
    doInput = doinput;
}

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

java.net.URLConnection.setDoOutput(boolean)

/**
     * Sets the value of the <code>doOutput</code> field for this 
     * <code>URLConnection</code> to the specified value. 
     * A URL connection can be used for input and/or output.  Set the DoOutput
     * flag to true if you intend to use the URL connection for output,
     * false if not.  The default is false.
     * @param   dooutput   the new value.
     * @throws IllegalStateException if already connected
     * @see #getDoOutput()
     */
public void setDoOutput(boolean dooutput) {
    if (connected) throw new IllegalStateException('Already connected');
    doOutput = dooutput;
}

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

java.net.URLConnection.setIfModifiedSince(long)

/**
     * Sets the value of the <code>ifModifiedSince</code> field of 
     * this <code>URLConnection</code> to the specified value.
     * @param   ifmodifiedsince   the new value.
     * @throws IllegalStateException if already connected
     * @see     #getIfModifiedSince()
     */
public void setIfModifiedSince(long ifmodifiedsince) {
    if (connected) throw new IllegalStateException('Already connected');
    ifModifiedSince = ifmodifiedsince;
}

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

java.net.URLConnection.setRequestProperty(String, String)

/**
     * Sets the general request property. If a property with the key already
     * exists, overwrite its value with the new value.
     *  NOTE: HTTP requires all request properties which can
     * legally have multiple instances with the same key
     * to use a comma-seperated list syntax which enables multiple
     * properties to be appended into a single property.
     * @param   key     the keyword by which the request is known
     *                  (e.g., '<code>accept</code>').
     * @param   value   the value associated with it.
     * @throws IllegalStateException if already connected
     * @throws NullPointerException if key is <CODE>null</CODE>
     * @see #getRequestProperty(java.lang.String)
     */
public void setRequestProperty(String key, String value) {
    if (connected) throw new IllegalStateException('Already connected');
    if (key == null) throw new NullPointerException('key is null');
}

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

java.net.URLConnection.setUseCaches(boolean)

/**
     * Sets the value of the <code>useCaches</code> field of this 
     * <code>URLConnection</code> to the specified value. 
     * Some protocols do caching of documents.  Occasionally, it is important
     * to be able to 'tunnel through' and ignore the caches (e.g., the
     * 'reload' button in a browser).  If the UseCaches flag on a connection
     * is true, the connection is allowed to use whatever caches it can.
     *  If false, caches are to be ignored.
     *  The default value comes from DefaultUseCaches, which defaults to
     * true.
     * @param usecaches a <code>boolean</code> indicating whether 
     * or not to allow caching
     * @throws IllegalStateException if already connected
     * @see #getUseCaches()
     */
public void setUseCaches(boolean usecaches) {
    if (connected) throw new IllegalStateException('Already connected');
    useCaches = usecaches;
}

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.ObjectUtility.concatenateArrays(Object, Object)

/** If arr1 and arr2 are both arrays of the same component type,
     * return an array of that component type that consists of the
     * elements of arr1 followed by the elements of arr2.
     * Throws IllegalArgumentException otherwise.
     */
public static Object concatenateArrays(Object arr1, Object arr2) {
    Class comp1 = arr1.getClass().getComponentType();
    Class comp2 = arr2.getClass().getComponentType();
    int len1 = Array.getLength(arr1);
    int len2 = Array.getLength(arr2);
    if ((comp1 == null) || (comp2 == null)) throw new IllegalStateException('Arguments must be arrays');
    if (!comp1.equals(comp2)) throw new IllegalStateException('Arguments must be arrays with the same component type');
    Object result = Array.newInstance(comp1, len1 + len2);
    int index = 0;
    for (int ctr = 0; ctr < len1; ctr++) Array.set(result, index++, Array.get(arr1, ctr));
    for (int ctr = 0; ctr < len2; ctr++) Array.set(result, index++, Array.get(arr2, ctr));
    return result;
}

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

javax.swing.text.AbstractDocument.writeLock()

/**
     * Acquires a lock to begin mutating the document this lock
     * protects.  There can be no writing, notification of changes, or
     * reading going on in order to gain the lock.  Additionally a thread is
     * allowed to gain more than one <code>writeLock</code>,
     * as long as it doesn't attempt to gain additional <code>writeLock</code>s
     * from within document notification.  Attempting to gain a 
     * <code>writeLock</code> from within a DocumentListener notification will
     * result in an <code>IllegalStateException</code>.  The ability
     * to obtain more than one <code>writeLock</code> per thread allows
     * subclasses to gain a writeLock, perform a number of operations, then
     * release the lock.
     * Calls to <code>writeLock</code>
     * must be balanced with calls to <code>writeUnlock</code>, else the
     * <code>Document</code> will be left in a locked state so that no
     * reading or writing can be done.
     * @exception IllegalStateException thrown on illegal lock
     *  attempt.  If the document is implemented properly, this can
     *  only happen if a document listener attempts to mutate the 
     *  document.  This situation violates the bean event model
     *  where order of delivery is not guaranteed and all listeners
     *  should be notified before further mutations are allowed.
     */
protected final synchronized void writeLock() {
    try {
        while ((numReaders > 0) || (currWriter != null)) {
            if (Thread.currentThread() == currWriter) {
                if (notifyingListeners) {
                    throw new IllegalStateException('Attempt to mutate in notification');
                }
                numWriters++;
                return;
            }
            wait();
        }
        currWriter = Thread.currentThread();
        numWriters = 1;
    } catch (InterruptedException e) {
        throw new Error('Interrupted attempt to aquire write lock');
    }
}

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

java.lang.Throwable.initCause(Throwable)

/**
     * Initializes the <i>cause</i> of this throwable to the specified value.
     * (The cause is the throwable that caused this throwable to get thrown.) 
     * This method can be called at most once.  It is generally called from 
     * within the constructor, or immediately after creating the
     * throwable.  If this throwable was created
     * with {@link #Throwable(Throwable)} or
     * {@link #Throwable(String,Throwable)}, this method cannot be called
     * even once.
     * @param  cause the cause (which is saved for later retrieval by the
     *         {@link #getCause()} method).  (A <tt>null</tt> value is
     *         permitted, and indicates that the cause is nonexistent or
     *         unknown.)
     * @return  a reference to this <code>Throwable</code> instance.
     * @throws IllegalArgumentException if <code>cause</code> is this
     *         throwable.  (A throwable cannot be its own cause.)
     * @throws IllegalStateException if this throwable was
     *         created with {@link #Throwable(Throwable)} or
     *         {@link #Throwable(String,Throwable)}, or this method has already
     *         been called on this throwable.
     * @since  1.4
     */
public synchronized Throwable initCause(Throwable cause) {
    if (this.cause != this) throw new IllegalStateException('Can't overwrite cause');
    if (cause == this) throw new IllegalArgumentException('Self-causation not permitted');
    this.cause = cause;
    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.jmx.mbeanserver.JmxMBeanServer.initialize()

/**
     * Initializes this MBeanServer, registering the MBeanServerDelegate.
     * This method must be called once, before using the MBeanServer.
     **/
private void initialize() {
    if (instantiator == null) throw new IllegalStateException('instantiator must not be null.');
    try {
        mBeanServerDelegateObjectName = new ObjectName(ServiceName.DELEGATE);
        AccessController.doPrivileged(new PrivilegedExceptionAction() {

            public Object run() throws Exception {
                mbsInterceptor.registerMBean(mBeanServerDelegateObject, mBeanServerDelegateObjectName);
                return null;
            }
        });
    } catch (SecurityException e) {
        if (isDebugOn()) {
            debug('new', 'Unexpected security exception occured: ' + e);
        }
        mBeanServerDelegateObjectName = null;
        throw e;
    } catch (Exception e) {
        if (isDebugOn()) {
            debug('new', 'Unexpected exception occured: ' + e.getClass().getName());
        }
        mBeanServerDelegateObjectName = null;
        throw new IllegalStateException('Can't register delegate.');
    }
    ClassLoader myLoader = outerShell.getClass().getClassLoader();
    final ModifiableClassLoaderRepository loaders = instantiator.getClassLoaderRepository();
    if (loaders != null) {
        loaders.addClassLoader(myLoader);
        ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
        if (systemLoader != myLoader) loaders.addClassLoader(systemLoader);
    }
}

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

java.net.HttpURLConnection.setChunkedStreamingMode(int)

/**
     * This method is used to enable streaming of a HTTP request body
     * without internal buffering, when the content length is <b>not</b>
     * known in advance. In this mode, chunked transfer encoding 
     * is used to send the request body. Note, not all HTTP servers
     * support this mode.
     * When output streaming is enabled, authentication
     * and redirection cannot be handled automatically.
     * A HttpRetryException will be thrown when reading
     * the response if authentication or redirection are required.
     * This exception can be queried for the details of the error.
     * This method must be called before the URLConnection is connected.
     * @param   chunklen The number of bytes to write in each chunk.
     *  If chunklen is less than or equal to zero, a default 
     *  value will be used.
     * @throws  IllegalStateException if URLConnection is already connected 
     *  or if a different streaming mode is already enabled.
     * @see     #setFixedLengthStreamingMode(int)
     */
public void setChunkedStreamingMode(int chunklen) {
    if (connected) {
        throw new IllegalStateException('Can't set streaming mode: already connected');
    }
    if (fixedContentLength != -1) {
        throw new IllegalStateException('Fixed length streaming mode set');
    }
    chunkLength = chunklen <= 0 ? DEFAULT_CHUNK_SIZE : chunklen;
}

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

javax.naming.directory.BasicAttribute.add(int, Object)

public void add(int ix, Object attrVal) {
    if (!isOrdered() && contains(attrVal)) {
        throw new IllegalStateException('Cannot add duplicate to unordered attribute');
    }
    values.insertElementAt(attrVal, ix);
}

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

javax.naming.directory.BasicAttribute.set(int, Object)

public Object set(int ix, Object attrVal) {
    if (!isOrdered() && contains(attrVal)) {
        throw new IllegalStateException('Cannot add duplicate to unordered attribute');
    }
    Object answer = values.elementAt(ix);
    values.setElementAt(attrVal, ix);
    return answer;
}

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

javax.xml.transform.dom.DOMResult.setNextSibling(Node)

/**
     * Set the child node before which the result nodes will be inserted.
     * Use <code>nextSibling</code> to specify the child node
     * before which the result nodes should be inserted.
     * If <code>nextSibling</code> is not a descendant of <code>node</code>,
     * then an <code>IllegalArgumentException</code> is thrown.
     * If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>,
     * then an <code>IllegalStateException</code> is thrown.
     * If <code>nextSibling</code> is <code>null</code>,
     * then the behavior is the same as calling {@link #DOMResult(Node node)},
     * i.e. append the result nodes as the last child of the specified <code>node</code>.
     * @param nextSibling The child node before which the result nodes will be inserted.
     * @throws IllegalArgumentException If <code>nextSibling</code> is not a descendant of <code>node</code>.
     * @throws IllegalStateException If <code>node</code> is <code>null</code> and <code>nextSibling</code> is not <code>null</code>.
     * @since 1.5
     */
public void setNextSibling(Node nextSibling) {
    if (nextSibling != null) {
        if (node == null) {
            throw new IllegalStateException('Cannot create a DOMResult when the nextSibling is contained by the \'null\' node.');
        }
        if ((node.compareDocumentPosition(nextSibling) & Node.DOCUMENT_POSITION_CONTAINED_BY) == 0) {
            throw new IllegalArgumentException('Cannot create a DOMResult when the nextSibling is not contained by the node.');
        }
    }
    this.nextSibling = nextSibling;
}

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

javax.xml.transform.dom.DOMResult.setNode(Node)

/**
     * Set the node that will contain the result DOM tree.
     * In practice, the node should be
     * a {@link org.w3c.dom.Document} node,
     * a {@link org.w3c.dom.DocumentFragment} node, or
     * a {@link org.w3c.dom.Element} node.
     * In other words, a node that accepts children.
     * An <code>IllegalStateException</code> is thrown if <code>nextSibling</code> is not <code>null</code> and
     * <code>node</code> is not a parent of <code>nextSibling</code>. 
     * An <code>IllegalStateException</code> is thrown if <code>node</code> is <code>null</code> and
     * <code>nextSibling</code> is not <code>null</code>. 
     * @param node The node to which the transformation will be appended.
     * @throws IllegalStateException If <code>nextSibling</code> is not <code>null</code> and
     *   <code>nextSibling</code> is not a child of <code>node</code>.
     * @throws IllegalStateException If <code>node</code> is <code>null</code> and
     *   <code>nextSibling</code> is not <code>null</code>.
     */
public void setNode(Node node) {
    if (nextSibling != null) {
        if (node == null) {
            throw new IllegalStateException('Cannot create a DOMResult when the nextSibling is contained by the \'null\' node.');
        }
        if ((node.compareDocumentPosition(nextSibling) & Node.DOCUMENT_POSITION_CONTAINED_BY) == 0) {
            throw new IllegalArgumentException('Cannot create a DOMResult when the nextSibling is not contained by the node.');
        }
    }
    this.node = node;
}

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

java.util.IdentityHashMap.resize(int)

/**
     * Resize the table to hold given capacity.
     * @param newCapacity the new capacity, must be a power of two.
     */
private void resize(int newCapacity) {
    int newLength = newCapacity * 2;
    Object[] oldTable = table;
    int oldLength = oldTable.length;
    if (oldLength == 2 * MAXIMUM_CAPACITY) {
        if (threshold == MAXIMUM_CAPACITY - 1) throw new IllegalStateException('Capacity exhausted.');
        threshold = MAXIMUM_CAPACITY - 1;
        return;
    }
    if (oldLength >= newLength) return;
    Object[] newTable = new Object[newLength];
    threshold = newLength / 3;
    for (int j = 0; j < oldLength; j += 2) {
        Object key = oldTable[j];
        if (key != null) {
            Object value = oldTable[j + 1];
            oldTable[j] = null;
            oldTable[j + 1] = null;
            int i = hash(key, newLength);
            while (newTable[i] != null) i = nextKeyIndex(i, newLength);
            newTable[i] = key;
            newTable[i + 1] = value;
        }
    }
    table = newTable;
}

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

javax.imageio.ImageWriteParam.getBitRate(float)

/**
     * Returns a <code>float</code> indicating an estimate of the
     * number of bits of output data for each bit of input image data
     * at the given quality level.  The value will typically lie
     * between <code>0</code> and <code>1</code>, with smaller values
     * indicating more compression.  A special value of
     * <code>-1.0F</code> is used to indicate that no estimate is
     * available.
     *  If there are multiple compression types but none has been set,
     * an <code>IllegalStateException</code> is thrown.
     *  The default implementation checks that compression is
     * supported and the compression mode is
     * <code>MODE_EXPLICIT</code>.  If so, if
     * <code>getCompressionTypes()</code> is <code>null</code> or
     * <code>getCompressionType()</code> is non-<code>null</code>, and
     * <code>quality</code> is within bounds, it returns
     * <code>-1.0</code>.
     * @param quality the quality setting whose bit rate is to be
     * queried.
     * @return an estimate of the compressed bit rate, or
     * <code>-1.0F</code> if no estimate is available.
     * @exception UnsupportedOperationException if the writer does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the set of legal
     * compression types is non-<code>null</code> and the current
     * compression type is <code>null</code>.
     * @exception IllegalArgumentException if <code>quality</code> is
     * not between <code>0</code>and <code>1</code>, inclusive.
     */
public float getBitRate(float quality) {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported.');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    if ((getCompressionTypes() != null) && (getCompressionType() == null)) {
        throw new IllegalStateException('No compression type set!');
    }
    if (quality < 0.0F || quality > 1.0F) {
        throw new IllegalArgumentException('Quality out-of-bounds!');
    }
    return -1.0F;
}

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

javax.imageio.ImageWriteParam.getCompressionQuality()

/**
     * Returns the current compression quality setting.
     *  If there are multiple compression types but none has been
     * set, an <code>IllegalStateException</code> is thrown.
     *  The default implementation checks that compression is
     * supported and that the compression mode is
     * <code>MODE_EXPLICIT</code>.  If so, if
     * <code>getCompressionTypes()</code> is <code>null</code> or
     * <code>getCompressionType()</code> is non-<code>null</code>, it
     * returns the value of the <code>compressionQuality</code>
     * instance variable.
     * @return the current compression quality setting.
     * @exception UnsupportedOperationException if the writer does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the set of legal
     * compression types is non-<code>null</code> and the current
     * compression type is <code>null</code>.
     * @see #setCompressionQuality
     */
public float getCompressionQuality() {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported.');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    if ((getCompressionTypes() != null) && (getCompressionType() == null)) {
        throw new IllegalStateException('No compression type set!');
    }
    return compressionQuality;
}

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

javax.imageio.ImageWriteParam.getCompressionQualityDescriptions()

/**
     * Returns an array of <code>String</code>s that may be used along
     * with <code>getCompressionQualityValues</code> as part of a user
     * interface for setting or displaying the compression quality
     * level.  The <code>String</code> with index <code>i</code>
     * provides a description of the range of quality levels between
     * <code>getCompressionQualityValues[i]</code> and
     * <code>getCompressionQualityValues[i + 1]</code>.  Note that the
     * length of the array returned from
     * <code>getCompressionQualityValues</code> will always be one
     * greater than that returned from
     * <code>getCompressionQualityDescriptions</code>.
     *  As an example, the strings 'Good', 'Better', and 'Best'
     * could be associated with the ranges <code>[0, .33)</code>,
     * <code>[.33, .66)</code>, and <code>[.66, 1.0]</code>.  In this
     * case, <code>getCompressionQualityDescriptions</code> would
     * return <code>{ 'Good', 'Better', 'Best' }</code> and
     * <code>getCompressionQualityValues</code> would return
     * <code>{ 0.0F, .33F, .66F, 1.0F }</code>.
     *  If no descriptions are available, <code>null</code> is
     * returned.  If <code>null</code> is returned from
     * <code>getCompressionQualityValues</code>, this method must also
     * return <code>null</code>.
     *  The descriptions should be localized for the
     * <code>Locale</code> returned by <code>getLocale</code>, if it
     * is non-<code>null</code>.
     *  If there are multiple compression types but none has been set,
     * an <code>IllegalStateException</code> is thrown.
     *  The default implementation checks that compression is
     * supported and that the compression mode is
     * <code>MODE_EXPLICIT</code>.  If so, if
     * <code>getCompressionTypes()</code> is <code>null</code> or
     * <code>getCompressionType()</code> is non-<code>null</code>, it
     * returns <code>null</code>.
     * @return an array of <code>String</code>s containing localized
     * descriptions of the compression quality levels.
     * @exception UnsupportedOperationException if the writer does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the set of legal
     * compression types is non-<code>null</code> and the current
     * compression type is <code>null</code>.
     * @see #getCompressionQualityValues
     */
public String[] getCompressionQualityDescriptions() {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported.');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    if ((getCompressionTypes() != null) && (getCompressionType() == null)) {
        throw new IllegalStateException('No compression type set!');
    }
    return null;
}

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

javax.imageio.ImageWriteParam.getCompressionQualityValues()

/**
     * Returns an array of <code>float</code>s that may be used along
     * with <code>getCompressionQualityDescriptions</code> as part of a user
     * interface for setting or displaying the compression quality
     * level.  See {@link #getCompressionQualityDescriptions
     * <code>getCompressionQualityDescriptions</code>} for more information.
     *  If no descriptions are available, <code>null</code> is
     * returned.  If <code>null</code> is returned from
     * <code>getCompressionQualityDescriptions</code>, this method
     * must also return <code>null</code>.
     *  If there are multiple compression types but none has been set,
     * an <code>IllegalStateException</code> is thrown.
     *  The default implementation checks that compression is
     * supported and that the compression mode is
     * <code>MODE_EXPLICIT</code>.  If so, if
     * <code>getCompressionTypes()</code> is <code>null</code> or
     * <code>getCompressionType()</code> is non-<code>null</code>, it
     * returns <code>null</code>.
     * @return an array of <code>float</code>s indicating the
     * boundaries between the compression quality levels as described
     * by the <code>String</code>s from
     * <code>getCompressionQualityDescriptions</code>.
     * @exception UnsupportedOperationException if the writer does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the set of legal
     * compression types is non-<code>null</code> and the current
     * compression type is <code>null</code>.
     * @see #getCompressionQualityDescriptions
     */
public float[] getCompressionQualityValues() {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported.');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    if ((getCompressionTypes() != null) && (getCompressionType() == null)) {
        throw new IllegalStateException('No compression type set!');
    }
    return null;
}

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

javax.imageio.ImageWriteParam.getCompressionType()

/**
     * Returns the currently set compression type, or
     * <code>null</code> if none has been set.  The type is returned
     * as a <code>String</code> from among those returned by
     * <code>getCompressionTypes</code>.
     * If no compression type has been set, <code>null</code> is
     * returned.
     *  The default implementation checks whether compression is
     * supported and the compression mode is
     * <code>MODE_EXPLICIT</code>.  If so, it returns the value of the
     * <code>compressionType</code> instance variable.
     * @return the current compression type as a <code>String</code>,
     * or <code>null</code> if no type is set.
     * @exception UnsupportedOperationException if the writer does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @see #setCompressionType
     */
public String getCompressionType() {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported.');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    return compressionType;
}

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

javax.imageio.ImageWriteParam.getLocalizedCompressionTypeName()

/**
     * Returns a localized version of the name of the current
     * compression type, using the <code>Locale</code> returned by
     * <code>getLocale</code>.
     *  The default implementation checks whether compression is
     * supported and the compression mode is
     * <code>MODE_EXPLICIT</code>.  If so, if
     * <code>compressionType</code> is <code>non-null</code> the value
     * of <code>getCompressionType</code> is returned as a
     * convenience.
     * @return a <code>String</code> containing a localized version of
     * the name of the current compression type.
     * @exception UnsupportedOperationException if the writer does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if no compression type is set.
     */
public String getLocalizedCompressionTypeName() {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported.');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    if (getCompressionType() == null) {
        throw new IllegalStateException('No compression type set!');
    }
    return getCompressionType();
}

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

javax.imageio.ImageWriteParam.isCompressionLossless()

/**
     * Returns <code>true</code> if the current compression type
     * provides lossless compression.  If a plug-in provides only
     * one mandatory compression type, then this method may be
     * called without calling <code>setCompressionType</code> first.
     *  If there are multiple compression types but none has
     * been set, an <code>IllegalStateException</code> is thrown.
     *  The default implementation checks whether compression is
     * supported and the compression mode is
     * <code>MODE_EXPLICIT</code>.  If so, if
     * <code>getCompressionTypes()</code> is <code>null</code> or
     * <code>getCompressionType()</code> is non-<code>null</code>
     * <code>true</code> is returned as a convenience.
     * @return <code>true</code> if the current compression type is
     * lossless.
     * @exception UnsupportedOperationException if the writer does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the set of legal
     * compression types is non-<code>null</code> and the current
     * compression type is <code>null</code>.
     */
public boolean isCompressionLossless() {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    if ((getCompressionTypes() != null) && (getCompressionType() == null)) {
        throw new IllegalStateException('No compression type set!');
    }
    return true;
}

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

javax.imageio.ImageWriteParam.setCompressionQuality(float)

/**
     * Sets the compression quality to a value between <code>0</code>
     * and <code>1</code>.  Only a single compression quality setting
     * is supported by default; writers can provide extended versions
     * of <code>ImageWriteParam</code> that offer more control.  For
     * lossy compression schemes, the compression quality should
     * control the tradeoff between file size and image quality (for
     * example, by choosing quantization tables when writing JPEG
     * images).  For lossless schemes, the compression quality may be
     * used to control the tradeoff between file size and time taken
     * to perform the compression (for example, by optimizing row
     * filters and setting the ZLIB compression level when writing
     * PNG images).
     *  A compression quality setting of 0.0 is most generically
     * interpreted as 'high compression is important,' while a setting of
     * 1.0 is most generically interpreted as 'high image quality is
     * important.'
     *  If there are multiple compression types but none has been
     * set, an <code>IllegalStateException</code> is thrown.
     *  The default implementation checks that compression is
     * supported, and that the compression mode is
     * <code>MODE_EXPLICIT</code>.  If so, if
     * <code>getCompressionTypes()</code> returns <code>null</code> or
     * <code>compressionType</code> is non-<code>null</code> it sets
     * the <code>compressionQuality</code> instance variable.
     * @param quality a <code>float</code> between <code>0</code>and
     * <code>1</code> indicating the desired quality level.
     * @exception UnsupportedOperationException if the writer does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the set of legal
     * compression types is non-<code>null</code> and the current
     * compression type is <code>null</code>.
     * @exception IllegalArgumentException if <code>quality</code> is
     * not between <code>0</code>and <code>1</code>, inclusive.
     * @see #getCompressionQuality
     */
public void setCompressionQuality(float quality) {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    if (getCompressionTypes() != null && getCompressionType() == null) {
        throw new IllegalStateException('No compression type set!');
    }
    if (quality < 0.0F || quality > 1.0F) {
        throw new IllegalArgumentException('Quality out-of-bounds!');
    }
    this.compressionQuality = quality;
}

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

javax.imageio.ImageWriteParam.setCompressionType(String)

/**
     * Sets the compression type to one of the values indicated by
     * <code>getCompressionTypes</code>.  If a value of
     * <code>null</code> is passed in, any previous setting is
     * removed.
     *  The default implementation checks whether compression is
     * supported and the compression mode is
     * <code>MODE_EXPLICIT</code>.  If so, it calls
     * <code>getCompressionTypes</code> and checks if
     * <code>compressionType</code> is one of the legal values.  If it
     * is, the <code>compressionType</code> instance variable is set.
     * If <code>compressionType</code> is <code>null</code>, the
     * instance variable is set without performing any checking.
     * @param compressionType one of the <code>String</code>s returned
     * by <code>getCompressionTypes</code>, or <code>null</code> to
     * remove any previous setting.
     * @exception UnsupportedOperationException if the writer does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception UnsupportedOperationException if there are no
     * settable compression types.
     * @exception IllegalArgumentException if
     * <code>compressionType</code> is non-<code>null</code> but is not
     * one of the values returned by <code>getCompressionTypes</code>.
     * @see #getCompressionTypes
     * @see #getCompressionType
     * @see #unsetCompression
     */
public void setCompressionType(String compressionType) {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    String[] legalTypes = getCompressionTypes();
    if (legalTypes == null) {
        throw new UnsupportedOperationException('No settable compression types');
    }
    if (compressionType != null) {
        boolean found = false;
        if (legalTypes != null) {
            for (int i = 0; i < legalTypes.length; i++) {
                if (compressionType.equals(legalTypes[i])) {
                    found = true;
                    break;
                }
            }
        }
        if (!found) {
            throw new IllegalArgumentException('Unknown compression type!');
        }
    }
    this.compressionType = compressionType;
}

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

javax.imageio.ImageWriteParam.unsetCompression()

/**
     * Removes any previous compression type and quality settings.
     *  The default implementation sets the instance variable
     * <code>compressionType</code> to <code>null</code>, and the
     * instance variable <code>compressionQuality</code> to
     * <code>1.0F</code>.
     * @exception UnsupportedOperationException if the plug-in does not
     * support compression.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     * @see #setCompressionType
     * @see #setCompressionQuality
     */
public void unsetCompression() {
    if (!canWriteCompressed()) {
        throw new UnsupportedOperationException('Compression not supported');
    }
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    this.compressionType = null;
    this.compressionQuality = 1.0F;
}

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

javax.imageio.plugins.jpeg.JPEGImageWriteParam.getCompressionQualityDescriptions()

public String[] getCompressionQualityDescriptions() {
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    if ((getCompressionTypes() != null) && (getCompressionType() == null)) {
        throw new IllegalStateException('No compression type set!');
    }
    return (String[]) qualityDescs.clone();
}

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

javax.imageio.plugins.jpeg.JPEGImageWriteParam.getCompressionQualityValues()

public float[] getCompressionQualityValues() {
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    if ((getCompressionTypes() != null) && (getCompressionType() == null)) {
        throw new IllegalStateException('No compression type set!');
    }
    return (float[]) qualityVals.clone();
}

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

javax.imageio.plugins.jpeg.JPEGImageWriteParam.isCompressionLossless()

/**
     * Returns <code>false</code> since the JPEG plug-in only supports
     * lossy compression.
     * @return <code>false</code>.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     */
public boolean isCompressionLossless() {
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    return false;
}

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

javax.imageio.plugins.jpeg.JPEGImageWriteParam.unsetCompression()

/**
     * Removes any previous compression quality setting.
     *  The default implementation resets the compression quality
     * to <code>0.75F</code>.
     * @exception IllegalStateException if the compression mode is not
     * <code>MODE_EXPLICIT</code>.
     */
public void unsetCompression() {
    if (getCompressionMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Compression mode not MODE_EXPLICIT!');
    }
    this.compressionQuality = JPEG.DEFAULT_QUALITY;
}

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

java.nio.charset.CharsetDecoder.throwIllegalStateException(int, int)

private void throwIllegalStateException(int from, int to) {
    throw new IllegalStateException('Current state = ' + stateNames[from] + ', new state = ' + stateNames[to]);
}

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

java.nio.charset.CharsetEncoder.throwIllegalStateException(int, int)

private void throwIllegalStateException(int from, int to) {
    throw new IllegalStateException('Current state = ' + stateNames[from] + ', new state = ' + stateNames[to]);
}

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.IDLNameTranslatorImpl.buildNameTranslation()

private void buildNameTranslation() {
    Map allMethodInfo = new HashMap();
    for (int ctr = 0; ctr < interf_.length; ctr++) {
        Class interf = interf_[ctr];
        IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
        final Method[] methods = interf.getMethods();
        AccessController.doPrivileged(new PrivilegedAction() {

            public Object run() {
                Method.setAccessible(methods, true);
                return null;
            }
        });
        for (int i = 0; i < methods.length; i++) {
            Method nextMethod = methods[i];
            IDLMethodInfo methodInfo = new IDLMethodInfo();
            methodInfo.method = nextMethod;
            if (idlTypesUtil.isPropertyAccessorMethod(nextMethod, interf)) {
                methodInfo.isProperty = true;
                String attributeName = idlTypesUtil.getAttributeNameForProperty(nextMethod.getName());
                methodInfo.originalName = attributeName;
                methodInfo.mangledName = attributeName;
            } else {
                methodInfo.isProperty = false;
                methodInfo.originalName = nextMethod.getName();
                methodInfo.mangledName = nextMethod.getName();
            }
            allMethodInfo.put(nextMethod, methodInfo);
        }
    }
    for (Iterator outerIter = allMethodInfo.values().iterator(); outerIter.hasNext(); ) {
        IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
        for (Iterator innerIter = allMethodInfo.values().iterator(); innerIter.hasNext(); ) {
            IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
            if ((outer != inner) && (!outer.originalName.equals(inner.originalName)) && outer.originalName.equalsIgnoreCase(inner.originalName)) {
                outer.mangledName = mangleCaseSensitiveCollision(outer.originalName);
                break;
            }
        }
    }
    for (Iterator iter = allMethodInfo.values().iterator(); iter.hasNext(); ) {
        IDLMethodInfo next = (IDLMethodInfo) iter.next();
        next.mangledName = mangleIdentifier(next.mangledName, next.isProperty);
    }
    for (Iterator outerIter = allMethodInfo.values().iterator(); outerIter.hasNext(); ) {
        IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
        if (outer.isProperty) {
            continue;
        }
        for (Iterator innerIter = allMethodInfo.values().iterator(); innerIter.hasNext(); ) {
            IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
            if ((outer != inner) && !inner.isProperty && outer.originalName.equals(inner.originalName)) {
                outer.mangledName = mangleOverloadedMethod(outer.mangledName, outer.method);
                break;
            }
        }
    }
    for (Iterator outerIter = allMethodInfo.values().iterator(); outerIter.hasNext(); ) {
        IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
        if (!outer.isProperty) {
            continue;
        }
        for (Iterator innerIter = allMethodInfo.values().iterator(); innerIter.hasNext(); ) {
            IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
            if ((outer != inner) && !inner.isProperty && outer.mangledName.equals(inner.mangledName)) {
                outer.mangledName = outer.mangledName + ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS;
                break;
            }
        }
    }
    for (int ctr = 0; ctr < interf_.length; ctr++) {
        Class interf = interf_[ctr];
        String mappedContainerName = getMappedContainerName(interf);
        for (Iterator iter = allMethodInfo.values().iterator(); iter.hasNext(); ) {
            IDLMethodInfo next = (IDLMethodInfo) iter.next();
            if (!next.isProperty && identifierClashesWithContainer(mappedContainerName, next.mangledName)) {
                next.mangledName = mangleContainerClash(next.mangledName);
            }
        }
    }
    methodToIDLNameMap_ = new HashMap();
    IDLNameToMethodMap_ = new HashMap();
    methods_ = (Method[]) allMethodInfo.keySet().toArray(new Method[0]);
    for (Iterator iter = allMethodInfo.values().iterator(); iter.hasNext(); ) {
        IDLMethodInfo next = (IDLMethodInfo) iter.next();
        String idlName = next.mangledName;
        if (next.isProperty) {
            String origMethodName = next.method.getName();
            String prefix = '';
            if (origMethodName.startsWith('get')) {
                prefix = GET_ATTRIBUTE_PREFIX;
            } else if (origMethodName.startsWith('set')) {
                prefix = SET_ATTRIBUTE_PREFIX;
            } else {
                prefix = IS_ATTRIBUTE_PREFIX;
            }
            idlName = prefix + next.mangledName;
        }
        methodToIDLNameMap_.put(next.method, idlName);
        if (IDLNameToMethodMap_.containsKey(idlName)) {
            Method clash = (Method) IDLNameToMethodMap_.get(idlName);
            throw new IllegalStateException('Error : methods ' + clash + ' and ' + next.method + ' both result in IDL name '' + idlName + ''');
        } else {
            IDLNameToMethodMap_.put(idlName, next.method);
        }
    }
    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.html.internal.dom.HTMLDocumentImpl.createElement(String)

public Element createElement(String tagName) throws DOMException {
    Class elemClass;
    Constructor cnst;
    tagName = tagName.toUpperCase(Locale.ENGLISH);
    elemClass = (Class) _elementTypesHTML.get(tagName);
    if (elemClass != null) {
        try {
            cnst = elemClass.getConstructor(_elemClassSigHTML);
            return (Element) cnst.newInstance(new Object[] { this, tagName });
        } catch (Exception except) {
            Throwable thrw;
            if (except instanceof java.lang.reflect.InvocationTargetException) thrw = ((java.lang.reflect.InvocationTargetException) except).getTargetException(); else thrw = except;
            throw new IllegalStateException('HTM15 Tag '' + tagName + '' associated with an Element class that failed to construct.\n' + tagName);
        }
    }
    return new HTMLElementImpl(this, tagName);
}

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

javax.naming.spi.NamingManager.setInitialContextFactoryBuilder(InitialContextFactoryBuilder)

/**
     * Sets the InitialContextFactory builder to be builder.
     *
     * The builder can only be installed if the executing thread is allowed by
     * the security manager to do so. Once installed, the builder cannot 
     * be replaced.
     * @param builder The initial context factory builder to install. If null,
     *                no builder is set.
     * @exception SecurityException builder cannot be installed for security
     *   reasons.
     * @exception NamingException builder cannot be installed for
     *         a non-security-related reason.
     * @exception IllegalStateException If a builder was previous installed.
     * @see #hasInitialContextFactoryBuilder
     * @see java.lang.SecurityManager#checkSetFactory
     */
public static synchronized void setInitialContextFactoryBuilder(InitialContextFactoryBuilder builder) throws NamingException {
    if (initctx_factory_builder != null) throw new IllegalStateException('InitialContextFactoryBuilder already set');
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkSetFactory();
    }
    initctx_factory_builder = builder;
}

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.jpeg.JPEGImageReader.getNumImages(boolean)

public int getNumImages(boolean allowSearch) throws IOException {
    if (numImages != 0) {
        return numImages;
    }
    if (iis == null) {
        throw new IllegalStateException('Input not set');
    }
    if (allowSearch == true) {
        if (seekForwardOnly) {
            throw new IllegalStateException('seekForwardOnly and allowSearch can't both be true!');
        }
        if (!tablesOnlyChecked) {
            checkTablesOnly();
        }
        iis.mark();
        gotoImage(0);
        JPEGBuffer buffer = new JPEGBuffer(iis);
        buffer.loadBuf(0);
        boolean done = false;
        while (!done) {
            done = buffer.scanForFF(this);
            switch(buffer.buf[buffer.bufPtr] & 0xff) {
                case JPEG.SOI:
                    numImages++;
                case 0:
                case JPEG.RST0:
                case JPEG.RST1:
                case JPEG.RST2:
                case JPEG.RST3:
                case JPEG.RST4:
                case JPEG.RST5:
                case JPEG.RST6:
                case JPEG.RST7:
                case JPEG.EOI:
                    buffer.bufAvail--;
                    buffer.bufPtr++;
                    break;
                default:
                    buffer.bufAvail--;
                    buffer.bufPtr++;
                    buffer.loadBuf(2);
                    int length = ((buffer.buf[buffer.bufPtr++] & 0xff) << 8) | (buffer.buf[buffer.bufPtr++] & 0xff);
                    buffer.bufAvail -= 2;
                    length -= 2;
                    buffer.skipData(length);
            }
        }
        iis.reset();
        return numImages;
    }
    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.imageio.plugins.jpeg.JPEGImageReader.gotoImage(int)

/**
     * Sets the input stream to the start of the requested image.
     * @exception IllegalStateException if the input source has not been
     * set.
     * @exception IndexOutOfBoundsException if the supplied index is
     * out of bounds.
     */
private void gotoImage(int imageIndex) throws IOException {
    if (iis == null) {
        throw new IllegalStateException('Input not set');
    }
    if (imageIndex < minIndex) {
        throw new IndexOutOfBoundsException();
    }
    if (!tablesOnlyChecked) {
        checkTablesOnly();
    }
    if (imageIndex < imagePositions.size()) {
        iis.seek(((Long) (imagePositions.get(imageIndex))).longValue());
    } else {
        Long pos = (Long) imagePositions.get(imagePositions.size() - 1);
        iis.seek(pos.longValue());
        skipImage();
        for (int index = imagePositions.size(); index <= imageIndex; index++) {
            if (!hasNextImage()) {
                throw new IndexOutOfBoundsException();
            }
            pos = new Long(iis.getStreamPosition());
            imagePositions.add(pos);
            if (seekForwardOnly) {
                iis.flushBefore(pos.longValue());
            }
            if (index < imageIndex) {
                skipImage();
            }
        }
    }
    if (seekForwardOnly) {
        minIndex = imageIndex;
    }
    haveSeeked = 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.gif.GIFImageReader.getNumImages(boolean)

public int getNumImages(boolean allowSearch) throws IIOException {
    if (stream == null) {
        throw new IllegalStateException('Input not set!');
    }
    if (seekForwardOnly && allowSearch) {
        throw new IllegalStateException('seekForwardOnly and allowSearch can't both be true!');
    }
    if (numImages > 0) {
        return numImages;
    }
    if (allowSearch) {
        this.numImages = locateImage(Integer.MAX_VALUE) + 1;
    }
    return numImages;
}

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.GIFImageReader.read(int, ImageReadParam)

public BufferedImage read(int imageIndex, ImageReadParam param) throws IIOException {
    if (stream == null) {
        throw new IllegalStateException('Input not set!');
    }
    checkIndex(imageIndex);
    int index = locateImage(imageIndex);
    if (index != imageIndex) {
        throw new IndexOutOfBoundsException('imageIndex out of bounds!');
    }
    clearAbortRequest();
    readMetadata();
    if (param == null) {
        param = getDefaultReadParam();
    }
    Iterator imageTypes = getImageTypes(imageIndex);
    this.theImage = getDestination(param, imageTypes, imageMetadata.imageWidth, imageMetadata.imageHeight);
    this.theTile = theImage.getWritableTile(0, 0);
    this.width = imageMetadata.imageWidth;
    this.height = imageMetadata.imageHeight;
    this.streamX = 0;
    this.streamY = 0;
    this.rowsDone = 0;
    this.interlacePass = 0;
    this.sourceRegion = new Rectangle(0, 0, 0, 0);
    this.destinationRegion = new Rectangle(0, 0, 0, 0);
    computeRegions(param, width, height, theImage, sourceRegion, destinationRegion);
    this.destinationOffset = new Point(destinationRegion.x, destinationRegion.y);
    this.sourceXSubsampling = param.getSourceXSubsampling();
    this.sourceYSubsampling = param.getSourceYSubsampling();
    this.sourceMinProgressivePass = Math.max(param.getSourceMinProgressivePass(), 0);
    this.sourceMaxProgressivePass = Math.min(param.getSourceMaxProgressivePass(), 3);
    this.destY = destinationRegion.y + (streamY - sourceRegion.y) / sourceYSubsampling;
    computeDecodeThisRow();
    processImageStarted(imageIndex);
    startPass(0);
    this.rowBuf = new byte[width];
    try {
        this.initCodeSize = stream.readUnsignedByte();
        this.blockLength = stream.readUnsignedByte();
        int left = blockLength;
        int off = 0;
        while (left > 0) {
            int nbytes = stream.read(block, off, left);
            left -= nbytes;
            off += nbytes;
        }
        this.bitPos = 0;
        this.nextByte = 0;
        this.lastBlockFound = false;
        this.interlacePass = 0;
        initNext32Bits();
        this.clearCode = 1 << initCodeSize;
        this.eofCode = clearCode + 1;
        int code, oldCode = 0;
        int[] prefix = new int[4096];
        byte[] suffix = new byte[4096];
        byte[] initial = new byte[4096];
        int[] length = new int[4096];
        byte[] string = new byte[4096];
        initializeStringTable(prefix, suffix, initial, length);
        int tableIndex = (1 << initCodeSize) + 2;
        int codeSize = initCodeSize + 1;
        int codeMask = (1 << codeSize) - 1;
        while (!abortRequested()) {
            code = getCode(codeSize, codeMask);
            if (code == clearCode) {
                initializeStringTable(prefix, suffix, initial, length);
                tableIndex = (1 << initCodeSize) + 2;
                codeSize = initCodeSize + 1;
                codeMask = (1 << codeSize) - 1;
                code = getCode(codeSize, codeMask);
                if (code == eofCode) {
                    processImageComplete();
                    return theImage;
                }
            } else if (code == eofCode) {
                processImageComplete();
                return theImage;
            } else {
                int newSuffixIndex;
                if (code < tableIndex) {
                    newSuffixIndex = code;
                } else {
                    newSuffixIndex = oldCode;
                    if (code != tableIndex) {
                        processWarningOccurred('Out-of-sequence code!');
                    }
                }
                int ti = tableIndex;
                int oc = oldCode;
                prefix[ti] = oc;
                suffix[ti] = initial[newSuffixIndex];
                initial[ti] = initial[oc];
                length[ti] = length[oc] + 1;
                ++tableIndex;
                if ((tableIndex == (1 << codeSize)) && (tableIndex < 4096)) {
                    ++codeSize;
                    codeMask = (1 << codeSize) - 1;
                }
            }
            int c = code;
            int len = length[c];
            for (int i = len - 1; i >= 0; i--) {
                string[i] = suffix[c];
                c = prefix[c];
            }
            outputPixels(string, len);
            oldCode = code;
        }
        processReadAborted();
        return theImage;
    } catch (IOException e) {
        e.printStackTrace();
        throw new IIOException('I/O error reading image!', e);
    }
}

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.GIFImageReader.readHeader()

private void readHeader() throws IIOException {
    if (gotHeader) {
        return;
    }
    if (stream == null) {
        throw new IllegalStateException('Input not set!');
    }
    this.streamMetadata = new GIFStreamMetadata();
    try {
        stream.setByteOrder(ByteOrder.LITTLE_ENDIAN);
        byte[] signature = new byte[6];
        stream.readFully(signature);
        StringBuffer version = new StringBuffer(3);
        version.append((char) signature[3]);
        version.append((char) signature[4]);
        version.append((char) signature[5]);
        streamMetadata.version = version.toString();
        streamMetadata.logicalScreenWidth = stream.readUnsignedShort();
        streamMetadata.logicalScreenHeight = stream.readUnsignedShort();
        int packedFields = stream.readUnsignedByte();
        boolean globalColorTableFlag = (packedFields & 0x80) != 0;
        streamMetadata.colorResolution = ((packedFields >> 4) & 0x7) + 1;
        streamMetadata.sortFlag = (packedFields & 0x8) != 0;
        int numGCTEntries = 1 << ((packedFields & 0x7) + 1);
        streamMetadata.backgroundColorIndex = stream.readUnsignedByte();
        streamMetadata.pixelAspectRatio = stream.readUnsignedByte();
        if (globalColorTableFlag) {
            streamMetadata.globalColorTable = new byte[3 * numGCTEntries];
            stream.readFully(streamMetadata.globalColorTable);
        } else {
            streamMetadata.globalColorTable = null;
        }
        imageStartPosition.add(new Long(stream.getStreamPosition()));
    } catch (IOException e) {
        throw new IIOException('I/O error reading header!', e);
    }
    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.gif.GIFImageReader.readMetadata()

private void readMetadata() throws IIOException {
    if (stream == null) {
        throw new IllegalStateException('Input not set!');
    }
    try {
        this.imageMetadata = new GIFImageMetadata();
        long startPosition = stream.getStreamPosition();
        while (true) {
            int blockType = stream.readUnsignedByte();
            if (blockType == 0x2c) {
                imageMetadata.imageLeftPosition = stream.readUnsignedShort();
                imageMetadata.imageTopPosition = stream.readUnsignedShort();
                imageMetadata.imageWidth = stream.readUnsignedShort();
                imageMetadata.imageHeight = stream.readUnsignedShort();
                int idPackedFields = stream.readUnsignedByte();
                boolean localColorTableFlag = (idPackedFields & 0x80) != 0;
                imageMetadata.interlaceFlag = (idPackedFields & 0x40) != 0;
                imageMetadata.sortFlag = (idPackedFields & 0x20) != 0;
                int numLCTEntries = 1 << ((idPackedFields & 0x7) + 1);
                if (localColorTableFlag) {
                    imageMetadata.localColorTable = new byte[3 * numLCTEntries];
                    stream.readFully(imageMetadata.localColorTable);
                } else {
                    imageMetadata.localColorTable = null;
                }
                this.imageMetadataLength = (int) (stream.getStreamPosition() - startPosition);
                return;
            } else if (blockType == 0x21) {
                int label = stream.readUnsignedByte();
                if (label == 0xf9) {
                    int gceLength = stream.readUnsignedByte();
                    int gcePackedFields = stream.readUnsignedByte();
                    imageMetadata.disposalMethod = (gcePackedFields >> 2) & 0x3;
                    imageMetadata.userInputFlag = (gcePackedFields & 0x2) != 0;
                    imageMetadata.transparentColorFlag = (gcePackedFields & 0x1) != 0;
                    imageMetadata.delayTime = stream.readUnsignedShort();
                    imageMetadata.transparentColorIndex = stream.readUnsignedByte();
                    int terminator = stream.readUnsignedByte();
                } else if (label == 0x1) {
                    int length = stream.readUnsignedByte();
                    imageMetadata.hasPlainTextExtension = true;
                    imageMetadata.textGridLeft = stream.readUnsignedShort();
                    imageMetadata.textGridTop = stream.readUnsignedShort();
                    imageMetadata.textGridWidth = stream.readUnsignedShort();
                    imageMetadata.textGridHeight = stream.readUnsignedShort();
                    imageMetadata.characterCellWidth = stream.readUnsignedByte();
                    imageMetadata.characterCellHeight = stream.readUnsignedByte();
                    imageMetadata.textForegroundColor = stream.readUnsignedByte();
                    imageMetadata.textBackgroundColor = stream.readUnsignedByte();
                    imageMetadata.text = concatenateBlocks();
                } else if (label == 0xfe) {
                    byte[] comment = concatenateBlocks();
                    if (imageMetadata.comments == null) {
                        imageMetadata.comments = new ArrayList();
                    }
                    imageMetadata.comments.add(comment);
                } else if (label == 0xff) {
                    int blockSize = stream.readUnsignedByte();
                    byte[] applicationID = new byte[8];
                    stream.readFully(applicationID);
                    byte[] authCode = new byte[3];
                    stream.readFully(authCode);
                    byte[] applicationData = concatenateBlocks();
                    if (imageMetadata.applicationIDs == null) {
                        imageMetadata.applicationIDs = new ArrayList();
                        imageMetadata.authenticationCodes = new ArrayList();
                        imageMetadata.applicationData = new ArrayList();
                    }
                    imageMetadata.applicationIDs.add(applicationID);
                    imageMetadata.authenticationCodes.add(authCode);
                    imageMetadata.applicationData.add(applicationData);
                } else {
                    int length = 0;
                    do {
                        length = stream.readUnsignedByte();
                        stream.skipBytes(length);
                    } while (length > 0);
                }
            } else if (blockType == 0x3b) {
                throw new IndexOutOfBoundsException('Attempt to read past end of image sequence!');
            } else {
                throw new IIOException('Unexpected block type ' + blockType + '!');
            }
        }
    } catch (IIOException iioe) {
        throw iioe;
    } catch (IOException ioe) {
        throw new IIOException('I/O error reading image metadata!', ioe);
    }
}

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.png.PNGImageReader.readHeader()

private void readHeader() throws IIOException {
    if (gotHeader) {
        return;
    }
    if (stream == null) {
        throw new IllegalStateException('Input source not set!');
    }
    try {
        byte[] signature = new byte[8];
        stream.readFully(signature);
        if (signature[0] != (byte) 137 || signature[1] != (byte) 80 || signature[2] != (byte) 78 || signature[3] != (byte) 71 || signature[4] != (byte) 13 || signature[5] != (byte) 10 || signature[6] != (byte) 26 || signature[7] != (byte) 10) {
            throw new IIOException('Bad PNG signature!');
        }
        int IHDR_length = stream.readInt();
        if (IHDR_length != 13) {
            throw new IIOException('Bad length for IHDR chunk!');
        }
        int IHDR_type = stream.readInt();
        if (IHDR_type != IHDR_TYPE) {
            throw new IIOException('Bad type for IHDR chunk!');
        }
        this.metadata = new PNGMetadata();
        int width = stream.readInt();
        int height = stream.readInt();
        int bitDepth = stream.readUnsignedByte();
        int colorType = stream.readUnsignedByte();
        int compressionMethod = stream.readUnsignedByte();
        int filterMethod = stream.readUnsignedByte();
        int interlaceMethod = stream.readUnsignedByte();
        int IHDR_CRC = stream.readInt();
        stream.flushBefore(stream.getStreamPosition());
        if (width == 0) {
            throw new IIOException('Image width == 0!');
        }
        if (height == 0) {
            throw new IIOException('Image height == 0!');
        }
        if (bitDepth != 1 && bitDepth != 2 && bitDepth != 4 && bitDepth != 8 && bitDepth != 16) {
            throw new IIOException('Bit depth must be 1, 2, 4, 8, or 16!');
        }
        if (colorType != 0 && colorType != 2 && colorType != 3 && colorType != 4 && colorType != 6) {
            throw new IIOException('Color type must be 0, 2, 3, 4, or 6!');
        }
        if (colorType == PNG_COLOR_PALETTE && bitDepth == 16) {
            throw new IIOException('Bad color type/bit depth combination!');
        }
        if ((colorType == PNG_COLOR_RGB || colorType == PNG_COLOR_RGB_ALPHA || colorType == PNG_COLOR_GRAY_ALPHA) && (bitDepth != 8 && bitDepth != 16)) {
            throw new IIOException('Bad color type/bit depth combination!');
        }
        if (compressionMethod != 0) {
            throw new IIOException('Unknown compression method (not 0)!');
        }
        if (filterMethod != 0) {
            throw new IIOException('Unknown filter method (not 0)!');
        }
        if (interlaceMethod != 0 && interlaceMethod != 1) {
            throw new IIOException('Unknown interlace method (not 0 or 1)!');
        }
        metadata.IHDR_present = true;
        metadata.IHDR_width = width;
        metadata.IHDR_height = height;
        metadata.IHDR_bitDepth = bitDepth;
        metadata.IHDR_colorType = colorType;
        metadata.IHDR_compressionMethod = compressionMethod;
        metadata.IHDR_filterMethod = filterMethod;
        metadata.IHDR_interlaceMethod = interlaceMethod;
        gotHeader = true;
    } catch (IOException e) {
        throw new IIOException('I/O error reading PNG header!', e);
    }
}

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.WBMPImageReader.readHeader()

public void readHeader() throws IOException {
    if (gotHeader) return;
    if (iis == null) {
        throw new IllegalStateException('Input source not set!');
    }
    metadata = new WBMPMetadata();
    wbmpType = iis.readByte();
    byte fixHeaderField = iis.readByte();
    if (fixHeaderField != 0 || !isValidWbmpType(wbmpType)) {
        throw new IIOException(I18N.getString('WBMPImageReader2'));
    }
    metadata.wbmpType = wbmpType;
    width = readMultiByteInteger();
    metadata.width = width;
    height = readMultiByteInteger();
    metadata.height = height;
    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.corba.se.impl.orbutil.fsm.StateEngineImpl.mustBeInitializing()

private void mustBeInitializing() throws IllegalStateException {
    if (!initializing) throw new IllegalStateException('Invalid method call after initialization completed');
}

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.fsm.StateEngineImpl.mustNotBeInitializing()

private void mustNotBeInitializing() throws IllegalStateException {
    if (initializing) throw new IllegalStateException('Invalid method call before initialization completed');
}

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.mergeTree(String, Node)

public void mergeTree(String formatName, Node root) {
    throw new IllegalStateException('Metadata is read-only!');
}

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.reset()

public void reset() {
    throw new IllegalStateException('Metadata is read-only!');
}

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.setFromTree(String, Node)

public void setFromTree(String formatName, Node root) {
    throw new IllegalStateException('Metadata is read-only!');
}

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.GIFStreamMetadata.mergeTree(String, Node)

public void mergeTree(String formatName, Node root) {
    throw new IllegalStateException('Metadata is read-only!');
}

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.GIFStreamMetadata.reset()

public void reset() {
    throw new IllegalStateException('Metadata is read-only!');
}

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.GIFStreamMetadata.setFromTree(String, Node)

public void setFromTree(String formatName, Node root) {
    throw new IllegalStateException('Metadata is read-only!');
}

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.HTMLDocument.verifyParser()

/**
     * Verifies the document has an <code>HTMLEditorKit.Parser</code> set.
     * If <code>getParser</code> returns <code>null</code>, this will throw an 
     * IllegalStateException.
     * @throws IllegalStateException if the document does not have a Parser
     */
private void verifyParser() {
    if (getParser() == null) {
        throw new IllegalStateException('No HTMLEditorKit.Parser');
    }
}

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

javax.imageio.ImageWriter.endWriteEmpty()

/**
     * Completes the writing of a new image that was begun with a
     * prior call to <code>prepareWriteEmpty</code>.
     *  If <code>canWriteEmpty()</code> returns <code>false</code>,
     * an <code>UnsupportedOperationException</code> will be thrown.
     *  The default implementation throws an
     * <code>IllegalStateException</code> if the output is
     * <code>null</code>, and otherwise throws an
     * <code>UnsupportedOperationException</code>.
     * @exception IllegalStateException if the output has not
     * been set.
     * @exception UnsupportedOperationException if
     * <code>canWriteEmpty(imageIndex)</code> returns
     * <code>false</code>.
     * @exception IllegalStateException if a previous call to
     * <code>prepareWriteEmpty</code> without a corresponding call to
     * <code>endWriteEmpty</code> has not been made.
     * @exception IllegalStateException if a previous call to
     * <code>prepareInsertEmpty</code> without a corresponding call to
     * <code>endInsertEmpty</code> has been made.
     * @exception IllegalStateException if a call to
     * <code>prepareReiplacePixels</code> has been made without a
     * matching call to <code>endReplacePixels</code>.
     * @exception IOException if an I/O error occurs during writing.
     */
public void endWriteEmpty() throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException('getOutput() == null!');
    }
    throw new IllegalStateException('No call to prepareWriteEmpty!');
}

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.PNGImageReader.getNumImages(boolean)

public int getNumImages(boolean allowSearch) throws IIOException {
    if (stream == null) {
        throw new IllegalStateException('No input source set!');
    }
    if (seekForwardOnly && allowSearch) {
        throw new IllegalStateException('seekForwardOnly and allowSearch can't both be true!');
    }
    return 1;
}

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

java.util.regex.Matcher.appendReplacement(StringBuffer, String)

/**
     * Implements a non-terminal append-and-replace step.
     *  This method performs the following actions: 
     * <ol>
     *   <li> It reads characters from the input sequence, starting at the
     *   append position, and appends them to the given string buffer.  It
     *   stops after reading the last character preceding the previous match,
     *   that is, the character at index {@link
     *   #start()} <tt>-</tt> <tt>1</tt>.  </li>
     *   <li> It appends the given replacement string to the string buffer.
     *   </li>
     *   <li> It sets the append position of this matcher to the index of
     *   the last character matched, plus one, that is, to {@link #end()}.
     *   </li>
     * </ol>
     *  The replacement string may contain references to subsequences
     * captured during the previous match: Each occurrence of
     * <tt>$</tt><i>g</i><tt></tt> will be replaced by the result of
     * evaluating {@link #group(int) group}<tt>(</tt><i>g</i><tt>)</tt>. 
     * The first number after the <tt>$</tt> is always treated as part of
     * the group reference. Subsequent numbers are incorporated into g if
     * they would form a legal group reference. Only the numerals '0'
     * through '9' are considered as potential components of the group
     * reference. If the second group matched the string <tt>'foo'</tt>, for
     * example, then passing the replacement string <tt>'$2bar'</tt> would
     * cause <tt>'foobar'</tt> to be appended to the string buffer. A dollar
     * sign (<tt>$</tt>) may be included as a literal in the replacement
     * string by preceding it with a backslash (<tt>\$</tt>).
     *  Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
     * the replacement string may cause the results to be different than if it
     * were being treated as a literal replacement string. Dollar signs may be
     * treated as references to captured subsequences as described above, and
     * backslashes are used to escape literal characters in the replacement
     * string.
     *  This method is intended to be used in a loop together with the
     * {@link #appendTail appendTail} and {@link #find find} methods.  The
     * following code, for example, writes <tt>one dog two dogs in the
     * yard</tt> to the standard-output stream: 
     * <blockquote>
     * Pattern p = Pattern.compile('cat');
     * Matcher m = p.matcher('one cat two cats in the yard');
     * StringBuffer sb = new StringBuffer();
     * while (m.find()) {
     *     m.appendReplacement(sb, 'dog');
     * }
     * m.appendTail(sb);
     * System.out.println(sb.toString());</blockquote>
     * @param  sb
     *         The target string buffer
     * @param  replacement
     *         The replacement string
     * @return  This matcher
     * @throws  IllegalStateException
     *          If no match has yet been attempted,
     *          or if the previous match operation failed
     * @throws  IndexOutOfBoundsException
     *          If the replacement string refers to a capturing group
     *          that does not exist in the pattern
     */
public Matcher appendReplacement(StringBuffer sb, String replacement) {
    if (first < 0) throw new IllegalStateException('No match available');
    int cursor = 0;
    String s = replacement;
    StringBuffer result = new StringBuffer();
    while (cursor < replacement.length()) {
        char nextChar = replacement.charAt(cursor);
        if (nextChar == '\\') {
            cursor++;
            nextChar = replacement.charAt(cursor);
            result.append(nextChar);
            cursor++;
        } else if (nextChar == '$') {
            cursor++;
            int refNum = (int) replacement.charAt(cursor) - '0';
            if ((refNum < 0) || (refNum > 9)) throw new IllegalArgumentException('Illegal group reference');
            cursor++;
            boolean done = false;
            while (!done) {
                if (cursor >= replacement.length()) {
                    break;
                }
                int nextDigit = replacement.charAt(cursor) - '0';
                if ((nextDigit < 0) || (nextDigit > 9)) {
                    break;
                }
                int newRefNum = (refNum * 10) + nextDigit;
                if (groupCount() < newRefNum) {
                    done = true;
                } else {
                    refNum = newRefNum;
                    cursor++;
                }
            }
            if (group(refNum) != null) result.append(group(refNum));
        } else {
            result.append(nextChar);
            cursor++;
        }
    }
    sb.append(getSubSequence(lastAppendPosition, first));
    sb.append(result.toString());
    lastAppendPosition = last;
    return this;
}

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

java.util.regex.Matcher.end()

/**
     * Returns the offset after the last character matched.  
     * @return  The offset after the last character matched
     * @throws  IllegalStateException
     *          If no match has yet been attempted,
     *          or if the previous match operation failed
     */
public int end() {
    if (first < 0) throw new IllegalStateException('No match available');
    return last;
}

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

java.util.regex.Matcher.end(int)

/**
     * Returns the offset after the last character of the subsequence
     * captured by the given group during the previous match operation.
     *  <a href='Pattern.html#cg'>Capturing groups</a> are indexed from left
     * to right, starting at one.  Group zero denotes the entire pattern, so
     * the expression <i>m.</i><tt>end(0)</tt> is equivalent to
     * <i>m.</i><tt>end()</tt>.  
     * @param  group
     *         The index of a capturing group in this matcher's pattern
     * @return  The offset after the last character captured by the group,
     *          or <tt>-1</tt> if the match was successful
     *          but the group itself did not match anything
     * @throws  IllegalStateException
     *          If no match has yet been attempted,
     *          or if the previous match operation failed
     * @throws  IndexOutOfBoundsException
     *          If there is no capturing group in the pattern
     *          with the given index
     */
public int end(int group) {
    if (first < 0) throw new IllegalStateException('No match available');
    if (group > groupCount()) throw new IndexOutOfBoundsException('No group ' + group);
    return groups[group * 2 + 1];
}

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

java.util.regex.Matcher.start()

/**
     * Returns the start index of the previous match.  
     * @return  The index of the first character matched
     * @throws  IllegalStateException
     *          If no match has yet been attempted,
     *          or if the previous match operation failed
     */
public int start() {
    if (first < 0) throw new IllegalStateException('No match available');
    return first;
}

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

java.util.regex.Matcher.start(int)

/**
     * Returns the start index of the subsequence captured by the given group
     * during the previous match operation.
     *  <a href='Pattern.html#cg'>Capturing groups</a> are indexed from left
     * to right, starting at one.  Group zero denotes the entire pattern, so
     * the expression <i>m.</i><tt>start(0)</tt> is equivalent to
     * <i>m.</i><tt>start()</tt>.  
     * @param  group
     *         The index of a capturing group in this matcher's pattern
     * @return  The index of the first character captured by the group,
     *          or <tt>-1</tt> if the match was successful but the group
     *          itself did not match anything
     * @throws  IllegalStateException
     *          If no match has yet been attempted,
     *          or if the previous match operation failed
     * @throws  IndexOutOfBoundsException
     *          If there is no capturing group in the pattern
     *          with the given index
     */
public int start(int group) {
    if (first < 0) throw new IllegalStateException('No match available');
    if (group > groupCount()) throw new IndexOutOfBoundsException('No group ' + group);
    return groups[group * 2];
}

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

java.util.regex.Matcher.group(int)

/**
     * Returns the input subsequence captured by the given group during the
     * previous match operation.
     *  For a matcher <i>m</i>, input sequence <i>s</i>, and group index
     * <i>g</i>, the expressions <i>m.</i><tt>group(</tt><i>g</i><tt>)</tt> and
     * <i>s.</i><tt>substring(</tt><i>m.</i><tt>start(</tt><i>g</i><tt>),</tt> <i>m.</i><tt>end(</tt><i>g</i><tt>))</tt>
     * are equivalent.  
     *  <a href='Pattern.html#cg'>Capturing groups</a> are indexed from left
     * to right, starting at one.  Group zero denotes the entire pattern, so
     * the expression <tt>m.group(0)</tt> is equivalent to <tt>m.group()</tt>.
     *
     *  If the match was successful but the group specified failed to match
     * any part of the input sequence, then <tt>null</tt> is returned. Note
     * that some groups, for example <tt>(a*)</tt>, match the empty string.
     * This method will return the empty string when such a group successfully
     * matches the empty string in the input.  
     * @param  group
     *         The index of a capturing group in this matcher's pattern
     * @return  The (possibly empty) subsequence captured by the group
     *          during the previous match, or <tt>null</tt> if the group
     *          failed to match part of the input
     * @throws  IllegalStateException
     *          If no match has yet been attempted,
     *          or if the previous match operation failed
     * @throws  IndexOutOfBoundsException
     *          If there is no capturing group in the pattern
     *          with the given index
     */
public String group(int group) {
    if (first < 0) throw new IllegalStateException('No match found');
    if (group < 0 || group > groupCount()) throw new IndexOutOfBoundsException('No group ' + group);
    if ((groups[group * 2] == -1) || (groups[group * 2 + 1] == -1)) return null;
    return getSubSequence(groups[group * 2], groups[group * 2 + 1]).toString();
}

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

java.util.Scanner.match()

/**
     * Returns the match result of the last scanning operation performed
     * by this scanner. This method throws <code>IllegalStateException</code>
     * if no match has been performed, or if the last match was
     * not successful.
     * The various <code>next</code>methods of <code>Scanner</code>
     * make a match result available if they complete without throwing an
     * exception. For instance, after an invocation of the {@link #nextInt}
     * method that returned an int, this method returns a 
     * <code>MatchResult</code> for the search of the
     * <a href='#Integer-regex'><i>Integer</i></a> regular expression
     * defined above. Similarly the {@link #findInLine}, 
     * {@link #findWithinHorizon}, and {@link #skip} methods will make a
     * match available if they succeed.
     * @return a match result for the last match operation
     * @throws IllegalStateException  If no match result is available
     */
public MatchResult match() {
    if (!matchValid) throw new IllegalStateException('No match result available');
    return matcher.toMatchResult();
}

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

java.util.prefs.AbstractPreferences.removeNode2()

private void removeNode2() throws BackingStoreException {
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node already removed.');
        String[] kidNames = childrenNamesSpi();
        for (int i = 0; i < kidNames.length; i++) if (!kidCache.containsKey(kidNames[i])) kidCache.put(kidNames[i], childSpi(kidNames[i]));
        for (Iterator i = kidCache.values().iterator(); i.hasNext(); ) ((AbstractPreferences) i.next()).removeNode2();
        kidCache.clear();
        removeNodeSpi();
        removed = true;
        parent.enqueueNodeRemovedEvent(this);
    }
}

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

java.util.prefs.AbstractPreferences.sync2()

private void sync2() throws BackingStoreException {
    AbstractPreferences[] cachedKids;
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed');
        syncSpi();
        cachedKids = cachedChildren();
    }
    for (int i = 0; i < cachedKids.length; i++) cachedKids[i].sync2();
}

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

java.util.prefs.WindowsPreferences.sync()

/**
     * Implements <tt>Preferences</tt> <tt>sync()</tt> method.
     * Flushes Windows registry changes to disk. Equivalent to flush().
     * @see flush()
     */
public void sync() throws BackingStoreException {
    if (isRemoved()) throw new IllegalStateException('Node has been removed');
    flush();
}

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

java.util.prefs.XmlSupport.export(OutputStream, Preferences, boolean)

/**
     * Export the specified preferences node and, if subTree is true, all
     * subnodes, to the specified output stream.  Preferences are exported as
     * an XML document conforming to the definition in the Preferences spec.
     * @throws IOException if writing to the specified output stream
     *         results in an <tt>IOException</tt>.
     * @throws BackingStoreException if preference data cannot be read from
     *         backing store.
     * @throws IllegalStateException if this node (or an ancestor) has been
     *         removed with the {@link #removeNode()} method.
     */
static void export(OutputStream os, final Preferences p, boolean subTree) throws IOException, BackingStoreException {
    if (((AbstractPreferences) p).isRemoved()) throw new IllegalStateException('Node has been removed');
    Document doc = createPrefsDoc('preferences');
    Element preferences = doc.getDocumentElement();
    preferences.setAttribute('EXTERNAL_XML_VERSION', EXTERNAL_XML_VERSION);
    Element xmlRoot = (Element) preferences.appendChild(doc.createElement('root'));
    xmlRoot.setAttribute('type', (p.isUserNode() ? 'user' : 'system'));
    List ancestors = new ArrayList();
    for (Preferences kid = p, dad = kid.parent(); dad != null; kid = dad, dad = kid.parent()) {
        ancestors.add(kid);
    }
    Element e = xmlRoot;
    for (int i = ancestors.size() - 1; i >= 0; i--) {
        e.appendChild(doc.createElement('map'));
        e = (Element) e.appendChild(doc.createElement('node'));
        e.setAttribute('name', ((Preferences) ancestors.get(i)).name());
    }
    putPreferencesInXml(e, doc, p, subTree);
    writeDoc(doc, os);
}

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

java.util.prefs.AbstractPreferences.addNodeChangeListener(NodeChangeListener)

public void addNodeChangeListener(NodeChangeListener ncl) {
    if (ncl == null) throw new NullPointerException('Change listener is null.');
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        if (nodeListeners == null) {
            nodeListeners = new NodeChangeListener[1];
            nodeListeners[0] = ncl;
        } else {
            NodeChangeListener[] old = nodeListeners;
            nodeListeners = new NodeChangeListener[old.length + 1];
            System.arraycopy(old, 0, nodeListeners, 0, old.length);
            nodeListeners[old.length] = ncl;
        }
    }
    startEventDispatchThreadIfNecessary();
}

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

java.util.prefs.AbstractPreferences.addPreferenceChangeListener(PreferenceChangeListener)

public void addPreferenceChangeListener(PreferenceChangeListener pcl) {
    if (pcl == null) throw new NullPointerException('Change listener is null.');
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        PreferenceChangeListener[] old = prefListeners;
        prefListeners = new PreferenceChangeListener[old.length + 1];
        System.arraycopy(old, 0, prefListeners, 0, old.length);
        prefListeners[old.length] = pcl;
    }
    startEventDispatchThreadIfNecessary();
}

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

java.util.prefs.AbstractPreferences.childrenNames()

/**
     * Implements the <tt>children</tt> method as per the specification in
     * {@link Preferences#childrenNames()}.
     * This implementation obtains this preference node's lock, checks that
     * the node has not been removed, constructs a <tt>TreeSet</tt> initialized
     * to the names of children already cached (the children in this node's
     * 'child-cache'), invokes {@link #childrenNamesSpi()}, and adds all of the
     * returned child-names into the set.  The elements of the tree set are
     * dumped into a <tt>String</tt> array using the <tt>toArray</tt> method,
     * and this array is returned.
     * @return the names of the children of this preference node.
     * @throws BackingStoreException if this operation cannot be completed
     *         due to a failure in the backing store, or inability to 
     *         communicate with it.
     * @throws IllegalStateException if this node (or an ancestor) has been
     *         removed with the {@link #removeNode()} method.
     * @see #cachedChildren()
     */
public String[] childrenNames() throws BackingStoreException {
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        Set s = new TreeSet(kidCache.keySet());
        String[] kids = childrenNamesSpi();
        for (int i = 0; i < kids.length; i++) s.add(kids[i]);
        return (String[]) s.toArray(EMPTY_STRING_ARRAY);
    }
}

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

java.util.prefs.AbstractPreferences.get(String, String)

/**
     * Implements the <tt>get</tt> method as per the specification in
     * {@link Preferences#get(String,String)}.
     * This implementation first checks to see if <tt>key</tt> is
     * <tt>null</tt> throwing a <tt>NullPointerException</tt> if this is
     * the case.  Then it obtains this preference node's lock,
     * checks that the node has not been removed, invokes {@link
     * #getSpi(String)}, and returns the result, unless the <tt>getSpi</tt>
     * invocation returns <tt>null</tt> or throws an exception, in which case
     * this invocation returns <tt>def</tt>.
     * @param key key whose associated value is to be returned.
     * @param def the value to be returned in the event that this
     *        preference node has no value associated with <tt>key</tt>.
     * @return the value associated with <tt>key</tt>, or <tt>def</tt>
     *         if no value is associated with <tt>key</tt>.
     * @throws IllegalStateException if this node (or an ancestor) has been
     *         removed with the {@link #removeNode()} method.
     * @throws NullPointerException if key is <tt>null</tt>.  (A 
     *         <tt>null</tt> default <i>is</i> permitted.)
     */
public String get(String key, String def) {
    if (key == null) throw new NullPointerException('Null key');
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        String result = null;
        try {
            result = getSpi(key);
        } catch (Exception e) {
        }
        return (result == null ? def : result);
    }
}

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

java.util.prefs.AbstractPreferences.keys()

/**
     * Implements the <tt>keys</tt> method as per the specification in
     * {@link Preferences#keys()}.
     * This implementation obtains this preference node's lock, checks that
     * the node has not been removed and invokes {@link #keysSpi()}.
     * @return an array of the keys that have an associated value in this
     *         preference node.
     * @throws BackingStoreException if this operation cannot be completed
     *         due to a failure in the backing store, or inability to 
     *         communicate with it.
     * @throws IllegalStateException if this node (or an ancestor) has been
     *         removed with the {@link #removeNode()} method.
     */
public String[] keys() throws BackingStoreException {
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        return keysSpi();
    }
}

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

java.util.prefs.AbstractPreferences.node(String)

/**
     * Implements the <tt>node</tt> method as per the specification in
     * {@link Preferences#node(String)}.
     * This implementation obtains this preference node's lock and checks
     * that the node has not been removed.  If <tt>path</tt> is <tt>''</tt>,
     * this node is returned; if <tt>path</tt> is <tt>'/'</tt>, this node's
     * root is returned.  If the first character in <tt>path</tt> is 
     * not <tt>'/'</tt>, the implementation breaks <tt>path</tt> into
     * tokens and recursively traverses the path from this node to the
     * named node, 'consuming' a name and a slash from <tt>path</tt> at
     * each step of the traversal.  At each step, the current node is locked
     * and the node's child-cache is checked for the named node.  If it is
     * not found, the name is checked to make sure its length does not
     * exceed <tt>MAX_NAME_LENGTH</tt>.  Then the {@link #childSpi(String)}
     * method is invoked, and the result stored in this node's child-cache.
     * If the newly created <tt>Preferences</tt> object's {@link #newNode}
     * field is <tt>true</tt> and there are any node change listeners,
     * a notification event is enqueued for processing by the event dispatch
     * thread. 
     * When there are no more tokens, the last value found in the
     * child-cache or returned by <tt>childSpi</tt> is returned by this
     * method.  If during the traversal, two <tt>'/'</tt> tokens occur
     * consecutively, or the final token is <tt>'/'</tt> (rather than a name),
     * an appropriate <tt>IllegalArgumentException</tt> is thrown.
     *  If the first character of <tt>path</tt> is <tt>'/'</tt>
     * (indicating an absolute path name name) this preference node's
     * lock is dropped prior to breaking <tt>path</tt> into tokens, and 
     * this method recursively traverses the path starting from the root
     * (rather than starting from this node).  The traversal is otherwise
     * identical to the one described for relative path names.  Dropping
     * the lock on this node prior to commencing the traversal at the root
     * node is essential to avoid the possibility of deadlock, as per the
     * {@link #lock locking invariant}.
     * @param path the path name of the preference node to return.
     * @return the specified preference node.
     * @throws IllegalArgumentException if the path name is invalid (i.e.,
     *         it contains multiple consecutive slash characters, or ends
     *         with a slash character and is more than one character long).
     * @throws IllegalStateException if this node (or an ancestor) has been
     *         removed with the {@link #removeNode()} method.
     */
public Preferences node(String path) {
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        if (path.equals('')) return this;
        if (path.equals('/')) return root;
        if (path.charAt(0) != '/') return node(new StringTokenizer(path, '/', true));
    }
    return root.node(new StringTokenizer(path.substring(1), '/', true));
}

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

java.util.prefs.AbstractPreferences.nodeExists(String)

/**
     * Implements the <tt>nodeExists</tt> method as per the specification in
     * {@link Preferences#nodeExists(String)}.
     * This implementation is very similar to {@link #node(String)},
     * except that {@link #getChild(String)} is used instead of {@link
     * #childSpi(String)}.
     * @param path the path name of the node whose existence is to be checked.
     * @return true if the specified node exists.
     * @throws BackingStoreException if this operation cannot be completed
     *         due to a failure in the backing store, or inability to 
     *         communicate with it.
     * @throws IllegalArgumentException if the path name is invalid (i.e.,
     *         it contains multiple consecutive slash characters, or ends
     *         with a slash character and is more than one character long).
     * @throws IllegalStateException if this node (or an ancestor) has been
     *         removed with the {@link #removeNode()} method and
     *         <tt>pathname</tt> is not the empty string (<tt>''</tt>).
     */
public boolean nodeExists(String path) throws BackingStoreException {
    synchronized (lock) {
        if (path.equals('')) return !removed;
        if (removed) throw new IllegalStateException('Node has been removed.');
        if (path.equals('/')) return true;
        if (path.charAt(0) != '/') return nodeExists(new StringTokenizer(path, '/', true));
    }
    return root.nodeExists(new StringTokenizer(path.substring(1), '/', true));
}

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

java.util.prefs.AbstractPreferences.parent()

/**
     * Implements the <tt>parent</tt> method as per the specification in
     * {@link Preferences#parent()}.
     * This implementation obtains this preference node's lock, checks that
     * the node has not been removed and returns the parent value that was
     * passed to this node's constructor.
     * @return the parent of this preference node.
     * @throws IllegalStateException if this node (or an ancestor) has been
     *         removed with the {@link #removeNode()} method.
     */
public Preferences parent() {
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        return parent;
    }
}

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

java.util.prefs.AbstractPreferences.put(String, String)

/**
     * Implements the <tt>put</tt> method as per the specification in
     * {@link Preferences#put(String,String)}.
     * This implementation checks that the key and value are legal,
     * obtains this preference node's lock, checks that the node
     * has not been removed, invokes {@link #putSpi(String,String)}, and if
     * there are any preference change listeners, enqueues a notification
     * event for processing by the event dispatch thread.
     * @param key key with which the specified value is to be associated.
     * @param value value to be associated with the specified key.
     * @throws NullPointerException if key or value is <tt>null</tt>.
     * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
     *       <tt>MAX_KEY_LENGTH</tt> or if <tt>value.length</tt> exceeds
     *       <tt>MAX_VALUE_LENGTH</tt>.
     * @throws IllegalStateException if this node (or an ancestor) has been
     *         removed with the {@link #removeNode()} method.
     */
public void put(String key, String value) {
    if (key == null || value == null) throw new NullPointerException();
    if (key.length() > MAX_KEY_LENGTH) throw new IllegalArgumentException('Key too long: ' + key);
    if (value.length() > MAX_VALUE_LENGTH) throw new IllegalArgumentException('Value too long: ' + value);
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        putSpi(key, value);
        enqueuePreferenceChangeEvent(key, value);
    }
}

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

java.util.prefs.AbstractPreferences.remove(String)

/**
     * Implements the <tt>remove(String)</tt> method as per the specification
     * in {@link Preferences#remove(String)}.
     * This implementation obtains this preference node's lock,
     * checks that the node has not been removed, invokes
     * {@link #removeSpi(String)} and if there are any preference
     * change listeners, enqueues a notification event for processing by the
     * event dispatch thread.
     * @param key key whose mapping is to be removed from the preference node.
     * @throws IllegalStateException if this node (or an ancestor) has been
     *         removed with the {@link #removeNode()} method.
     */
public void remove(String key) {
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        removeSpi(key);
        enqueuePreferenceChangeEvent(key, null);
    }
}

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

java.util.prefs.AbstractPreferences.removeNodeChangeListener(NodeChangeListener)

public void removeNodeChangeListener(NodeChangeListener ncl) {
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        if ((nodeListeners == null) || (nodeListeners.length == 0)) throw new IllegalArgumentException('Listener not registered.');
        NodeChangeListener[] newNl = new NodeChangeListener[nodeListeners.length - 1];
        int i = 0;
        while (i < nodeListeners.length && nodeListeners[i] != ncl) newNl[i] = nodeListeners[i++];
        if (i == nodeListeners.length) throw new IllegalArgumentException('Listener not registered.');
        while (i < newNl.length) newNl[i] = nodeListeners[++i];
        nodeListeners = newNl;
    }
}

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

java.util.prefs.AbstractPreferences.removePreferenceChangeListener(PreferenceChangeListener)

public void removePreferenceChangeListener(PreferenceChangeListener pcl) {
    synchronized (lock) {
        if (removed) throw new IllegalStateException('Node has been removed.');
        if ((prefListeners == null) || (prefListeners.length == 0)) throw new IllegalArgumentException('Listener not registered.');
        PreferenceChangeListener[] newPl = new PreferenceChangeListener[prefListeners.length - 1];
        int i = 0;
        while (i < newPl.length && prefListeners[i] != pcl) newPl[i] = prefListeners[i++];
        if (i == newPl.length && prefListeners[i] != pcl) throw new IllegalArgumentException('Listener not registered.');
        while (i < newPl.length) newPl[i] = prefListeners[++i];
        prefListeners = newPl;
    }
}

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

javax.management.remote.rmi.RMIServerImpl.doNewClient(Object)

/**
     * This method could be overridden by subclasses defined in this package
     * to perform additional operations specific to the underlying transport
     * before creating the new client connection.
     */
RMIConnection doNewClient(Object credentials) throws IOException {
    final boolean tracing = logger.traceOn();
    if (tracing) logger.trace('newClient', 'making new client');
    if (getMBeanServer() == null) throw new IllegalStateException('Not attached to an MBean server');
    Subject subject = null;
    JMXAuthenticator authenticator = (JMXAuthenticator) env.get(JMXConnectorServer.AUTHENTICATOR);
    if (authenticator == null) {
        if (env.get('jmx.remote.x.password.file') != null || env.get('jmx.remote.x.login.config') != null) {
            authenticator = new JMXPluggableAuthenticator(env);
        }
    }
    if (authenticator != null) {
        if (tracing) logger.trace('newClient', 'got authenticator: ' + authenticator.getClass().getName());
        try {
            subject = authenticator.authenticate(credentials);
        } catch (SecurityException e) {
            logger.trace('newClient', 'Authentication failed: ' + e);
            throw e;
        }
    }
    if (tracing) {
        if (subject != null) logger.trace('newClient', 'subject is not null'); else logger.trace('newClient', 'no subject');
    }
    final String connectionId = makeConnectionId(getProtocol(), subject);
    if (tracing) logger.trace('newClient', 'making new connection: ' + connectionId);
    RMIConnection client = makeClient(connectionId, subject);
    connServer.connectionOpened(connectionId, 'Connection opened', null);
    dropDeadReferences();
    WeakReference wr = new WeakReference(client);
    synchronized (clientList) {
        clientList.add(wr);
    }
    if (tracing) logger.trace('newClient', 'new connection done: ' + connectionId);
    return client;
}

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

javax.naming.spi.NamingManager.setObjectFactoryBuilder(ObjectFactoryBuilder)

/**
     * The ObjectFactoryBuilder determines the policy used when
     * trying to load object factories.
     * See getObjectInstance() and class ObjectFactory for a description
     * of the default policy.
     * setObjectFactoryBuilder() overrides this default policy by installing
     * an ObjectFactoryBuilder. Subsequent object factories will
     * be loaded and created using the installed builder.
     * The builder can only be installed if the executing thread is allowed
     * (by the security manager's checkSetFactory() method) to do so.
     * Once installed, the builder cannot be replaced.
     * @param builder The factory builder to install. If null, no builder
     *   is installed.
     * @exception SecurityException builder cannot be installed
     *  for security reasons.
     * @exception NamingException builder cannot be installed for
     *         a non-security-related reason.
     * @exception IllegalStateException If a factory has already been installed.
     * @see #getObjectInstance
     * @see ObjectFactory
     * @see ObjectFactoryBuilder
     * @see java.lang.SecurityManager#checkSetFactory
     */
public static synchronized void setObjectFactoryBuilder(ObjectFactoryBuilder builder) throws NamingException {
    if (object_factory_builder != null) throw new IllegalStateException('ObjectFactoryBuilder already set');
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkSetFactory();
    }
    object_factory_builder = builder;
}

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.jpeg.JPEGImageWriter.prepareWriteSequence(IIOMetadata)

public void prepareWriteSequence(IIOMetadata streamMetadata) throws IOException {
    if (ios == null) {
        throw new IllegalStateException('Output has not been set!');
    }
    if (streamMetadata != null) {
        if (streamMetadata instanceof JPEGMetadata) {
            JPEGMetadata jmeta = (JPEGMetadata) streamMetadata;
            if (jmeta.isStream == false) {
                throw new IllegalArgumentException('Invalid stream metadata object.');
            }
            if (currentImage != 0) {
                throw new IIOException('JPEG Stream metadata must precede all images');
            }
            if (sequencePrepared == true) {
                throw new IIOException('Stream metadata already written!');
            }
            streamQTables = collectQTablesFromMetadata(jmeta);
            if (debug) {
                System.out.println('after collecting from stream metadata, ' + 'streamQTables.length is ' + streamQTables.length);
            }
            if (streamQTables == null) {
                streamQTables = JPEG.getDefaultQTables();
            }
            streamDCHuffmanTables = collectHTablesFromMetadata(jmeta, true);
            if (streamDCHuffmanTables == null) {
                streamDCHuffmanTables = JPEG.getDefaultHuffmanTables(true);
            }
            streamACHuffmanTables = collectHTablesFromMetadata(jmeta, false);
            if (streamACHuffmanTables == null) {
                streamACHuffmanTables = JPEG.getDefaultHuffmanTables(false);
            }
            writeTables(structPointer, streamQTables, streamDCHuffmanTables, streamACHuffmanTables);
        } else {
            throw new IIOException('Stream metadata must be JPEG metadata');
        }
    }
    sequencePrepared = 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.jpeg.JPEGImageWriter.write(IIOMetadata, IIOImage, ImageWriteParam)

public void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IOException {
    if (ios == null) {
        throw new IllegalStateException('Output has not been set!');
    }
    if (image == null) {
        throw new IllegalArgumentException('image is null!');
    }
    if (streamMetadata != null) {
        warningOccurred(WARNING_STREAM_METADATA_IGNORED);
    }
    boolean rasterOnly = image.hasRaster();
    RenderedImage rimage = null;
    if (rasterOnly) {
        srcRas = image.getRaster();
    } else {
        rimage = image.getRenderedImage();
        if (rimage instanceof BufferedImage) {
            srcRas = ((BufferedImage) rimage).getRaster();
        } else {
            srcRas = rimage.getData();
        }
    }
    int numSrcBands = srcRas.getNumBands();
    indexed = false;
    indexCM = null;
    ColorModel cm = null;
    ColorSpace cs = null;
    isAlphaPremultiplied = false;
    srcCM = null;
    if (!rasterOnly) {
        cm = rimage.getColorModel();
        if (cm != null) {
            cs = cm.getColorSpace();
            if (cm instanceof IndexColorModel) {
                indexed = true;
                indexCM = (IndexColorModel) cm;
                numSrcBands = cm.getNumComponents();
            }
            if (cm.isAlphaPremultiplied()) {
                isAlphaPremultiplied = true;
                srcCM = cm;
            }
        }
    }
    srcBands = JPEG.bandOffsets[numSrcBands - 1];
    int numBandsUsed = numSrcBands;
    if (param != null) {
        int[] sBands = param.getSourceBands();
        if (sBands != null) {
            if (indexed) {
                warningOccurred(WARNING_NO_BANDS_ON_INDEXED);
            } else {
                srcBands = sBands;
                numBandsUsed = srcBands.length;
                if (numBandsUsed > numSrcBands) {
                    throw new IIOException('ImageWriteParam specifies too many source bands');
                }
            }
        }
    }
    boolean usingBandSubset = (numBandsUsed != numSrcBands);
    boolean fullImage = ((!rasterOnly) && (!usingBandSubset));
    int[] bandSizes = null;
    if (!indexed) {
        bandSizes = srcRas.getSampleModel().getSampleSize();
        if (usingBandSubset) {
            int[] temp = new int[numBandsUsed];
            for (int i = 0; i < numBandsUsed; i++) {
                temp[i] = bandSizes[srcBands[i]];
            }
            bandSizes = temp;
        }
    } else {
        int[] tempSize = srcRas.getSampleModel().getSampleSize();
        bandSizes = new int[numSrcBands];
        for (int i = 0; i < numSrcBands; i++) {
            bandSizes[i] = tempSize[0];
        }
    }
    for (int i = 0; i < bandSizes.length; i++) {
        if (bandSizes[i] > 8) {
            throw new IIOException('Sample size must be <= 8');
        }
        if (indexed) {
            bandSizes[i] = 8;
        }
    }
    if (debug) {
        System.out.println('numSrcBands is ' + numSrcBands);
        System.out.println('numBandsUsed is ' + numBandsUsed);
        System.out.println('usingBandSubset is ' + usingBandSubset);
        System.out.println('fullImage is ' + fullImage);
        System.out.print('Band sizes:');
        for (int i = 0; i < bandSizes.length; i++) {
            System.out.print(' ' + bandSizes[i]);
        }
        System.out.println();
    }
    ImageTypeSpecifier destType = null;
    if (param != null) {
        destType = param.getDestinationType();
        if ((fullImage) && (destType != null)) {
            warningOccurred(WARNING_DEST_IGNORED);
            destType = null;
        }
    }
    sourceXOffset = srcRas.getMinX();
    sourceYOffset = srcRas.getMinY();
    int imageWidth = srcRas.getWidth();
    int imageHeight = srcRas.getHeight();
    sourceWidth = imageWidth;
    sourceHeight = imageHeight;
    int periodX = 1;
    int periodY = 1;
    int gridX = 0;
    int gridY = 0;
    JPEGQTable[] qTables = null;
    JPEGHuffmanTable[] DCHuffmanTables = null;
    JPEGHuffmanTable[] ACHuffmanTables = null;
    boolean optimizeHuffman = false;
    JPEGImageWriteParam jparam = null;
    int progressiveMode = ImageWriteParam.MODE_DISABLED;
    if (param != null) {
        Rectangle sourceRegion = param.getSourceRegion();
        if (sourceRegion != null) {
            Rectangle imageBounds = new Rectangle(sourceXOffset, sourceYOffset, sourceWidth, sourceHeight);
            sourceRegion = sourceRegion.intersection(imageBounds);
            sourceXOffset = sourceRegion.x;
            sourceYOffset = sourceRegion.y;
            sourceWidth = sourceRegion.width;
            sourceHeight = sourceRegion.height;
        }
        if (sourceWidth + sourceXOffset > imageWidth) {
            sourceWidth = imageWidth - sourceXOffset;
        }
        if (sourceHeight + sourceYOffset > imageHeight) {
            sourceHeight = imageHeight - sourceYOffset;
        }
        periodX = param.getSourceXSubsampling();
        periodY = param.getSourceYSubsampling();
        gridX = param.getSubsamplingXOffset();
        gridY = param.getSubsamplingYOffset();
        switch(param.getCompressionMode()) {
            case ImageWriteParam.MODE_DISABLED:
                throw new IIOException('JPEG compression cannot be disabled');
            case ImageWriteParam.MODE_EXPLICIT:
                float quality = param.getCompressionQuality();
                quality = JPEG.convertToLinearQuality(quality);
                qTables = new JPEGQTable[2];
                qTables[0] = JPEGQTable.K1Luminance.getScaledInstance(quality, true);
                qTables[1] = JPEGQTable.K2Chrominance.getScaledInstance(quality, true);
                break;
            case ImageWriteParam.MODE_DEFAULT:
                qTables = new JPEGQTable[2];
                qTables[0] = JPEGQTable.K1Div2Luminance;
                qTables[1] = JPEGQTable.K2Div2Chrominance;
                break;
        }
        progressiveMode = param.getProgressiveMode();
        if (param instanceof JPEGImageWriteParam) {
            jparam = (JPEGImageWriteParam) param;
            optimizeHuffman = jparam.getOptimizeHuffmanTables();
        }
    }
    IIOMetadata mdata = image.getMetadata();
    if (mdata != null) {
        if (mdata instanceof JPEGMetadata) {
            metadata = (JPEGMetadata) mdata;
            if (debug) {
                System.out.println('We have metadata, and it's JPEG metadata');
            }
        } else {
            if (!rasterOnly) {
                ImageTypeSpecifier type = destType;
                if (type == null) {
                    type = new ImageTypeSpecifier(rimage);
                }
                metadata = (JPEGMetadata) convertImageMetadata(mdata, type, param);
            } else {
                warningOccurred(WARNING_METADATA_NOT_JPEG_FOR_RASTER);
            }
        }
    }
    ignoreJFIF = false;
    ignoreAdobe = false;
    newAdobeTransform = JPEG.ADOBE_IMPOSSIBLE;
    writeDefaultJFIF = false;
    writeAdobe = false;
    int inCsType = JPEG.JCS_UNKNOWN;
    int outCsType = JPEG.JCS_UNKNOWN;
    JFIFMarkerSegment jfif = null;
    AdobeMarkerSegment adobe = null;
    SOFMarkerSegment sof = null;
    if (metadata != null) {
        jfif = (JFIFMarkerSegment) metadata.findMarkerSegment(JFIFMarkerSegment.class, true);
        adobe = (AdobeMarkerSegment) metadata.findMarkerSegment(AdobeMarkerSegment.class, true);
        sof = (SOFMarkerSegment) metadata.findMarkerSegment(SOFMarkerSegment.class, true);
    }
    iccProfile = null;
    convertTosRGB = false;
    converted = null;
    if (destType != null) {
        if (numBandsUsed != destType.getNumBands()) {
            throw new IIOException('Number of source bands != number of destination bands');
        }
        cs = destType.getColorModel().getColorSpace();
        if (metadata != null) {
            checkSOFBands(sof, numBandsUsed);
            checkJFIF(jfif, destType, false);
            if ((jfif != null) && (ignoreJFIF == false)) {
                if (JPEG.isNonStandardICC(cs)) {
                    iccProfile = ((ICC_ColorSpace) cs).getProfile();
                }
            }
            checkAdobe(adobe, destType, false);
        } else {
            if (JPEG.isJFIFcompliant(destType, false)) {
                writeDefaultJFIF = true;
                if (JPEG.isNonStandardICC(cs)) {
                    iccProfile = ((ICC_ColorSpace) cs).getProfile();
                }
            } else {
                int transform = JPEG.transformForType(destType, false);
                if (transform != JPEG.ADOBE_IMPOSSIBLE) {
                    writeAdobe = true;
                    newAdobeTransform = transform;
                }
            }
        }
    } else {
        if (metadata == null) {
            if (fullImage) {
                metadata = new JPEGMetadata(new ImageTypeSpecifier(rimage), param, this);
                if (metadata.findMarkerSegment(JFIFMarkerSegment.class, true) != null) {
                    cs = rimage.getColorModel().getColorSpace();
                    if (JPEG.isNonStandardICC(cs)) {
                        iccProfile = ((ICC_ColorSpace) cs).getProfile();
                    }
                }
                inCsType = getSrcCSType(rimage);
                outCsType = getDefaultDestCSType(rimage);
            }
        } else {
            checkSOFBands(sof, numBandsUsed);
            if (fullImage) {
                ImageTypeSpecifier inputType = new ImageTypeSpecifier(rimage);
                inCsType = getSrcCSType(rimage);
                if (cm != null) {
                    boolean alpha = cm.hasAlpha();
                    switch(cs.getType()) {
                        case ColorSpace.TYPE_GRAY:
                            if (!alpha) {
                                outCsType = JPEG.JCS_GRAYSCALE;
                            } else {
                                if (jfif != null) {
                                    ignoreJFIF = true;
                                    warningOccurred(WARNING_IMAGE_METADATA_JFIF_MISMATCH);
                                }
                            }
                            if ((adobe != null) && (adobe.transform != JPEG.ADOBE_UNKNOWN)) {
                                newAdobeTransform = JPEG.ADOBE_UNKNOWN;
                                warningOccurred(WARNING_IMAGE_METADATA_ADOBE_MISMATCH);
                            }
                            break;
                        case ColorSpace.TYPE_RGB:
                            if (!alpha) {
                                if (jfif != null) {
                                    outCsType = JPEG.JCS_YCbCr;
                                    if (JPEG.isNonStandardICC(cs) || ((cs instanceof ICC_ColorSpace) && (jfif.iccSegment != null))) {
                                        iccProfile = ((ICC_ColorSpace) cs).getProfile();
                                    }
                                } else if (adobe != null) {
                                    switch(adobe.transform) {
                                        case JPEG.ADOBE_UNKNOWN:
                                            outCsType = JPEG.JCS_RGB;
                                            break;
                                        case JPEG.ADOBE_YCC:
                                            outCsType = JPEG.JCS_YCbCr;
                                            break;
                                        default:
                                            warningOccurred(WARNING_IMAGE_METADATA_ADOBE_MISMATCH);
                                            newAdobeTransform = JPEG.ADOBE_UNKNOWN;
                                            outCsType = JPEG.JCS_RGB;
                                            break;
                                    }
                                } else {
                                    int outCS = sof.getIDencodedCSType();
                                    if (outCS != JPEG.JCS_UNKNOWN) {
                                        outCsType = outCS;
                                    } else {
                                        boolean subsampled = isSubsampled(sof.componentSpecs);
                                        if (subsampled) {
                                            outCsType = JPEG.JCS_YCbCr;
                                        } else {
                                            outCsType = JPEG.JCS_RGB;
                                        }
                                    }
                                }
                            } else {
                                if (jfif != null) {
                                    ignoreJFIF = true;
                                    warningOccurred(WARNING_IMAGE_METADATA_JFIF_MISMATCH);
                                }
                                if (adobe != null) {
                                    if (adobe.transform != JPEG.ADOBE_UNKNOWN) {
                                        newAdobeTransform = JPEG.ADOBE_UNKNOWN;
                                        warningOccurred(WARNING_IMAGE_METADATA_ADOBE_MISMATCH);
                                    }
                                    outCsType = JPEG.JCS_RGBA;
                                } else {
                                    int outCS = sof.getIDencodedCSType();
                                    if (outCS != JPEG.JCS_UNKNOWN) {
                                        outCsType = outCS;
                                    } else {
                                        boolean subsampled = isSubsampled(sof.componentSpecs);
                                        outCsType = subsampled ? JPEG.JCS_YCbCrA : JPEG.JCS_RGBA;
                                    }
                                }
                            }
                            break;
                        case ColorSpace.TYPE_3CLR:
                            if (cs == JPEG.YCC) {
                                if (!alpha) {
                                    if (jfif != null) {
                                        convertTosRGB = true;
                                        convertOp = new ColorConvertOp(cs, JPEG.sRGB, null);
                                        outCsType = JPEG.JCS_YCbCr;
                                    } else if (adobe != null) {
                                        if (adobe.transform != JPEG.ADOBE_YCC) {
                                            newAdobeTransform = JPEG.ADOBE_YCC;
                                            warningOccurred(WARNING_IMAGE_METADATA_ADOBE_MISMATCH);
                                        }
                                        outCsType = JPEG.JCS_YCC;
                                    } else {
                                        outCsType = JPEG.JCS_YCC;
                                    }
                                } else {
                                    if (jfif != null) {
                                        ignoreJFIF = true;
                                        warningOccurred(WARNING_IMAGE_METADATA_JFIF_MISMATCH);
                                    } else if (adobe != null) {
                                        if (adobe.transform != JPEG.ADOBE_UNKNOWN) {
                                            newAdobeTransform = JPEG.ADOBE_UNKNOWN;
                                            warningOccurred(WARNING_IMAGE_METADATA_ADOBE_MISMATCH);
                                        }
                                    }
                                    outCsType = JPEG.JCS_YCCA;
                                }
                            }
                    }
                }
            }
        }
    }
    boolean metadataProgressive = false;
    int[] scans = null;
    if (metadata != null) {
        if (sof == null) {
            sof = (SOFMarkerSegment) metadata.findMarkerSegment(SOFMarkerSegment.class, true);
        }
        if ((sof != null) && (sof.tag == JPEG.SOF2)) {
            metadataProgressive = true;
            if (progressiveMode == ImageWriteParam.MODE_COPY_FROM_METADATA) {
                scans = collectScans(metadata, sof);
            } else {
                numScans = 0;
            }
        }
        if (jfif == null) {
            jfif = (JFIFMarkerSegment) metadata.findMarkerSegment(JFIFMarkerSegment.class, true);
        }
    }
    thumbnails = image.getThumbnails();
    int numThumbs = image.getNumThumbnails();
    forceJFIF = false;
    if (!writeDefaultJFIF) {
        if (metadata == null) {
            thumbnails = null;
            if (numThumbs != 0) {
                warningOccurred(WARNING_IGNORING_THUMBS);
            }
        } else {
            if (fullImage == false) {
                if (jfif == null) {
                    thumbnails = null;
                    if (numThumbs != 0) {
                        warningOccurred(WARNING_IGNORING_THUMBS);
                    }
                }
            } else {
                if (jfif == null) {
                    if ((outCsType == JPEG.JCS_GRAYSCALE) || (outCsType == JPEG.JCS_YCbCr)) {
                        if (numThumbs != 0) {
                            forceJFIF = true;
                            warningOccurred(WARNING_FORCING_JFIF);
                        }
                    } else {
                        thumbnails = null;
                        if (numThumbs != 0) {
                            warningOccurred(WARNING_IGNORING_THUMBS);
                        }
                    }
                }
            }
        }
    }
    boolean haveMetadata = ((metadata != null) || writeDefaultJFIF || writeAdobe);
    boolean writeDQT = true;
    boolean writeDHT = true;
    DQTMarkerSegment dqt = null;
    DHTMarkerSegment dht = null;
    int restartInterval = 0;
    if (metadata != null) {
        dqt = (DQTMarkerSegment) metadata.findMarkerSegment(DQTMarkerSegment.class, true);
        dht = (DHTMarkerSegment) metadata.findMarkerSegment(DHTMarkerSegment.class, true);
        DRIMarkerSegment dri = (DRIMarkerSegment) metadata.findMarkerSegment(DRIMarkerSegment.class, true);
        if (dri != null) {
            restartInterval = dri.restartInterval;
        }
        if (dqt == null) {
            writeDQT = false;
        }
        if (dht == null) {
            writeDHT = false;
        }
    }
    if (qTables == null) {
        if (dqt != null) {
            qTables = collectQTablesFromMetadata(metadata);
        } else if (streamQTables != null) {
            qTables = streamQTables;
        } else if ((jparam != null) && (jparam.areTablesSet())) {
            qTables = jparam.getQTables();
        } else {
            qTables = JPEG.getDefaultQTables();
        }
    }
    if (optimizeHuffman == false) {
        if ((dht != null) && (metadataProgressive == false)) {
            DCHuffmanTables = collectHTablesFromMetadata(metadata, true);
            ACHuffmanTables = collectHTablesFromMetadata(metadata, false);
        } else if (streamDCHuffmanTables != null) {
            DCHuffmanTables = streamDCHuffmanTables;
            ACHuffmanTables = streamACHuffmanTables;
        } else if ((jparam != null) && (jparam.areTablesSet())) {
            DCHuffmanTables = jparam.getDCHuffmanTables();
            ACHuffmanTables = jparam.getACHuffmanTables();
        } else {
            DCHuffmanTables = JPEG.getDefaultHuffmanTables(true);
            ACHuffmanTables = JPEG.getDefaultHuffmanTables(false);
        }
    }
    int[] componentIds = new int[numBandsUsed];
    int[] HsamplingFactors = new int[numBandsUsed];
    int[] VsamplingFactors = new int[numBandsUsed];
    int[] QtableSelectors = new int[numBandsUsed];
    for (int i = 0; i < numBandsUsed; i++) {
        componentIds[i] = i + 1;
        HsamplingFactors[i] = 1;
        VsamplingFactors[i] = 1;
        QtableSelectors[i] = 0;
    }
    if (sof != null) {
        for (int i = 0; i < numBandsUsed; i++) {
            if (forceJFIF == false) {
                componentIds[i] = sof.componentSpecs[i].componentId;
            }
            HsamplingFactors[i] = sof.componentSpecs[i].HsamplingFactor;
            VsamplingFactors[i] = sof.componentSpecs[i].VsamplingFactor;
            QtableSelectors[i] = sof.componentSpecs[i].QtableSelector;
        }
    }
    sourceXOffset += gridX;
    sourceWidth -= gridX;
    sourceYOffset += gridY;
    sourceHeight -= gridY;
    int destWidth = (sourceWidth + periodX - 1) / periodX;
    int destHeight = (sourceHeight + periodY - 1) / periodY;
    int lineSize = sourceWidth * numBandsUsed;
    DataBufferByte buffer = new DataBufferByte(lineSize);
    int[] bandOffs = JPEG.bandOffsets[numBandsUsed - 1];
    raster = Raster.createInterleavedRaster(buffer, sourceWidth, 1, lineSize, numBandsUsed, bandOffs, null);
    processImageStarted(currentImage);
    boolean aborted = false;
    if (debug) {
        System.out.println('inCsType: ' + inCsType);
        System.out.println('outCsType: ' + outCsType);
    }
    aborted = writeImage(structPointer, buffer.getData(), inCsType, outCsType, numBandsUsed, bandSizes, sourceWidth, destWidth, destHeight, periodX, periodY, qTables, writeDQT, DCHuffmanTables, ACHuffmanTables, writeDHT, optimizeHuffman, (progressiveMode != ImageWriteParam.MODE_DISABLED), numScans, scans, componentIds, HsamplingFactors, VsamplingFactors, QtableSelectors, haveMetadata, restartInterval);
    if (aborted) {
        processWriteAborted();
    } else {
        processImageComplete();
    }
    ios.flush();
    currentImage++;
}

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

java.util.AbstractQueue.add(E)

/**
     * Adds the specified element to this queue. This implementation
     * returns <tt>true</tt> if <tt>offer</tt> succeeds, else
     * throws an IllegalStateException. 
     * @param o the element
     * @return <tt>true</tt> (as per the general contract of
     *         <tt>Collection.add</tt>).
     * @throws NullPointerException if the specified element is <tt>null</tt>
     * @throws IllegalStateException if element cannot be added
     */
public boolean add(E o) {
    if (offer(o)) return true; else throw new IllegalStateException('Queue full');
}

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

java.util.Scanner.ensureOpen()

private void ensureOpen() {
    if (closed) throw new IllegalStateException('Scanner closed');
}

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

java.util.Scanner.useTypeCache()

private void useTypeCache() {
    if (closed) throw new IllegalStateException('Scanner closed');
    position = hasNextPosition;
    hasNextPattern = null;
    typeCache = null;
}

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

java.lang.Shutdown.add(Thread)

static void add(Thread hook) {
    synchronized (lock) {
        if (state > RUNNING) throw new IllegalStateException('Shutdown in progress');
        if (hook.isAlive()) throw new IllegalArgumentException('Hook already running');
        if (hooks == null) {
            hooks = new HashSet(11);
            hooks.add(new WrappedHook(hook));
            Terminator.setup();
        } else {
            WrappedHook wh = new WrappedHook(hook);
            if (hooks.contains(wh)) throw new IllegalArgumentException('Hook previously registered');
            hooks.add(wh);
        }
    }
}

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

java.lang.Shutdown.remove(Thread)

static boolean remove(Thread hook) {
    synchronized (lock) {
        if (state > RUNNING) throw new IllegalStateException('Shutdown in progress');
        if (hook == null) throw new NullPointerException();
        if (hooks == null) {
            return false;
        } else {
            boolean rv = hooks.remove(new WrappedHook(hook));
            if (rv && hooks.isEmpty()) {
                hooks = null;
                Terminator.teardown();
            }
            return rv;
        }
    }
}

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

com.sun.jmx.snmp.daemon.SnmpAdaptorServer.snmpInformRequest(InetAddress, int, String, SnmpInformHandler, SnmpOid, SnmpVarBindList)

private SnmpInformRequest snmpInformRequest(InetAddress addr, int port, String cs, SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException {
    if (!isActive()) {
        throw new IllegalStateException('Start SNMP adaptor server before carrying out this operation');
    }
    if (isTraceOn()) {
        trace('snmpInformRequest', 'trapOid=' + trapOid);
    }
    SnmpVarBindList fullVbl;
    if (varBindList != null) fullVbl = (SnmpVarBindList) varBindList.clone(); else fullVbl = new SnmpVarBindList(2);
    SnmpTimeticks sysUpTimeValue = new SnmpTimeticks(getSysUpTime());
    fullVbl.insertElementAt(new SnmpVarBind(snmpTrapOidOid, trapOid), 0);
    fullVbl.insertElementAt(new SnmpVarBind(sysUpTimeOid, sysUpTimeValue), 0);
    openInformSocketIfNeeded();
    return informSession.makeAsyncRequest(addr, cs, cb, fullVbl, port);
}

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

com.sun.jmx.snmp.daemon.SnmpAdaptorServer.snmpInformRequest(SnmpInformHandler, SnmpOid, SnmpVarBindList)

/**
     * Sends an inform using SNMP V2 inform request format.
     * <BR>The inform request is sent to each destination defined in the ACL 
     * file (if available).
     * If no ACL file or no destinations are available, the inform request is 
     * sent to the local host.
     * <BR>The variable list included in the outgoing inform is composed of 
     * the following items:
     * <UL>
     * <LI><CODE>sysUpTime.0</CODE> with its current value</LI>
     * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by 
     *     <CODE>trapOid</CODE></LI>
     * <LI><CODE>all the (oid,values)</CODE> from the specified 
     *     <CODE>varBindList</CODE></LI>
     * </UL>
     * To send an inform request, the SNMP adaptor server must be active.
     * @param cb The callback that is invoked when a request is complete.
     * @param trapOid The OID identifying the trap.
     * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
     * @return A vector of {@link com.sun.jmx.snmp.daemon.SnmpInformRequest} 
     *         objects.
     *         <P>If there is no destination host for this inform request, 
     *         the returned vector will be empty.
     * @exception IllegalStateException  This method has been invoked while 
     *            the SNMP adaptor server was not active.
     * @exception IOException An I/O error occurred while sending the 
     *            inform request.
     * @exception SnmpStatusException If the inform request exceeds the 
     *            limit defined by <CODE>bufferSize</CODE>.
     */
public Vector snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException {
    if (!isActive()) {
        throw new IllegalStateException('Start SNMP adaptor server before carrying out this operation');
    }
    if (isTraceOn()) {
        trace('snmpInformRequest', 'trapOid=' + trapOid);
    }
    SnmpVarBindList fullVbl;
    if (varBindList != null) fullVbl = (SnmpVarBindList) varBindList.clone(); else fullVbl = new SnmpVarBindList(2);
    SnmpTimeticks sysUpTimeValue = new SnmpTimeticks(getSysUpTime());
    fullVbl.insertElementAt(new SnmpVarBind(snmpTrapOidOid, trapOid), 0);
    fullVbl.insertElementAt(new SnmpVarBind(sysUpTimeOid, sysUpTimeValue), 0);
    openInformSocketIfNeeded();
    Vector informReqList = new Vector();
    InetAddress addr = null;
    String cs = null;
    if (ipacl != null) {
        Enumeration ed = ((InetAddressAcl) ipacl).getInformDestinations();
        while (ed.hasMoreElements()) {
            addr = (InetAddress) ed.nextElement();
            Enumeration ec = ((InetAddressAcl) ipacl).getInformCommunities(addr);
            while (ec.hasMoreElements()) {
                cs = (String) ec.nextElement();
                informReqList.addElement(informSession.makeAsyncRequest(addr, cs, cb, fullVbl, getInformPort()));
            }
        }
    }
    return informReqList;
}

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

com.sun.jmx.snmp.daemon.CommunicatorServer.setMBeanServer(MBeanServer)

/**
     * Set the <code>MBeanServer</code> object to which incoming
     * requests are sent.  This must be either the MBean server in
     * which this connector is registered, or an
     * <code>MBeanServerForwarder</code> leading to that server.  An
     * <code>MBeanServerForwarder</code> <code>mbsf</code> leads to an
     * MBean server <code>mbs</code> if
     * <code>mbsf.getMBeanServer()</code> is either <code>mbs</code>
     * or an <code>MBeanServerForwarder</code> leading to
     * <code>mbs</code>.
     * @exception IllegalArgumentException if <code>newMBS</code> is neither
     * the MBean server in which this connector is registered nor an
     * <code>MBeanServerForwarder</code> leading to that server.
     * @exception IllegalStateException This method has been invoked
     * while the communicator was ONLINE or STARTING.
     */
public synchronized void setMBeanServer(MBeanServer newMBS) throws IllegalArgumentException, IllegalStateException {
    synchronized (stateLock) {
        if (state == ONLINE || state == STARTING) throw new IllegalStateException('Stop server before ' + 'carrying out this operation');
    }
    final String error = 'MBeanServer argument must be MBean server where this ' + 'server is registered, or an MBeanServerForwarder ' + 'leading to that server';
    Vector seenMBS = new Vector();
    for (MBeanServer mbs = newMBS; mbs != bottomMBS; mbs = ((MBeanServerForwarder) mbs).getMBeanServer()) {
        if (!(mbs instanceof MBeanServerForwarder)) throw new IllegalArgumentException(error);
        if (seenMBS.contains(mbs)) throw new IllegalArgumentException('MBeanServerForwarder ' + 'loop');
        seenMBS.addElement(mbs);
    }
    topMBS = newMBS;
}

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

com.sun.jmx.snmp.daemon.CommunicatorServer.setPort(int)

/**
     * Sets the port number used by this <CODE>CommunicatorServer</CODE>.
     * @param port The port number used by this 
     *             <CODE>CommunicatorServer</CODE>.
     * @exception java.lang.IllegalStateException This method has been invoked
     * while the communicator was ONLINE or STARTING.
     */
public void setPort(int port) throws java.lang.IllegalStateException {
    synchronized (stateLock) {
        if ((state == ONLINE) || (state == STARTING)) throw new IllegalStateException('Stop server before ' + 'carrying out this operation');
        this.port = port;
        dbgTag = makeDebugTag();
    }
}

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

com.sun.jmx.snmp.daemon.SnmpAdaptorServer.setBufferSize(Integer)

/**
     * Sets the buffer size of this SNMP protocol adaptor.
     * This buffer size is used for both incoming request and outgoing 
     * inform requests.
     * @param s The buffer size.
     * @exception java.lang.IllegalStateException This method has been invoked
     * while the communicator was <CODE>ONLINE</CODE> or <CODE>STARTING</CODE>.
     */
public void setBufferSize(Integer s) throws java.lang.IllegalStateException {
    if ((state == ONLINE) || (state == STARTING)) {
        throw new IllegalStateException('Stop server before carrying out' + ' this operation');
    }
    bufferSize = s.intValue();
}

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

com.sun.jmx.snmp.daemon.CommunicatorServer.setMaxActiveClientCount(int)

/**
     * Sets the maximum number of clients this 
     * <CODE>CommunicatorServer</CODE> can process concurrently.
     * @param c The number of clients.
     * @exception java.lang.IllegalStateException This method has been invoked
     * while the communicator was ONLINE or STARTING.
     */
void setMaxActiveClientCount(int c) throws java.lang.IllegalStateException {
    synchronized (stateLock) {
        if ((state == ONLINE) || (state == STARTING)) {
            throw new IllegalStateException('Stop server before carrying out this operation');
        }
        maxActiveClientCount = 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.wml.internal.dom.WMLDocumentImpl.createElement(String)

public Element createElement(String tagName) throws DOMException {
    Class elemClass;
    Constructor cnst;
    elemClass = (Class) _elementTypesWML.get(tagName);
    if (elemClass != null) {
        try {
            cnst = elemClass.getConstructor(_elemClassSigWML);
            return (Element) cnst.newInstance(new Object[] { this, tagName });
        } catch (Exception except) {
            Throwable thrw;
            if (except instanceof java.lang.reflect.InvocationTargetException) thrw = ((java.lang.reflect.InvocationTargetException) except).getTargetException(); else thrw = except;
            System.out.println('Exception ' + thrw.getClass().getName());
            System.out.println(thrw.getMessage());
            throw new IllegalStateException('Tag '' + tagName + '' associated with an Element class that failed to construct.');
        }
    }
    return new WMLElementImpl(this, tagName);
}

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

java.util.Timer.sched(TimerTask, long, long)

/**
     * Schedule the specified timer task for execution at the specified
     * time with the specified period, in milliseconds.  If period is
     * positive, the task is scheduled for repeated execution; if period is
     * zero, the task is scheduled for one-time execution. Time is specified
     * in Date.getTime() format.  This method checks timer state, task state,
     * and initial execution time, but not period.
     * @throws IllegalArgumentException if <tt>time()</tt> is negative.
     * @throws IllegalStateException if task was already scheduled or
     *         cancelled, timer was cancelled, or timer thread terminated.
     */
private void sched(TimerTask task, long time, long period) {
    if (time < 0) throw new IllegalArgumentException('Illegal execution time.');
    synchronized (queue) {
        if (!thread.newTasksMayBeScheduled) throw new IllegalStateException('Timer already cancelled.');
        synchronized (task.lock) {
            if (task.state != TimerTask.VIRGIN) throw new IllegalStateException('Task already scheduled or cancelled');
            task.nextExecutionTime = time;
            task.period = period;
            task.state = TimerTask.SCHEDULED;
        }
        queue.add(task);
        if (queue.getMin() == task) queue.notify();
    }
}

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.MonitoredAttributeBase.setValue(Object)

/**
     *  This method should be implemented by the concrete class only if the 
     *  attribute is writable. If the attribute is not writable and if this 
     *  method called, it will result in an IllegalStateException.
     */
public void setValue(Object value) {
    if (!attributeInfo.isWritable()) {
        throw new IllegalStateException('The Attribute ' + name + ' is not Writable...');
    }
    throw new IllegalStateException('The method implementation is not provided for the attribute ' + name);
}

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

com.sun.jmx.snmp.tasks.ThreadService.stateCheck()

private void stateCheck() throws IllegalStateException {
    if (terminated) {
        throw new IllegalStateException('The thread service has been terminated.');
    }
}

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

javax.management.loading.MLet.getMBeansFromURL(String)

/**
      * Loads a text file containing MLET tags that define the MBeans to
      * be added to the agent. The location of the text file is specified by
      * a URL. The MBeans specified in the MLET file will be instantiated and
      * registered by the MBean server.
      * @param url The URL of the text file to be loaded as String object.
      * @return  A set containing one entry per MLET tag in the m-let text file loaded.
      * Each entry specifies either the ObjectInstance for the created MBean, or a throwable object
      * (that is, an error or an exception) if the MBean could not be created.
      * @exception ServiceNotFoundException One of the following errors has occurred: The m-let text file does
      * not contain an MLET tag, the m-let text file is not found, a mandatory
      * attribute of the MLET tag is not specified, the url is malformed.
      * @exception IllegalStateException MLet MBean is not registered with an MBeanServer.
      */
public Set getMBeansFromURL(String url) throws ServiceNotFoundException {
    String mth = 'getMBeansFromURL';
    if (server == null) {
        throw new IllegalStateException('This MLet MBean is not registered with an MBeanServer.');
    }
    if (url == null) {
        if (isTraceOn()) {
            trace(mth, 'URL is null');
        }
        throw new ServiceNotFoundException('The specified URL is null');
    } else {
        url = url.replace(File.separatorChar, '/');
    }
    if (isTraceOn()) {
        trace(mth, '<URL = ' + url + '>');
    }
    try {
        MLetParser parser = new MLetParser();
        mletList = parser.parseURL(url);
    } catch (Exception e) {
        final String msg = 'Problems while parsing URL [' + url + '], got exception [' + e.toString() + ']';
        if (isTraceOn()) {
            trace(mth, msg);
        }
        ServiceNotFoundException snfe = new ServiceNotFoundException(msg);
        try {
            java.lang.reflect.Method initCause = Throwable.class.getMethod('initCause', new Class[] { Throwable.class });
            initCause.invoke(snfe, new Object[] { e });
        } catch (Exception x) {
        }
        throw snfe;
    }
    if (mletList.size() == 0) {
        if (isTraceOn()) {
            trace(mth, 'File ' + url + ' not found or MLET tag not defined in file');
        }
        throw new ServiceNotFoundException('File ' + url + ' not found or MLET tag not defined in file');
    }
    HashSet mbeans = new HashSet();
    for (Enumeration e = mletList.elements(); e.hasMoreElements(); ) {
        MLetContent elmt = (MLetContent) e.nextElement();
        String code = elmt.getCode();
        if (code != null) {
            if (code.endsWith('.class')) {
                code = code.substring(0, code.length() - 6);
            }
        }
        String name = elmt.getName();
        URL codebase = elmt.getCodeBase();
        String version = elmt.getVersion();
        String serName = elmt.getSerializedObject();
        String jarFiles = elmt.getJarFiles();
        URL documentBase = elmt.getDocumentBase();
        Map attributes = elmt.getAttributes();
        if (isTraceOn()) {
            trace(mth, 'MLET TAG     = ' + attributes.toString());
            trace(mth, 'CODEBASE     = ' + codebase);
            trace(mth, 'ARCHIVE      = ' + jarFiles);
            trace(mth, 'CODE         = ' + code);
            trace(mth, 'OBJECT       = ' + serName);
            trace(mth, 'NAME         = ' + name);
            trace(mth, 'VERSION      = ' + version);
            trace(mth, 'DOCUMENT URL = ' + documentBase);
        }
        StringTokenizer st = new StringTokenizer(jarFiles, ',', false);
        while (st.hasMoreTokens()) {
            String tok = st.nextToken().trim();
            if (isTraceOn()) {
                trace(mth, 'Load archive for codebase <' + codebase + '>, file <' + tok + '>');
            }
            try {
                codebase = check(version, codebase, tok, elmt);
            } catch (Exception ex) {
                if (isDebugOn()) {
                    debug(mth, 'check returned exception: ' + ex);
                }
                mbeans.add(ex);
                continue;
            }
            try {
                if (!Arrays.asList(getURLs()).contains(new URL(codebase.toString() + tok))) {
                    addURL(codebase + tok);
                }
            } catch (MalformedURLException me) {
            }
        }
        Object o = null;
        ObjectInstance objInst = null;
        if (code != null && serName != null) {
            if (isTraceOn()) {
                trace(mth, 'CODE and OBJECT parameters cannot be specified at the same time in tag MLET.');
            }
            mbeans.add(new Error('CODE and OBJECT parameters cannot be specified at the same time in tag MLET'));
            continue;
        }
        if (code == null && serName == null) {
            if (isTraceOn()) {
                trace(mth, 'Either CODE or OBJECT parameter must be specified in tag MLET.');
            }
            mbeans.add(new Error('Either CODE or OBJECT parameter must be specified in tag MLET'));
            continue;
        }
        try {
            if (code != null) {
                Vector signat = new Vector();
                Vector pars = new Vector();
                for (Iterator p = attributes.keySet().iterator(); p.hasNext(); ) {
                    String param_name = (String) p.next();
                    if (param_name.equals('types')) {
                        signat = (Vector) elmt.getParameter(param_name);
                    }
                    if (param_name.equals('values')) {
                        pars = (Vector) elmt.getParameter(param_name);
                    }
                }
                for (int i = 0; i < signat.size(); i++) {
                    pars.setElementAt(constructParameter((String) pars.elementAt(i), (String) signat.elementAt(i)), i);
                }
                if (signat.isEmpty()) {
                    if (name == null) {
                        objInst = server.createMBean(code, null, mletObjectName);
                    } else {
                        objInst = server.createMBean(code, new ObjectName(name), mletObjectName);
                    }
                } else {
                    Object[] parms = pars.toArray();
                    String[] signature = new String[signat.size()];
                    for (int i = 0; i < signature.length; i++) {
                        signature[i] = (String) signat.elementAt(i);
                    }
                    if (isDebugOn()) {
                        for (int i = 0; i < signature.length; i++) {
                            debug(mth, 'Signature     = ' + signature[i]);
                            debug(mth, 'Params     = ' + parms[i].toString());
                        }
                    }
                    if (name == null) {
                        objInst = server.createMBean(code, null, mletObjectName, parms, signature);
                    } else {
                        objInst = server.createMBean(code, new ObjectName(name), mletObjectName, parms, signature);
                    }
                }
            } else {
                o = loadSerializedObject(codebase, serName);
                if (name == null) {
                    server.registerMBean(o, null);
                } else {
                    server.registerMBean(o, new ObjectName(name));
                }
                objInst = new ObjectInstance(name, o.getClass().getName());
            }
        } catch (ReflectionException ex) {
            if (isTraceOn()) {
                trace(mth, 'ReflectionException: ' + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        } catch (InstanceAlreadyExistsException ex) {
            if (isTraceOn()) {
                trace(mth, 'InstanceAlreadyExistsException: ' + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        } catch (MBeanRegistrationException ex) {
            if (isTraceOn()) {
                trace(mth, 'MBeanRegistrationException: ' + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        } catch (MBeanException ex) {
            if (isTraceOn()) {
                trace(mth, 'MBeanException: ' + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        } catch (NotCompliantMBeanException ex) {
            if (isTraceOn()) {
                trace(mth, 'NotCompliantMBeanException: ' + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        } catch (InstanceNotFoundException ex) {
            if (isTraceOn()) {
                trace(mth, 'InstanceNotFoundException: ' + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        } catch (IOException ex) {
            if (isTraceOn()) {
                trace(mth, 'IOException: ' + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        } catch (SecurityException ex) {
            if (isTraceOn()) {
                trace(mth, 'SecurityException: ' + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        } catch (Exception ex) {
            if (isTraceOn()) {
                trace(mth, 'Exception: ' + ex.getClass().getName() + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        } catch (Error ex) {
            if (isTraceOn()) {
                trace(mth, 'Error: ' + ex.getMessage());
            }
            mbeans.add(ex);
            continue;
        }
        mbeans.add(objInst);
    }
    return mbeans;
}

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

javax.management.remote.rmi.RMIConnectorServer.start()

/**
     * Activates the connector server, that is starts listening for
     * client connections.  Calling this method when the connector
     * server is already active has no effect.  Calling this method
     * when the connector server has been stopped will generate an
     * <code>IOException</code>.
     * The behaviour of this method when called for the first time
     * depends on the parameters that were supplied at construction,
     * as described below.
     * First, an object of a subclass of {@link RMIServerImpl} is
     * required, to export the connector server through RMI:
     * <ul>
     * <li>If an <code>RMIServerImpl</code> was supplied to the
     * constructor, it is used.
     * <li>Otherwise, if the protocol part of the
     * <code>JMXServiceURL</code> supplied to the constructor was
     * <code>iiop</code>, an object of type {@link RMIIIOPServerImpl}
     * is created.
     * <li>Otherwise, if the <code>JMXServiceURL</code>
     * was null, or its protocol part was <code>rmi</code>, an object
     * of type {@link RMIJRMPServerImpl} is created.
     * <li>Otherwise, the implementation can create an
     * implementation-specific {@link RMIServerImpl} or it can throw
     * {@link MalformedURLException}.
     * </ul>
     * If the given address includes a JNDI directory URL as
     * specified in the package documentation for {@link
     * javax.management.remote.rmi}, then this
     * <code>RMIConnectorServer</code> will bootstrap by binding the
     * <code>RMIServerImpl</code> to the given address.
     * If the URL path part of the <code>JMXServiceURL</code> was
     * empty or a single slash (<code>/</code>), then the RMI object
     * will not be bound to a directory.  Instead, a reference to it
     * will be encoded in the URL path of the RMIConnectorServer
     * address (returned by {@link #getAddress()}).  The encodings for
     * <code>rmi</code> and <code>iiop</code> are described in the
     * package documentation for {@link
     * javax.management.remote.rmi}.
     * The behavior when the URL path is neither empty nor a JNDI
     * directory URL, or when the protocol is neither <code>rmi</code>
     * nor <code>iiop</code>, is implementation defined, and may
     * include throwing {@link MalformedURLException} when the
     * connector server is created or when it is started.
     * @exception IllegalStateException if the connector server has
     * not been attached to an MBean server.
     * @exception IOException if the connector server cannot be
     * started.
     */
public synchronized void start() throws IOException {
    final boolean tracing = logger.traceOn();
    if (state == STARTED) {
        if (tracing) logger.trace('start', 'already started');
        return;
    } else if (state == STOPPED) {
        if (tracing) logger.trace('start', 'already stopped');
        throw new IOException('The server has been stopped.');
    }
    MBeanServer mbs = getMBeanServer();
    if (mbs == null) throw new IllegalStateException('This connector server is not ' + 'attached to an MBean server');
    if (attributes != null) {
        String accessFile = (String) attributes.get('jmx.remote.x.access.file');
        if (accessFile != null) {
            MBeanServerForwarder mbsf = null;
            try {
                mbsf = new MBeanServerFileAccessController(accessFile);
            } catch (IOException e) {
                throw (IllegalArgumentException) EnvHelp.initCause(new IllegalArgumentException(e.getMessage()), e);
            }
            setMBeanServerForwarder(mbsf);
            mbs = getMBeanServer();
        }
    }
    try {
        if (tracing) logger.trace('start', 'setting default class loader');
        defaultClassLoader = EnvHelp.resolveServerClassLoader(attributes, mbs);
    } catch (InstanceNotFoundException infc) {
        IllegalArgumentException x = new IllegalArgumentException('ClassLoader not found: ' + infc);
        throw (IllegalArgumentException) EnvHelp.initCause(x, infc);
    }
    if (tracing) logger.trace('start', 'setting RMIServer object');
    final RMIServerImpl rmiServer;
    if (rmiServerImpl != null) rmiServer = rmiServerImpl; else rmiServer = newServer();
    rmiServer.setMBeanServer(mbs);
    rmiServer.setDefaultClassLoader(defaultClassLoader);
    rmiServer.setRMIConnectorServer(this);
    rmiServer.export();
    try {
        if (tracing) logger.trace('start', 'getting RMIServer object to export');
        final RMIServer objref = objectToBind(rmiServer, attributes);
        if (address != null && address.getURLPath().startsWith('/jndi/')) {
            final String jndiUrl = address.getURLPath().substring(6);
            if (tracing) logger.trace('start', 'Using external directory: ' + jndiUrl);
            final boolean rebind;
            String rebindS = (String) attributes.get(JNDI_REBIND_ATTRIBUTE);
            if (rebindS == null) rebind = false; else if (rebindS.equalsIgnoreCase('true')) rebind = true; else if (rebindS.equalsIgnoreCase('false')) rebind = false; else throw new IllegalArgumentException(JNDI_REBIND_ATTRIBUTE + 'must' + ' be \'true\' or \'false\'');
            if (tracing) logger.trace('start', JNDI_REBIND_ATTRIBUTE + '=' + rebind);
            try {
                if (tracing) logger.trace('start', 'binding to ' + jndiUrl);
                final Hashtable usemap = EnvHelp.mapToHashtable(attributes);
                final boolean isIiop = isIiopURL(address, true);
                if (isIiop) {
                    usemap.put(EnvHelp.DEFAULT_ORB, RMIConnector.resolveOrb(attributes));
                }
                bind(jndiUrl, usemap, objref, rebind);
                boundJndiUrl = jndiUrl;
            } catch (NamingException e) {
                throw newIOException('Cannot bind to URL [' + jndiUrl + ']: ' + e, e);
            }
        } else {
            if (tracing) logger.trace('start', 'Encoding URL');
            encodeStubInAddress(objref, attributes);
            if (tracing) logger.trace('start', 'Encoded URL: ' + this.address);
        }
    } catch (Exception e) {
        try {
            rmiServer.close();
        } catch (Exception x) {
        }
        if (e instanceof RuntimeException) throw (RuntimeException) e; else if (e instanceof IOException) throw (IOException) e; else throw newIOException('Got unexpected exception while ' + 'starting the connector server: ' + e, e);
    }
    rmiServerImpl = rmiServer;
    synchronized (openedServers) {
        openedServers.add(this);
    }
    state = STARTED;
    if (tracing) {
        logger.trace('start', 'Connector Server Address = ' + address);
        logger.trace('start', 'started.');
    }
}

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

java.awt.Container.checkTreeLock()

void checkTreeLock() {
    if (!Thread.holdsLock(getTreeLock())) {
        throw new IllegalStateException('This function should be called while holding treeLock');
    }
}

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

javax.security.auth.kerberos.KerberosKey.getAlgorithm()

/** 
     * Returns the standard algorithm name for this key. For 
     * example, 'DES' would indicate that this key is a DES key. 
     * See Appendix A in the <a href= 
     * '../../../../../guide/security/CryptoSpec.html#AppA'> 
     * Java Cryptography Architecture API Specification & Reference
     * </a> 
     * for information about standard algorithm names.
     * @return the name of the algorithm associated with this key.
     */
public final String getAlgorithm() {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    return key.getAlgorithm();
}

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

javax.security.auth.kerberos.KerberosKey.getEncoded()

/**
     * Returns the key material of this secret key.
     * @return the key material
     */
public final byte[] getEncoded() {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    return key.getEncoded();
}

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

javax.security.auth.kerberos.KerberosKey.getFormat()

/**
     * Returns the name of the encoding format for this secret key.
     * @return the String 'RAW'
     */
public final String getFormat() {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    return key.getFormat();
}

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

javax.security.auth.kerberos.KerberosKey.getKeyType()

/**
     * Returns the key type for this long-term key.
     * @return the key type.
     */
public final int getKeyType() {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    return key.getKeyType();
}

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

javax.security.auth.kerberos.KerberosKey.getPrincipal()

/**
     * Returns the principal that this key belongs to.
     * @return the principal this key belongs to.
     */
public final KerberosPrincipal getPrincipal() {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    return principal;
}

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

javax.security.auth.kerberos.KerberosKey.getVersionNumber()

/**
     * Returns the key version number.
     * @return the key version number.
     */
public final int getVersionNumber() {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    return versionNum;
}

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

javax.security.auth.kerberos.KeyImpl.getAlgorithmName(int)

private String getAlgorithmName(int eType) {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    switch(eType) {
        case EncryptedData.ETYPE_DES_CBC_CRC:
        case EncryptedData.ETYPE_DES_CBC_MD5:
            return 'DES';
        case EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD:
            return 'DESede';
        case EncryptedData.ETYPE_ARCFOUR_HMAC:
            return 'ArcFourHmac';
        case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96:
            return 'AES128';
        case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96:
            return 'AES256';
        case EncryptedData.ETYPE_NULL:
            return 'NULL';
        default:
            throw new IllegalArgumentException('Unsupported encryption type: ' + eType);
    }
}

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

javax.security.auth.kerberos.KeyImpl.getEncoded()

public final byte[] getEncoded() {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    return (byte[]) keyBytes.clone();
}

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

javax.security.auth.kerberos.KeyImpl.getFormat()

public final String getFormat() {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    return 'RAW';
}

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

javax.security.auth.kerberos.KeyImpl.getKeyType()

/**
     * Returns the keyType for this key as defined in the Kerberos Spec.
     */
public final int getKeyType() {
    if (destroyed) throw new IllegalStateException('This key is no longer valid');
    return keyType;
}

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

javax.security.auth.kerberos.KerberosTicket.getEncoded()

/**
     * Returns an ASN.1 encoding of the entire ticket.
     * @return an ASN.1 encoding of the entire ticket.
     */
public final byte[] getEncoded() {
    if (destroyed) throw new IllegalStateException('This ticket is no longer valid');
    return (byte[]) asn1Encoding.clone();
}

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

javax.security.auth.kerberos.KerberosTicket.getSessionKey()

/**
     * Returns the session key associated with this ticket.
     * @return the session key.
     */
public final SecretKey getSessionKey() {
    if (destroyed) throw new IllegalStateException('This ticket is no longer valid');
    return sessionKey;
}

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

javax.security.auth.kerberos.KerberosTicket.getSessionKeyType()

/**
     * Returns the key type of the session key associated with this
     * ticket as defined by the Kerberos Protocol Specification.
     * @return the key type of the session key associated with this
     * ticket.
     * @see #getSessionKey()
     */
public final int getSessionKeyType() {
    if (destroyed) throw new IllegalStateException('This ticket is no longer valid');
    return sessionKey.getKeyType();
}

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

javax.security.auth.kerberos.KerberosTicket.toString()

public String toString() {
    if (destroyed) throw new IllegalStateException('This ticket is no longer valid');
    StringBuffer caddrBuf = new StringBuffer();
    if (clientAddresses != null) {
        for (int i = 0; i < clientAddresses.length; i++) {
            caddrBuf.append('clientAddresses[' + i + '] = ' + clientAddresses[i].toString());
        }
    }
    return ('Ticket (hex) = ' + '\n' + (new HexDumpEncoder()).encode(asn1Encoding) + '\n' + 'Client Principal = ' + client.toString() + '\n' + 'Server Principal = ' + server.toString() + '\n' + 'Session Key = ' + sessionKey.toString() + '\n' + 'Forwardable Ticket ' + flags[FORWARDABLE_TICKET_FLAG] + '\n' + 'Forwarded Ticket ' + flags[FORWARDED_TICKET_FLAG] + '\n' + 'Proxiable Ticket ' + flags[PROXIABLE_TICKET_FLAG] + '\n' + 'Proxy Ticket ' + flags[PROXY_TICKET_FLAG] + '\n' + 'Postdated Ticket ' + flags[POSTDATED_TICKET_FLAG] + '\n' + 'Renewable Ticket ' + flags[RENEWABLE_TICKET_FLAG] + '\n' + 'Initial Ticket ' + flags[RENEWABLE_TICKET_FLAG] + '\n' + 'Auth Time = ' + String.valueOf(authTime) + '\n' + 'Start Time = ' + String.valueOf(startTime) + '\n' + 'End Time = ' + endTime.toString() + '\n' + 'Renew Till = ' + String.valueOf(renewTill) + '\n' + 'Client Addresses ' + (clientAddresses == null ? ' Null ' : caddrBuf.toString() + '\n'));
}

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

javax.imageio.ImageWriteParam.getTileGridXOffset()

/**
     * Returns the horizontal tile grid offset of an image as it will
     * be written to the output stream.  If tiling parameters have not
     * been set, an <code>IllegalStateException</code> is thrown.
     * @return the tile grid X offset to be used for encoding.
     * @exception UnsupportedOperationException if the plug-in does not
     * support tiling.
     * @exception IllegalStateException if the tiling mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the tiling parameters have
     * not been set.
     * @see #setTiling(int, int, int, int)
     * @see #getTileGridYOffset()
     */
public int getTileGridXOffset() {
    if (!canWriteTiles()) {
        throw new UnsupportedOperationException('Tiling not supported!');
    }
    if (getTilingMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Tiling mode not MODE_EXPLICIT!');
    }
    if (!tilingSet) {
        throw new IllegalStateException('Tiling parameters not set!');
    }
    return tileGridXOffset;
}

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

javax.imageio.ImageWriteParam.getTileGridYOffset()

/**
     * Returns the vertical tile grid offset of an image as it will
     * be written to the output stream.  If tiling parameters have not
     * been set, an <code>IllegalStateException</code> is thrown.
     * @return the tile grid Y offset to be used for encoding.
     * @exception UnsupportedOperationException if the plug-in does not
     * support tiling.
     * @exception IllegalStateException if the tiling mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the tiling parameters have
     * not been set.
     * @see #setTiling(int, int, int, int)
     * @see #getTileGridXOffset()
     */
public int getTileGridYOffset() {
    if (!canWriteTiles()) {
        throw new UnsupportedOperationException('Tiling not supported!');
    }
    if (getTilingMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Tiling mode not MODE_EXPLICIT!');
    }
    if (!tilingSet) {
        throw new IllegalStateException('Tiling parameters not set!');
    }
    return tileGridYOffset;
}

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

javax.imageio.ImageWriteParam.getTileHeight()

/**
     * Returns the height of each tile in an image as it will be written to
     * the output stream.  If tiling parameters have not
     * been set, an <code>IllegalStateException</code> is thrown.
     * @return the tile height to be used for encoding.
     * @exception UnsupportedOperationException if the plug-in does not
     * support tiling.
     * @exception IllegalStateException if the tiling mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the tiling parameters have
     * not been set.
     * @see #setTiling(int, int, int, int)
     * @see #getTileWidth()
     */
public int getTileHeight() {
    if (!canWriteTiles()) {
        throw new UnsupportedOperationException('Tiling not supported!');
    }
    if (getTilingMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Tiling mode not MODE_EXPLICIT!');
    }
    if (!tilingSet) {
        throw new IllegalStateException('Tiling parameters not set!');
    }
    return tileHeight;
}

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

javax.imageio.ImageWriteParam.getTileWidth()

/**
     * Returns the width of each tile in an image as it will be
     * written to the output stream.  If tiling parameters have not
     * been set, an <code>IllegalStateException</code> is thrown.
     * @return the tile width to be used for encoding.
     * @exception UnsupportedOperationException if the plug-in does not
     * support tiling.
     * @exception IllegalStateException if the tiling mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception IllegalStateException if the tiling parameters have
     * not been set.
     * @see #setTiling(int, int, int, int)
     * @see #getTileHeight()
     */
public int getTileWidth() {
    if (!canWriteTiles()) {
        throw new UnsupportedOperationException('Tiling not supported!');
    }
    if (getTilingMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Tiling mode not MODE_EXPLICIT!');
    }
    if (!tilingSet) {
        throw new IllegalStateException('Tiling parameters not set!');
    }
    return tileWidth;
}

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

javax.imageio.ImageWriteParam.setTiling(int, int, int, int)

/**
     * Specifies that the image should be tiled in the output stream.
     * The <code>tileWidth</code> and <code>tileHeight</code>
     * parameters specify the width and height of the tiles in the
     * file.  If the tile width or height is greater than the width or
     * height of the image, the image is not tiled in that dimension.
     *  If <code>canOffsetTiles</code> returns <code>false</code>,
     * then the <code>tileGridXOffset</code> and
     * <code>tileGridYOffset</code> parameters must be zero.
     * @param tileWidth the width of each tile.
     * @param tileHeight the height of each tile.
     * @param tileGridXOffset the horizontal offset of the tile grid.
     * @param tileGridYOffset the vertical offset of the tile grid.
     * @exception UnsupportedOperationException if the plug-in does not
     * support tiling.
     * @exception IllegalStateException if the tiling mode is not
     * <code>MODE_EXPLICIT</code>.
     * @exception UnsupportedOperationException if the plug-in does not
     * support grid offsets, and the grid offsets are not both zero.
     * @exception IllegalArgumentException if the tile size is not
     * within one of the allowable ranges returned by
     * <code>getPreferredTileSizes</code>.
     * @exception IllegalArgumentException if <code>tileWidth</code>
     * or <code>tileHeight</code> is less than or equal to 0.
     * @see #canWriteTiles
     * @see #canOffsetTiles
     * @see #getTileWidth()
     * @see #getTileHeight()
     * @see #getTileGridXOffset()
     * @see #getTileGridYOffset()
     */
public void setTiling(int tileWidth, int tileHeight, int tileGridXOffset, int tileGridYOffset) {
    if (!canWriteTiles()) {
        throw new UnsupportedOperationException('Tiling not supported!');
    }
    if (getTilingMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Tiling mode not MODE_EXPLICIT!');
    }
    if (tileWidth <= 0 || tileHeight <= 0) {
        throw new IllegalArgumentException('tile dimensions are non-positive!');
    }
    boolean tilesOffset = (tileGridXOffset != 0) || (tileGridYOffset != 0);
    if (!canOffsetTiles() && tilesOffset) {
        throw new UnsupportedOperationException('Can't offset tiles!');
    }
    if (preferredTileSizes != null) {
        boolean ok = true;
        for (int i = 0; i < preferredTileSizes.length; i += 2) {
            Dimension min = preferredTileSizes[i];
            Dimension max = preferredTileSizes[i + 1];
            if ((tileWidth < min.width) || (tileWidth > max.width) || (tileHeight < min.height) || (tileHeight > max.height)) {
                ok = false;
                break;
            }
        }
        if (!ok) {
            throw new IllegalArgumentException('Illegal tile size!');
        }
    }
    this.tilingSet = true;
    this.tileWidth = tileWidth;
    this.tileHeight = tileHeight;
    this.tileGridXOffset = tileGridXOffset;
    this.tileGridYOffset = tileGridYOffset;
}

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

javax.imageio.ImageWriteParam.unsetTiling()

/**
     * Removes any previous tile grid parameters specified by calls to
     * <code>setTiling</code>.
     *  The default implementation sets the instance variables
     * <code>tileWidth</code>, <code>tileHeight</code>,
     * <code>tileGridXOffset</code>, and
     * <code>tileGridYOffset</code> to <code>0</code>.
     * @exception UnsupportedOperationException if the plug-in does not
     * support tiling.
     * @exception IllegalStateException if the tiling mode is not
     * <code>MODE_EXPLICIT</code>.
     * @see #setTiling(int, int, int, int)
     */
public void unsetTiling() {
    if (!canWriteTiles()) {
        throw new UnsupportedOperationException('Tiling not supported!');
    }
    if (getTilingMode() != MODE_EXPLICIT) {
        throw new IllegalStateException('Tiling mode not MODE_EXPLICIT!');
    }
    this.tilingSet = false;
    this.tileWidth = 0;
    this.tileHeight = 0;
    this.tileGridXOffset = 0;
    this.tileGridYOffset = 0;
}

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

javax.imageio.ImageWriter.canInsertEmpty(int)

/**
     * Returns <code>true</code> if the writer supports the insertion
     * of a new, empty image at the given index.  The pixel values of
     * the image are undefined, and may be specified in pieces using
     * the <code>replacePixels</code> methods.  Existing images with
     * indices greater than or equal to the insertion index will have
     * their indices increased by 1.  A value for
     * <code>imageIndex</code> of <code>-1</code> may be used to
     * signify an index one larger than the current largest index.
     *  A writer that does not support insertion of empty images
     * may return <code>false</code> without performing bounds
     * checking on the index.
     *  The default implementation throws an
     * <code>IllegalStateException</code> if the output is
     * <code>null</code>, and otherwise returns <code>false</code>
     * without checking the value of <code>imageIndex</code>.
     * @param imageIndex the index at which the image is to be
     * inserted.
     * @return <code>true</code> if an empty image may be inserted at
     * the given index.
     * @exception IllegalStateException if the output has not been
     * set.
     * @exception IndexOutOfBoundsException if the writer supports
     * empty image insertion in general, but <code>imageIndex</code>
     * is less than -1 or greater than the largest available index.
     * @exception IOException if an I/O error occurs during the
     * query.
     */
public boolean canInsertEmpty(int imageIndex) throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException('getOutput() == null!');
    }
    return false;
}

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

javax.imageio.ImageWriter.canInsertImage(int)

/**
     * Returns <code>true</code> if the writer supports the insertion
     * of a new image at the given index.  Existing images with
     * indices greater than or equal to the insertion index will have
     * their indices increased by 1.  A value for
     * <code>imageIndex</code> of <code>-1</code> may be used to
     * signify an index one larger than the current largest index.
     *  A writer that does not support any image insertion may
     * return <code>false</code> without performing bounds checking on
     * the index.
     *  The default implementation throws an
     * <code>IllegalStateException</code> if the output is
     * <code>null</code>, and otherwise returns <code>false</code>
     * withour checking the value of <code>imageIndex</code>.
     * @param imageIndex the index at which the image is to be
     * inserted.
     * @return <code>true</code> if an image may be inserted at the
     * given index.
     * @exception IllegalStateException if the output has not
     * been set.
     * @exception IndexOutOfBoundsException if the writer supports
     * image insertion in general, but <code>imageIndex</code> is less
     * than -1 or greater than the largest available index.
     * @exception IOException if an I/O error occurs during the query.
     */
public boolean canInsertImage(int imageIndex) throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException('getOutput() == null!');
    }
    return false;
}

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

javax.imageio.ImageWriter.canRemoveImage(int)

/**
     * Returns <code>true</code> if the writer supports the removal
     * of an existing image at the given index.  Existing images with
     * indices greater than the insertion index will have
     * their indices decreased by 1.
     *  A writer that does not support any image removal may
     * return <code>false</code> without performing bounds checking on
     * the index.
     *  The default implementation throws an
     * <code>IllegalStateException</code> if the output is
     * <code>null</code>, and otherwise returns <code>false</code>
     * without checking the value of <code>imageIndex</code>.
     * @param imageIndex the index of the image to be removed.
     * @return <code>true</code> if it is possible to remove the given
     * image.
     * @exception IllegalStateException if the output has not
     * been set.
     * @exception IndexOutOfBoundsException if the writer supports
     * image removal in general, but <code>imageIndex</code> is less
     * than 0 or greater than the largest available index.
     * @exception IOException if an I/O error occurs during the
     * query.
     */
public boolean canRemoveImage(int imageIndex) throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException('getOutput() == null!');
    }
    return false;
}

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

javax.imageio.ImageWriter.canReplaceImageMetadata(int)

/**
     * Returns <code>true</code> if it is possible to replace the
     * image metadata associated with an existing image with index
     * <code>imageIndex</code>.  If this method returns
     * <code>false</code>, a call to
     * <code>replaceImageMetadata(imageIndex)</code> will throw an
     * <code>UnsupportedOperationException</code>.
     *  A writer that does not support any image metadata
     * replacement may return <code>false</code> without performing
     * bounds checking on the index.
     *  The default implementation throws an
     * <code>IllegalStateException</code> if the output is
     * <code>null</code>, and otherwise returns <code>false</code>
     * without checking the value of <code>imageIndex</code>.
     * @param imageIndex the index of the image whose metadata is to
     * be replaced.
     * @return <code>true</code> if the image metadata of the given
     * image can be replaced.
     * @exception IllegalStateException if the output has not
     * been set.
     * @exception IndexOutOfBoundsException if the writer supports
     * image metadata replacement in general, but
     * <code>imageIndex</code> is less than 0 or greater than the
     * largest available index.
     * @exception IOException if an I/O error occurs during the query.
     */
public boolean canReplaceImageMetadata(int imageIndex) throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException('getOutput() == null!');
    }
    return false;
}

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

javax.imageio.ImageWriter.canReplacePixels(int)

/**
     * Returns <code>true</code> if the writer allows pixels of the
     * given image to be replaced using the <code>replacePixels</code>
     * methods.
     *  A writer that does not support any pixel replacement may
     * return <code>false</code> without performing bounds checking on
     * the index.
     *  The default implementation throws an
     * <code>IllegalStateException</code> if the output is
     * <code>null</code>, and otherwise returns <code>false</code>
     * without checking the value of <code>imageIndex</code>.
     * @param imageIndex the index of the image whose pixels are to be
     * replaced.
     * @return <code>true</code> if the pixels of the given
     * image can be replaced.
     * @exception IllegalStateException if the output has not been
     * set.
     * @exception IndexOutOfBoundsException if the writer supports
     * pixel replacement in general, but <code>imageIndex</code> is
     * less than 0 or greater than the largest available index.
     * @exception IOException if an I/O error occurs during the query.
     */
public boolean canReplacePixels(int imageIndex) throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException('getOutput() == null!');
    }
    return false;
}

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

javax.imageio.ImageWriter.canReplaceStreamMetadata()

/**
     * Returns <code>true</code> if it is possible to replace the
     * stream metadata already present in the output.
     *  The default implementation throws an
     * <code>IllegalStateException</code> if the output is
     * <code>null</code>, and otherwise returns <code>false</code>.
     * @return <code>true</code> if replacement of stream metadata is
     * allowed.
     * @exception IllegalStateException if the output has not
     * been set.
     * @exception IOException if an I/O error occurs during the query.
     */
public boolean canReplaceStreamMetadata() throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException('getOutput() == null!');
    }
    return false;
}

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

javax.imageio.ImageWriter.canWriteEmpty()

/**
     * Returns <code>true</code> if the writer supports the writing of
     * a complete image stream consisting of a single image with
     * undefined pixel values and associated metadata and thumbnails
     * to the output.  The pixel values may be defined by future
     * calls to the <code>replacePixels</code> methods.  If the output
     * is an <code>ImageOutputStream</code>, its existing contents
     * prior to the current seek position are not affected, and need
     * not be readable or writable.
     *  The default implementation throws an
     * <code>IllegalStateException</code> if the output is
     * <code>null</code>, and otherwise returns <code>false</code>.
     * @return <code>true</code> if the writing of complete image
     * stream with contents to be defined later is supported.
     * @exception IllegalStateException if the output has not been
     * set.
     * @exception IOException if an I/O error occurs during the
     * query.
     */
public boolean canWriteEmpty() throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException('getOutput() == null!');
    }
    return false;
}

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

javax.imageio.ImageWriter.unsupported()

private void unsupported() {
    if (getOutput() == null) {
        throw new IllegalStateException('getOutput() == null!');
    }
    throw new UnsupportedOperationException('Unsupported write variant!');
}

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

javax.imageio.IIOParam.activateController()

/**
     * Activates the installed <code>IIOParamController</code> for
     * this <code>IIOParam</code> object and returns the resulting
     * value.  When this method returns <code>true</code>, all values
     * for this <code>IIOParam</code> object will be ready for the
     * next read or write operation.  If <code>false</code> is
     * returned, no settings in this object will have been disturbed
     * (<i>i.e.</i>, the user canceled the operation).
     *  Ordinarily, the controller will be a GUI providing a user
     * interface for a subclass of <code>IIOParam</code> for a
     * particular plug-in.  Controllers need not be GUIs, however.
     * @return <code>true</code> if the controller completed normally.
     * @exception IllegalStateException if there is no controller
     * currently installed.
     * @see IIOParamController
     * @see #setController(IIOParamController)
     * @see #getController
     * @see #getDefaultController
     * @see #hasController
     */
public boolean activateController() {
    if (!hasController()) {
        throw new IllegalStateException('hasController() == false!');
    }
    return getController().activate(this);
}

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

javax.imageio.metadata.IIOMetadata.activateController()

/**
     * Activates the installed <code>IIOMetadataController</code> for
     * this <code>IIOMetadata</code> object and returns the resulting
     * value.  When this method returns <code>true</code>, all values for this
     * <code>IIOMetadata</code> object will be ready for the next write
     * operation.  If <code>false</code> is
     * returned, no settings in this object will have been disturbed
     * (<i>i.e.</i>, the user canceled the operation).
     *  Ordinarily, the controller will be a GUI providing a user
     * interface for a subclass of <code>IIOMetadata</code> for a
     * particular plug-in.  Controllers need not be GUIs, however.
     *  The default implementation calls <code>getController</code>
     * and the calls <code>activate</code> on the returned object if
     * <code>hasController</code> returns <code>true</code>.
     * @return <code>true</code> if the controller completed normally.
     * @exception IllegalStateException if there is no controller
     * currently installed.
     * @see IIOMetadataController
     * @see #setController(IIOMetadataController)
     * @see #getController
     * @see #getDefaultController
     * @see #hasController
     */
public boolean activateController() {
    if (!hasController()) {
        throw new IllegalStateException('hasController() == false!');
    }
    return getController().activate(this);
}

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

javax.xml.datatype.Duration.getXMLSchemaType()

/**
  * Return the name of the XML Schema date/time type that this instance 
  * maps to. Type is computed based on fields that are set,
  * i.e. {@link #isSet(DatatypeConstants.Field field)} == <code>true</code>.
  *
  * <table border='2' rules='all' cellpadding='2'>
  *   <thead>
  *     <tr>
  *       <th align='center' colspan='7'>
  *         Required fields for XML Schema 1.0 Date/Time Datatypes.<br/>
  *         <i>(timezone is optional for all date/time datatypes)</i>
  *       </th>
  *     </tr>
  *   </thead>
  *   <tbody>
  *     <tr>
  *       <td>Datatype</td>
  *       <td>year</td>
  *       <td>month</td>
  *       <td>day</td>
  *       <td>hour</td>
  *       <td>minute</td>
  *       <td>second</td>
  *     </tr>
  *     <tr>
  *       <td>{@link DatatypeConstants#DURATION}</td>
  *       <td>X</td>
  *       <td>X</td>
  *       <td>X</td>
  *       <td>X</td>
  *       <td>X</td>
  *       <td>X</td>
  *     </tr>
  *     <tr>
  *       <td>{@link DatatypeConstants#DURATION_DAYTIME}</td>
  *       <td></td>
  *       <td></td>
  *       <td>X</td>
  *       <td>X</td>
  *       <td>X</td>
  *       <td>X</td>
  *     </tr>
  *     <tr>
  *       <td>{@link DatatypeConstants#DURATION_YEARMONTH}</td>
  *       <td>X</td>
  *       <td>X</td>
  *       <td></td>
  *       <td></td>
  *       <td></td>
  *       <td></td>
  *     </tr>
  *   </tbody>
  * </table>
  * 
  * @return one of the following constants:
  *   {@link DatatypeConstants#DURATION},
  *   {@link DatatypeConstants#DURATION_DAYTIME} or
  *   {@link DatatypeConstants#DURATION_YEARMONTH}.
  *  
  * @throws IllegalStateException If the combination of set fields does not match one of the XML Schema date/time datatypes.
  */
public QName getXMLSchemaType() {
    boolean yearSet = isSet(DatatypeConstants.YEARS);
    boolean monthSet = isSet(DatatypeConstants.MONTHS);
    boolean daySet = isSet(DatatypeConstants.DAYS);
    boolean hourSet = isSet(DatatypeConstants.HOURS);
    boolean minuteSet = isSet(DatatypeConstants.MINUTES);
    boolean secondSet = isSet(DatatypeConstants.SECONDS);
    if (yearSet && monthSet && daySet && hourSet && minuteSet && secondSet) {
        return DatatypeConstants.DURATION;
    }
    if (!yearSet && !monthSet && daySet && hourSet && minuteSet && secondSet) {
        return DatatypeConstants.DURATION_DAYTIME;
    }
    if (yearSet && monthSet && !daySet && !hourSet && !minuteSet && !secondSet) {
        return DatatypeConstants.DURATION_YEARMONTH;
    }
    throw new IllegalStateException('javax.xml.datatype.Duration#getXMLSchemaType():' + ' this Duration does not match one of the XML Schema date/time datatypes:' + ' year set = ' + yearSet + ' month set = ' + monthSet + ' day set = ' + daySet + ' hour set = ' + hourSet + ' minute set = ' + minuteSet + ' second set = ' + secondSet);
}

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.Match.getCapturedText(int)

/**
     * Return an substring of the target text matched to specified regular expression group.
     * @param index Less than <code>getNumberOfGroups()</code>.
     */
public String getCapturedText(int index) {
    if (this.beginpos == null) throw new IllegalStateException('match() has never been called.');
    if (index < 0 || this.nofgroups <= index) throw new IllegalArgumentException('The parameter must be less than ' + this.nofgroups + ': ' + index);
    String ret;
    int begin = this.beginpos[index], end = this.endpos[index];
    if (begin < 0 || end < 0) return null;
    if (this.ciSource != null) {
        ret = REUtil.substring(this.ciSource, begin, end);
    } else if (this.strSource != null) {
        ret = this.strSource.substring(begin, end);
    } else {
        ret = new String(this.charSource, begin, end - begin);
    }
    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.tree.DefaultMutableTreeNode.insert(MutableTreeNode, int)

/**
     * Removes <code>newChild</code> from its present parent (if it has a
     * parent), sets the child's parent to this node, and then adds the child
     * to this node's child array at index <code>childIndex</code>.
     * <code>newChild</code> must not be null and must not be an ancestor of
     * this node.
     * @param newChild the MutableTreeNode to insert under this node
     * @param childIndex the index in this node's child array
     *    where this node is to be inserted
     * @exception ArrayIndexOutOfBoundsException if
     *    <code>childIndex</code> is out of bounds
     * @exception IllegalArgumentException if
     *    <code>newChild</code> is null or is an
     *    ancestor of this node
     * @exception IllegalStateException if this node does not allow
     *      children
     * @see #isNodeDescendant
     */
public void insert(MutableTreeNode newChild, int childIndex) {
    if (!allowsChildren) {
        throw new IllegalStateException('node does not allow children');
    } else if (newChild == null) {
        throw new IllegalArgumentException('new child is null');
    } else if (isNodeAncestor(newChild)) {
        throw new IllegalArgumentException('new child is an ancestor');
    }
    MutableTreeNode oldParent = (MutableTreeNode) newChild.getParent();
    if (oldParent != null) {
        oldParent.remove(newChild);
    }
    newChild.setParent(this);
    if (children == null) {
        children = new Vector();
    }
    children.insertElementAt(newChild, childIndex);
}

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.write(IIOMetadata, IIOImage, ImageWriteParam)

public void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param) throws IIOException {
    if (stream == null) {
        throw new IllegalStateException('output == null!');
    }
    if (image == null) {
        throw new IllegalArgumentException('image == null!');
    }
    if (image.hasRaster()) {
        throw new UnsupportedOperationException('image has a Raster!');
    }
    RenderedImage im = image.getRenderedImage();
    SampleModel sampleModel = im.getSampleModel();
    this.numBands = sampleModel.getNumBands();
    this.sourceXOffset = im.getMinX();
    this.sourceYOffset = im.getMinY();
    this.sourceWidth = im.getWidth();
    this.sourceHeight = im.getHeight();
    this.sourceBands = null;
    this.periodX = 1;
    this.periodY = 1;
    if (param != null) {
        Rectangle sourceRegion = param.getSourceRegion();
        if (sourceRegion != null) {
            Rectangle imageBounds = new Rectangle(im.getMinX(), im.getMinY(), im.getWidth(), im.getHeight());
            sourceRegion = sourceRegion.intersection(imageBounds);
            sourceXOffset = sourceRegion.x;
            sourceYOffset = sourceRegion.y;
            sourceWidth = sourceRegion.width;
            sourceHeight = sourceRegion.height;
        }
        int gridX = param.getSubsamplingXOffset();
        int gridY = param.getSubsamplingYOffset();
        sourceXOffset += gridX;
        sourceYOffset += gridY;
        sourceWidth -= gridX;
        sourceHeight -= gridY;
        periodX = param.getSourceXSubsampling();
        periodY = param.getSourceYSubsampling();
        int[] sBands = param.getSourceBands();
        if (sBands != null) {
            sourceBands = sBands;
            numBands = sourceBands.length;
        }
    }
    int destWidth = (sourceWidth + periodX - 1) / periodX;
    int destHeight = (sourceHeight + periodY - 1) / periodY;
    if (destWidth <= 0 || destHeight <= 0) {
        throw new IllegalArgumentException('Empty source region!');
    }
    this.totalPixels = destWidth * destHeight;
    this.pixelsDone = 0;
    IIOMetadata imd = image.getMetadata();
    if (imd != null) {
        metadata = (PNGMetadata) convertImageMetadata(imd, ImageTypeSpecifier.createFromRenderedImage(im), null);
    } else {
        metadata = new PNGMetadata();
    }
    if (param != null) {
        switch(param.getProgressiveMode()) {
            case ImageWriteParam.MODE_DEFAULT:
                metadata.IHDR_interlaceMethod = 1;
                break;
            case ImageWriteParam.MODE_DISABLED:
                metadata.IHDR_interlaceMethod = 0;
                break;
        }
    }
    metadata.initialize(new ImageTypeSpecifier(im), numBands);
    metadata.IHDR_width = destWidth;
    metadata.IHDR_height = destHeight;
    this.bpp = numBands * ((metadata.IHDR_bitDepth == 16) ? 2 : 1);
    initializeScaleTables(sampleModel.getSampleSize());
    clearAbortRequest();
    processImageStarted(0);
    try {
        write_magic();
        write_IHDR();
        write_cHRM();
        write_gAMA();
        write_iCCP();
        write_sBIT();
        write_sRGB();
        write_PLTE();
        write_hIST();
        write_tRNS();
        write_bKGD();
        write_pHYs();
        write_sPLT();
        write_tIME();
        write_tEXt();
        write_iTXt();
        write_zTXt();
        writeUnknownChunks();
        write_IDAT(im);
        if (abortRequested()) {
            processWriteAborted();
        } else {
            writeIEND();
            processImageComplete();
        }
    } catch (IOException e) {
        throw new IIOException('I/O error writing PNG file!', e);
    }
}

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

java.lang.ClassLoader.initSystemClassLoader()

private static synchronized void initSystemClassLoader() {
    if (!sclSet) {
        if (scl != null) throw new IllegalStateException('recursive invocation');
        sun.misc.Launcher l = sun.misc.Launcher.getLauncher();
        if (l != null) {
            Throwable oops = null;
            scl = l.getClassLoader();
            try {
                PrivilegedExceptionAction a;
                a = new SystemClassLoaderAction(scl);
                scl = (ClassLoader) AccessController.doPrivileged(a);
            } catch (PrivilegedActionException pae) {
                oops = pae.getCause();
                if (oops instanceof InvocationTargetException) {
                    oops = oops.getCause();
                }
            }
            if (oops != null) {
                if (oops instanceof Error) {
                    throw (Error) oops;
                } else {
                    throw new Error(oops);
                }
            }
        }
        sclSet = true;
    }
}

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

javax.imageio.IIOParam.setSourceSubsampling(int, int, int, int)

/**
     * Specifies a decimation subsampling to apply on I/O.  The
     * <code>sourceXSubsampling</code> and
     * <code>sourceYSubsampling</code> parameters specify the
     * subsampling period (<i>i.e.</i>, the number of rows and columns
     * to advance after every source pixel).  Specifically, a period of
     * 1 will use every row or column; a period of 2 will use every
     * other row or column.  The <code>subsamplingXOffset</code> and
     * <code>subsamplingYOffset</code> parameters specify an offset
     * from the region (or image) origin for the first subsampled pixel.
     * Adjusting the origin of the subsample grid is useful for avoiding
     * seams when subsampling a very large source image into destination
     * regions that will be assembled into a complete subsampled image.
     * Most users will want to simply leave these parameters at 0.
     *  The number of pixels and scanlines to be used are calculated
     * as follows.
     * The number of subsampled pixels in a scanline is given by
     * <code>truncate[(width - subsamplingXOffset + sourceXSubsampling - 1)
     * / sourceXSubsampling]</code>.
     * If the region is such that this width is zero, an 
     * <code>IllegalStateException</code> is thrown.
     * The number of scanlines to be used can be computed similarly.
     * The ability to set the subsampling grid to start somewhere
     * other than the source region origin is useful if the 
     * region is being used to create subsampled tiles of a large image, 
     * where the tile width and height are not multiples of the 
     * subsampling periods.  If the subsampling grid does not remain
     * consistent from tile to tile, there will be artifacts at the tile
     * boundaries.  By adjusting the subsampling grid offset for each
     * tile to compensate, these artifacts can be avoided.  The tradeoff
     * is that in order to avoid these artifacts, the tiles are not all
     * the same size.  The grid offset to use in this case is given by:
     * grid offset = [period - (region offset modulo period)] modulo period)
     *  If either <code>sourceXSubsampling</code> or
     * <code>sourceYSubsampling</code> is 0 or negative, an
     * <code>IllegalArgumentException</code> will be thrown.
     *  If either <code>subsamplingXOffset</code> or
     * <code>subsamplingYOffset</code> is negative or greater than or
     * equal to the corresponding period, an 
     * <code>IllegalArgumentException</code> will be thrown.
     *  There is no <code>unsetSourceSubsampling</code> method;
     * simply call <code>setSourceSubsampling(1, 1, 0, 0)</code> to
     * restore default values.
     * @param sourceXSubsampling the number of columns to advance
     * between pixels.
     * @param sourceYSubsampling the number of rows to advance between
     * pixels.
     * @param subsamplingXOffset the horizontal offset of the first subsample
     * within the region, or within the image if no region is set.
     * @param subsamplingYOffset the horizontal offset of the first subsample
     * within the region, or within the image if no region is set.
     * @exception IllegalArgumentException if either period is
     * negative or 0, or if either grid offset is negative or greater than
     * the corresponding period.
     * @exception IllegalStateException if the source region is such that
     * the subsampled output would contain no pixels.
     */
public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset) {
    if (sourceXSubsampling <= 0) {
        throw new IllegalArgumentException('sourceXSubsampling <= 0!');
    }
    if (sourceYSubsampling <= 0) {
        throw new IllegalArgumentException('sourceYSubsampling <= 0!');
    }
    if (subsamplingXOffset < 0 || subsamplingXOffset >= sourceXSubsampling) {
        throw new IllegalArgumentException('subsamplingXOffset out of range!');
    }
    if (subsamplingYOffset < 0 || subsamplingYOffset >= sourceYSubsampling) {
        throw new IllegalArgumentException('subsamplingYOffset out of range!');
    }
    if (sourceRegion != null) {
        if (subsamplingXOffset >= sourceRegion.width || subsamplingYOffset >= sourceRegion.height) {
            throw new IllegalStateException('region contains no pixels!');
        }
    }
    this.sourceXSubsampling = sourceXSubsampling;
    this.sourceYSubsampling = sourceYSubsampling;
    this.subsamplingXOffset = subsamplingXOffset;
    this.subsamplingYOffset = subsamplingYOffset;
}

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.jpeg.JPEGImageWriter.endWriteSequence()

public void endWriteSequence() throws IOException {
    if (sequencePrepared == false) {
        throw new IllegalStateException('sequencePrepared not called!');
    }
    sequencePrepared = false;
}

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.jpeg.JPEGImageWriter.writeToSequence(IIOImage, ImageWriteParam)

public void writeToSequence(IIOImage image, ImageWriteParam param) throws IOException {
    if (sequencePrepared == false) {
        throw new IllegalStateException('sequencePrepared not called!');
    }
    write(null, image, param);
}

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.orb.DataCollectorBase.checkSetParserCalled()

private void checkSetParserCalled() {
    if (!setParserCalled) throw new IllegalStateException('setParser not called.');
}

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

javax.imageio.IIOParam.setSourceRegion(Rectangle)

/**
     * Sets the source region of interest.  The region of interest is
     * described as a rectangle, with the upper-left corner of the
     * source image as pixel (0, 0) and increasing values down and to
     * the right.  The actual number of pixels used will depend on
     * the subsampling factors set by <code>setSourceSubsampling</code>.
     * If subsampling has been set such that this number is zero,
     * an <code>IllegalStateException</code> will be thrown.
     *  The source region of interest specified by this method will
     * be clipped as needed to fit within the source bounds, as well
     * as the destination offsets, width, and height at the time of
     * actual I/O.
     *  A value of <code>null</code> for <code>sourceRegion</code>
     * will remove any region specification, causing the entire image
     * to be used.
     * @param sourceRegion a <code>Rectangle</code> specifying the
     * source region of interest, or <code>null</code>.
     * @exception IllegalArgumentException if
     * <code>sourceRegion</code> is non-<code>null</code> and either
     * <code>sourceRegion.x</code> or <code>sourceRegion.y</code> is
     * negative.
     * @exception IllegalArgumentException if
     * <code>sourceRegion</code> is non-<code>null</code> and either
     * <code>sourceRegion.width</code> or
     * <code>sourceRegion.height</code> is negative or 0.
     * @exception IllegalStateException if subsampling is such that
     * this region will have a subsampled width or height of zero.
     * @see #getSourceRegion
     * @see #setSourceSubsampling
     * @see ImageReadParam#setDestinationOffset
     * @see ImageReadParam#getDestinationOffset
     */
public void setSourceRegion(Rectangle sourceRegion) {
    if (sourceRegion == null) {
        this.sourceRegion = null;
        return;
    }
    if (sourceRegion.x < 0) {
        throw new IllegalArgumentException('sourceRegion.x < 0!');
    }
    if (sourceRegion.y < 0) {
        throw new IllegalArgumentException('sourceRegion.y < 0!');
    }
    if (sourceRegion.width <= 0) {
        throw new IllegalArgumentException('sourceRegion.width <= 0!');
    }
    if (sourceRegion.height <= 0) {
        throw new IllegalArgumentException('sourceRegion.height <= 0!');
    }
    if (sourceRegion.width <= subsamplingXOffset) {
        throw new IllegalStateException('sourceRegion.width <= subsamplingXOffset!');
    }
    if (sourceRegion.height <= subsamplingYOffset) {
        throw new IllegalStateException('sourceRegion.height <= subsamplingYOffset!');
    }
    this.sourceRegion = (Rectangle) sourceRegion.clone();
}

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

java.io.ObjectOutputStream.useProtocolVersion(int)

/**
     * Specify stream protocol version to use when writing the stream.
     * This routine provides a hook to enable the current version of
     * Serialization to write in a format that is backwards compatible to a
     * previous version of the stream format.
     * Every effort will be made to avoid introducing additional
     * backwards incompatibilities; however, sometimes there is no
     * other alternative.
     * @param version use ProtocolVersion from java.io.ObjectStreamConstants.
     * @throws IllegalStateException if called after any objects
     *   have been serialized.
     * @throws IllegalArgumentException if invalid version is passed in.
     * @throws IOException if I/O errors occur
     * @see java.io.ObjectStreamConstants#PROTOCOL_VERSION_1
     * @see java.io.ObjectStreamConstants#PROTOCOL_VERSION_2
     * @since 1.2
     */
public void useProtocolVersion(int version) throws IOException {
    if (handles.size() != 0) {
        throw new IllegalStateException('stream non-empty');
    }
    switch(version) {
        case PROTOCOL_VERSION_1:
        case PROTOCOL_VERSION_2:
            protocol = version;
            break;
        default:
            throw new IllegalArgumentException('unknown version: ' + version);
    }
}

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

java.util.zip.ZipFile.ensureOpen()

private void ensureOpen() {
    if (closeRequested) {
        throw new IllegalStateException('zip file closed');
    }
}

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

SocketException

java.net.SocketException SocketException is described in the javadoc comments as: Thrown to indicate that there is an error in the underlying protocol, such as a TCP error. author: Jonathan Payne version: 1.17, 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.net.SocketException: ... ' is thrown within the method: java.net.ServerSocket.createImpl() The message ' java.net.SocketException: ... ' is thrown within the method: java.net.Socket.createImpl(boolean) The message ' java.net.SocketException: ... ' is thrown within the method: java.net.SocksSocketImpl.connect(SocketAddress, int) The message ' java.net.SocketException: ... ' is thrown within the method: java.net.SocksSocketImpl.socksBind(InetSocketAddress) The message