Skip to main content

BufferUnderflowException

java.nio.BufferUnderflowException

BufferUnderflowException is described in the javadoc comments as:

Unchecked exception thrown when a relative get operation reaches the source buffer's limit.
version: 1.14, 01/05/02 since: 1.4

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.

java.nio.Buffer.nextGetIndex()

/**
     * Checks the current position against the limit, throwing a {@link
     * BufferUnderflowException} if it is not smaller than the limit, and then
     * increments the position. 
     * @return  The current position value, before it is incremented
     */
final int nextGetIndex() {
    if (position >= limit) throw new BufferUnderflowException();
    return position++;
}

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

java.nio.Buffer.nextGetIndex(int)

final int nextGetIndex(int nb) {
    if (limit - position < nb) throw new BufferUnderflowException();
    int p = position;
    position += nb;
    return p;
}

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

java.nio.ByteBuffer.get(byte[], int, int)

/**
     * Relative bulk <i>get</i> method.
     *  This method transfers bytes from this buffer into the given
     * destination array.  If there are fewer bytes remaining in the
     * buffer than are required to satisfy the request, that is, if
     * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no
     * bytes are transferred and a {@link BufferUnderflowException} is
     * thrown.
     *  Otherwise, this method copies <tt>length</tt> bytes from this
     * buffer into the given array, starting at the current position of this
     * buffer and at the given offset in the array.  The position of this
     * buffer is then incremented by <tt>length</tt>.
     *  In other words, an invocation of this method of the form
     * <tt>src.get(dst, off, len)</tt> has exactly the same effect as
     * the loop
     * 
     *     for (int i = off; i < off + len; i++)
     *         dst[i] = src.get(); 
     * except that it first checks that there are sufficient bytes in
     * this buffer and it is potentially much more efficient. 
     * @param  dst
     *         The array into which bytes are to be written
     * @param  offset
     *         The offset within the array of the first byte to be
     *         written; must be non-negative and no larger than
     *         <tt>dst.length</tt>
     * @param  length
     *         The maximum number of bytes to be written to the given
     *         array; must be non-negative and no larger than
     *         <tt>dst.length - offset</tt>
     * @return  This buffer
     * @throws  BufferUnderflowException
     *          If there are fewer than <tt>length</tt> bytes
     *          remaining in this buffer
     * @throws  IndexOutOfBoundsException
     *          If the preconditions on the <tt>offset</tt> and <tt>length</tt>
     *          parameters do not hold
     */
public ByteBuffer get(byte[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    int end = offset + length;
    for (int i = offset; i < end; i++) dst[i] = get();
    return this;
}

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

java.nio.CharBuffer.get(char[], int, int)

/**
     * Relative bulk <i>get</i> method.
     *  This method transfers characters from this buffer into the given
     * destination array.  If there are fewer characters remaining in the
     * buffer than are required to satisfy the request, that is, if
     * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no
     * characters are transferred and a {@link BufferUnderflowException} is
     * thrown.
     *  Otherwise, this method copies <tt>length</tt> characters from this
     * buffer into the given array, starting at the current position of this
     * buffer and at the given offset in the array.  The position of this
     * buffer is then incremented by <tt>length</tt>.
     *  In other words, an invocation of this method of the form
     * <tt>src.get(dst, off, len)</tt> has exactly the same effect as
     * the loop
     * 
     *     for (int i = off; i < off + len; i++)
     *         dst[i] = src.get(); 
     * except that it first checks that there are sufficient characters in
     * this buffer and it is potentially much more efficient. 
     * @param  dst
     *         The array into which characters are to be written
     * @param  offset
     *         The offset within the array of the first character to be
     *         written; must be non-negative and no larger than
     *         <tt>dst.length</tt>
     * @param  length
     *         The maximum number of characters to be written to the given
     *         array; must be non-negative and no larger than
     *         <tt>dst.length - offset</tt>
     * @return  This buffer
     * @throws  BufferUnderflowException
     *          If there are fewer than <tt>length</tt> characters
     *          remaining in this buffer
     * @throws  IndexOutOfBoundsException
     *          If the preconditions on the <tt>offset</tt> and <tt>length</tt>
     *          parameters do not hold
     */
public CharBuffer get(char[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    int end = offset + length;
    for (int i = offset; i < end; i++) dst[i] = get();
    return this;
}

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

java.nio.DirectByteBuffer.get(byte[], int, int)

public ByteBuffer get(byte[] dst, int offset, int length) {
    if ((length << 0) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToByteArray(ix(pos), dst, offset << 0, length << 0); else Bits.copyToByteArray(ix(pos), dst, offset << 0, length << 0);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectCharBufferS.get(char[], int, int)

public CharBuffer get(char[] dst, int offset, int length) {
    if ((length << 1) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToCharArray(ix(pos), dst, offset << 1, length << 1); else Bits.copyToByteArray(ix(pos), dst, offset << 1, length << 1);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectCharBufferU.get(char[], int, int)

public CharBuffer get(char[] dst, int offset, int length) {
    if ((length << 1) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToCharArray(ix(pos), dst, offset << 1, length << 1); else Bits.copyToByteArray(ix(pos), dst, offset << 1, length << 1);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectDoubleBufferS.get(double[], int, int)

public DoubleBuffer get(double[] dst, int offset, int length) {
    if ((length << 3) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToLongArray(ix(pos), dst, offset << 3, length << 3); else Bits.copyToByteArray(ix(pos), dst, offset << 3, length << 3);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectDoubleBufferU.get(double[], int, int)

public DoubleBuffer get(double[] dst, int offset, int length) {
    if ((length << 3) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToLongArray(ix(pos), dst, offset << 3, length << 3); else Bits.copyToByteArray(ix(pos), dst, offset << 3, length << 3);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectFloatBufferS.get(float[], int, int)

public FloatBuffer get(float[] dst, int offset, int length) {
    if ((length << 2) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToIntArray(ix(pos), dst, offset << 2, length << 2); else Bits.copyToByteArray(ix(pos), dst, offset << 2, length << 2);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectFloatBufferU.get(float[], int, int)

public FloatBuffer get(float[] dst, int offset, int length) {
    if ((length << 2) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToIntArray(ix(pos), dst, offset << 2, length << 2); else Bits.copyToByteArray(ix(pos), dst, offset << 2, length << 2);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectIntBufferS.get(int[], int, int)

public IntBuffer get(int[] dst, int offset, int length) {
    if ((length << 2) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToIntArray(ix(pos), dst, offset << 2, length << 2); else Bits.copyToByteArray(ix(pos), dst, offset << 2, length << 2);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectIntBufferU.get(int[], int, int)

public IntBuffer get(int[] dst, int offset, int length) {
    if ((length << 2) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToIntArray(ix(pos), dst, offset << 2, length << 2); else Bits.copyToByteArray(ix(pos), dst, offset << 2, length << 2);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectLongBufferS.get(long[], int, int)

public LongBuffer get(long[] dst, int offset, int length) {
    if ((length << 3) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToLongArray(ix(pos), dst, offset << 3, length << 3); else Bits.copyToByteArray(ix(pos), dst, offset << 3, length << 3);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectLongBufferU.get(long[], int, int)

public LongBuffer get(long[] dst, int offset, int length) {
    if ((length << 3) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToLongArray(ix(pos), dst, offset << 3, length << 3); else Bits.copyToByteArray(ix(pos), dst, offset << 3, length << 3);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectShortBufferS.get(short[], int, int)

public ShortBuffer get(short[] dst, int offset, int length) {
    if ((length << 1) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToShortArray(ix(pos), dst, offset << 1, length << 1); else Bits.copyToByteArray(ix(pos), dst, offset << 1, length << 1);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DirectShortBufferU.get(short[], int, int)

public ShortBuffer get(short[] dst, int offset, int length) {
    if ((length << 1) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
        checkBounds(offset, length, dst.length);
        int pos = position();
        int lim = limit();
        assert (pos <= lim);
        int rem = (pos <= lim ? lim - pos : 0);
        if (length > rem) throw new BufferUnderflowException();
        if (order() != ByteOrder.nativeOrder()) Bits.copyToShortArray(ix(pos), dst, offset << 1, length << 1); else Bits.copyToByteArray(ix(pos), dst, offset << 1, length << 1);
        position(pos + length);
    } else {
        super.get(dst, offset, length);
    }
    return this;
}

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

java.nio.DoubleBuffer.get(double[], int, int)

/**
     * Relative bulk <i>get</i> method.
     *  This method transfers doubles from this buffer into the given
     * destination array.  If there are fewer doubles remaining in the
     * buffer than are required to satisfy the request, that is, if
     * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no
     * doubles are transferred and a {@link BufferUnderflowException} is
     * thrown.
     *  Otherwise, this method copies <tt>length</tt> doubles from this
     * buffer into the given array, starting at the current position of this
     * buffer and at the given offset in the array.  The position of this
     * buffer is then incremented by <tt>length</tt>.
     *  In other words, an invocation of this method of the form
     * <tt>src.get(dst, off, len)</tt> has exactly the same effect as
     * the loop
     * 
     *     for (int i = off; i < off + len; i++)
     *         dst[i] = src.get(); 
     * except that it first checks that there are sufficient doubles in
     * this buffer and it is potentially much more efficient. 
     * @param  dst
     *         The array into which doubles are to be written
     * @param  offset
     *         The offset within the array of the first double to be
     *         written; must be non-negative and no larger than
     *         <tt>dst.length</tt>
     * @param  length
     *         The maximum number of doubles to be written to the given
     *         array; must be non-negative and no larger than
     *         <tt>dst.length - offset</tt>
     * @return  This buffer
     * @throws  BufferUnderflowException
     *          If there are fewer than <tt>length</tt> doubles
     *          remaining in this buffer
     * @throws  IndexOutOfBoundsException
     *          If the preconditions on the <tt>offset</tt> and <tt>length</tt>
     *          parameters do not hold
     */
public DoubleBuffer get(double[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    int end = offset + length;
    for (int i = offset; i < end; i++) dst[i] = get();
    return this;
}

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

java.nio.FloatBuffer.get(float[], int, int)

/**
     * Relative bulk <i>get</i> method.
     *  This method transfers floats from this buffer into the given
     * destination array.  If there are fewer floats remaining in the
     * buffer than are required to satisfy the request, that is, if
     * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no
     * floats are transferred and a {@link BufferUnderflowException} is
     * thrown.
     *  Otherwise, this method copies <tt>length</tt> floats from this
     * buffer into the given array, starting at the current position of this
     * buffer and at the given offset in the array.  The position of this
     * buffer is then incremented by <tt>length</tt>.
     *  In other words, an invocation of this method of the form
     * <tt>src.get(dst, off, len)</tt> has exactly the same effect as
     * the loop
     * 
     *     for (int i = off; i < off + len; i++)
     *         dst[i] = src.get(); 
     * except that it first checks that there are sufficient floats in
     * this buffer and it is potentially much more efficient. 
     * @param  dst
     *         The array into which floats are to be written
     * @param  offset
     *         The offset within the array of the first float to be
     *         written; must be non-negative and no larger than
     *         <tt>dst.length</tt>
     * @param  length
     *         The maximum number of floats to be written to the given
     *         array; must be non-negative and no larger than
     *         <tt>dst.length - offset</tt>
     * @return  This buffer
     * @throws  BufferUnderflowException
     *          If there are fewer than <tt>length</tt> floats
     *          remaining in this buffer
     * @throws  IndexOutOfBoundsException
     *          If the preconditions on the <tt>offset</tt> and <tt>length</tt>
     *          parameters do not hold
     */
public FloatBuffer get(float[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    int end = offset + length;
    for (int i = offset; i < end; i++) dst[i] = get();
    return this;
}

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

java.nio.HeapByteBuffer.get(byte[], int, int)

public ByteBuffer get(byte[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    System.arraycopy(hb, ix(position()), dst, offset, length);
    position(position() + length);
    return this;
}

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

java.nio.HeapCharBuffer.get(char[], int, int)

public CharBuffer get(char[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    System.arraycopy(hb, ix(position()), dst, offset, length);
    position(position() + length);
    return this;
}

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

java.nio.HeapDoubleBuffer.get(double[], int, int)

public DoubleBuffer get(double[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    System.arraycopy(hb, ix(position()), dst, offset, length);
    position(position() + length);
    return this;
}

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

java.nio.HeapFloatBuffer.get(float[], int, int)

public FloatBuffer get(float[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    System.arraycopy(hb, ix(position()), dst, offset, length);
    position(position() + length);
    return this;
}

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

java.nio.HeapIntBuffer.get(int[], int, int)

public IntBuffer get(int[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    System.arraycopy(hb, ix(position()), dst, offset, length);
    position(position() + length);
    return this;
}

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

java.nio.HeapLongBuffer.get(long[], int, int)

public LongBuffer get(long[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    System.arraycopy(hb, ix(position()), dst, offset, length);
    position(position() + length);
    return this;
}

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

java.nio.HeapShortBuffer.get(short[], int, int)

public ShortBuffer get(short[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    System.arraycopy(hb, ix(position()), dst, offset, length);
    position(position() + length);
    return this;
}

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

java.nio.IntBuffer.get(int[], int, int)

/**
     * Relative bulk <i>get</i> method.
     *  This method transfers ints from this buffer into the given
     * destination array.  If there are fewer ints remaining in the
     * buffer than are required to satisfy the request, that is, if
     * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no
     * ints are transferred and a {@link BufferUnderflowException} is
     * thrown.
     *  Otherwise, this method copies <tt>length</tt> ints from this
     * buffer into the given array, starting at the current position of this
     * buffer and at the given offset in the array.  The position of this
     * buffer is then incremented by <tt>length</tt>.
     *  In other words, an invocation of this method of the form
     * <tt>src.get(dst, off, len)</tt> has exactly the same effect as
     * the loop
     * 
     *     for (int i = off; i < off + len; i++)
     *         dst[i] = src.get(); 
     * except that it first checks that there are sufficient ints in
     * this buffer and it is potentially much more efficient. 
     * @param  dst
     *         The array into which ints are to be written
     * @param  offset
     *         The offset within the array of the first int to be
     *         written; must be non-negative and no larger than
     *         <tt>dst.length</tt>
     * @param  length
     *         The maximum number of ints to be written to the given
     *         array; must be non-negative and no larger than
     *         <tt>dst.length - offset</tt>
     * @return  This buffer
     * @throws  BufferUnderflowException
     *          If there are fewer than <tt>length</tt> ints
     *          remaining in this buffer
     * @throws  IndexOutOfBoundsException
     *          If the preconditions on the <tt>offset</tt> and <tt>length</tt>
     *          parameters do not hold
     */
public IntBuffer get(int[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    int end = offset + length;
    for (int i = offset; i < end; i++) dst[i] = get();
    return this;
}

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

java.nio.LongBuffer.get(long[], int, int)

/**
     * Relative bulk <i>get</i> method.
     *  This method transfers longs from this buffer into the given
     * destination array.  If there are fewer longs remaining in the
     * buffer than are required to satisfy the request, that is, if
     * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no
     * longs are transferred and a {@link BufferUnderflowException} is
     * thrown.
     *  Otherwise, this method copies <tt>length</tt> longs from this
     * buffer into the given array, starting at the current position of this
     * buffer and at the given offset in the array.  The position of this
     * buffer is then incremented by <tt>length</tt>.
     *  In other words, an invocation of this method of the form
     * <tt>src.get(dst, off, len)</tt> has exactly the same effect as
     * the loop
     * 
     *     for (int i = off; i < off + len; i++)
     *         dst[i] = src.get(); 
     * except that it first checks that there are sufficient longs in
     * this buffer and it is potentially much more efficient. 
     * @param  dst
     *         The array into which longs are to be written
     * @param  offset
     *         The offset within the array of the first long to be
     *         written; must be non-negative and no larger than
     *         <tt>dst.length</tt>
     * @param  length
     *         The maximum number of longs to be written to the given
     *         array; must be non-negative and no larger than
     *         <tt>dst.length - offset</tt>
     * @return  This buffer
     * @throws  BufferUnderflowException
     *          If there are fewer than <tt>length</tt> longs
     *          remaining in this buffer
     * @throws  IndexOutOfBoundsException
     *          If the preconditions on the <tt>offset</tt> and <tt>length</tt>
     *          parameters do not hold
     */
public LongBuffer get(long[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    int end = offset + length;
    for (int i = offset; i < end; i++) dst[i] = get();
    return this;
}

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

java.nio.ShortBuffer.get(short[], int, int)

/**
     * Relative bulk <i>get</i> method.
     *  This method transfers shorts from this buffer into the given
     * destination array.  If there are fewer shorts remaining in the
     * buffer than are required to satisfy the request, that is, if
     * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no
     * shorts are transferred and a {@link BufferUnderflowException} is
     * thrown.
     *  Otherwise, this method copies <tt>length</tt> shorts from this
     * buffer into the given array, starting at the current position of this
     * buffer and at the given offset in the array.  The position of this
     * buffer is then incremented by <tt>length</tt>.
     *  In other words, an invocation of this method of the form
     * <tt>src.get(dst, off, len)</tt> has exactly the same effect as
     * the loop
     * 
     *     for (int i = off; i < off + len; i++)
     *         dst[i] = src.get(); 
     * except that it first checks that there are sufficient shorts in
     * this buffer and it is potentially much more efficient. 
     * @param  dst
     *         The array into which shorts are to be written
     * @param  offset
     *         The offset within the array of the first short to be
     *         written; must be non-negative and no larger than
     *         <tt>dst.length</tt>
     * @param  length
     *         The maximum number of shorts to be written to the given
     *         array; must be non-negative and no larger than
     *         <tt>dst.length - offset</tt>
     * @return  This buffer
     * @throws  BufferUnderflowException
     *          If there are fewer than <tt>length</tt> shorts
     *          remaining in this buffer
     * @throws  IndexOutOfBoundsException
     *          If the preconditions on the <tt>offset</tt> and <tt>length</tt>
     *          parameters do not hold
     */
public ShortBuffer get(short[] dst, int offset, int length) {
    checkBounds(offset, length, dst.length);
    if (length > remaining()) throw new BufferUnderflowException();
    int end = offset + length;
    for (int i = offset; i < end; i++) dst[i] = get();
    return this;
}

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

java.nio.charset.CoderResult.throwException()

/**
     * Throws an exception appropriate to the result described by this object.
     *
     * @throws  BufferUnderflowException
     *          If this object is {@link #UNDERFLOW}
     * @throws  BufferOverflowException
     *          If this object is {@link #OVERFLOW}
     * @throws  MalformedInputException
     *          If this object represents a malformed-input error; the
     *          exception's length value will be that of this object
     * @throws  UnmappableCharacterException
     *          If this object represents an unmappable-character error; the
     *          exceptions length value will be that of this object
     */
public void throwException() throws CharacterCodingException {
    switch(type) {
        case CR_UNDERFLOW:
            throw new BufferUnderflowException();
        case CR_OVERFLOW:
            throw new BufferOverflowException();
        case CR_MALFORMED:
            throw new MalformedInputException(length);
        case CR_UNMAPPABLE:
            throw new UnmappableCharacterException(length);
        default:
            assert false;
    }
}

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

BAD_CERTIFICATE - A corrupt or unuseable certificate...

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators.
Symptom
In wls_utc, when trying to test a webservice using SSL, the following error message is received: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.
If SSL debugging is enabled, the following error also appears in the logs: ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)' <1254822672320>>
verification failed because RSA key public exponent [3] is too small
Cause
The certificate encryption is of a weaker strength than expected by newer versions of Java.
Solution
Add the flag "-Dweblogic.security.SSL.allowSmallRSAExponent=true" to the server startup parameters.
References


None.

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 router to destination) is a kind of "catch…

BEASVC.EXE - WebLogic as a Windows Service

I remember the first time I had to work out why WebLogic wouldn't run as a service. It was a frustrating experience. There were no error messages. No Windows error dialog. No console output.

How do you troubleshoot something like this??!!

This short article will show you. For simplicity I'll talk about the node manager, but the same principles apply for running an admin or managed server as a service.

First Steps

First, you still have your server logs. Sure the console output is better, but it's a starting point. Check this log for errors and especially take note of the start up variables such as PATH and CLASSPATH. If the server log isn't being created, that tells you WebLogic probably isn't even being started. (Check that you have a license file if you haven't already.)

Ok, so the logs were no help. The next step is to look at how the service is trying to start WebLogic.

When you install WebLogic as a service, you're really setting up beasvc.exe as the service.…