Skip to main content

BerException

com.sun.jmx.snmp.BerException

BerException is described in the javadoc comments as:

Exception thrown when a BER encoding/decoding error occurs.

This API is a Sun Microsystems internal API and is subject to change without notice.


version: 4.12 12/19/03 author: Sun Microsystems, Inc since: 1.5

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.jmx.snmp.BerDecoder.closeSequence()

/**
  * Close a sequence.
  * The decode pull the stack and verifies that the current position
  * matches with the calculated end of the sequence. If not it throws
  * an exception.
  * @exception BerException The sequence is not expected to finish here.
  */
public void closeSequence() throws BerException {
    if (stackBuf[stackTop - 1] == next) {
        stackTop--;
    } else {
        throw new BerException();
    }
}

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.BerDecoder.fetchAny()

/**
  * Fetch an <CODE>ANY</CODE> value. In fact, this method does not decode anything
  * it simply returns the next TLV as an array of bytes.
  * @return The TLV as a byte array.
  * @exception BerException The next TLV is really badly encoded...
  */
public byte[] fetchAny() throws BerException {
    byte[] result = null;
    final int backup = next;
    try {
        final int tag = fetchTag();
        final int contentLength = fetchLength();
        if (contentLength < 0) throw new BerException();
        final int tlvLength = next + contentLength - backup;
        if (contentLength > (bytes.length - next)) throw new IndexOutOfBoundsException('Decoded length exceeds buffer');
        final byte[] data = new byte[tlvLength];
        java.lang.System.arraycopy(bytes, backup, data, 0, tlvLength);
        next = next + contentLength;
        result = data;
    } catch (IndexOutOfBoundsException e) {
        next = backup;
        throw new BerException();
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchAny(int)

/**
  * Fetch an <CODE>ANY</CODE> value with a specific tag.
  * @param tag The expected tag.
  * @return The TLV as a byte array.
  * @exception BerException The next TLV is really badly encoded...
  */
public byte[] fetchAny(int tag) throws BerException {
    if (getTag() != tag) {
        throw new BerException();
    }
    return fetchAny();
}

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.BerDecoder.fetchInteger(int)

/**
  * Fetch an integer with the specified tag.
  * @param tag The expected tag.
  * @return The decoded integer.
  * @exception BerException Current position does not point to an integer
  *                         or the tag is not the expected one.
  */
public int fetchInteger(int tag) throws BerException {
    int result = 0;
    final int backup = next;
    try {
        if (fetchTag() != tag) {
            throw new BerException();
        }
        result = fetchIntegerValue();
    } catch (BerException e) {
        next = backup;
        throw e;
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchIntegerAsLong(int)

/**
  * Fetch an integer with the specified tag and return a long value.
  * @param tag The expected tag.
  * @return The decoded integer.
  * @exception BerException Current position does not point to an integer
  *                         or the tag is not the expected one.
  */
public long fetchIntegerAsLong(int tag) throws BerException {
    long result = 0;
    final int backup = next;
    try {
        if (fetchTag() != tag) {
            throw new BerException();
        }
        result = fetchIntegerValueAsLong();
    } catch (BerException e) {
        next = backup;
        throw e;
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchIntegerValue()

/**
  * Fetch an integer value and move the current position forward.
  * @return The integer
  */
private int fetchIntegerValue() throws BerException {
    int result = 0;
    final int backup = next;
    try {
        final int length = fetchLength();
        if (length <= 0) throw new BerException();
        if (length > (bytes.length - next)) throw new IndexOutOfBoundsException('Decoded length exceeds buffer');
        final int end = next + length;
        result = bytes[next++];
        while (next < end) {
            final byte b = bytes[next++];
            if (b < 0) {
                result = (result << 8) | (256 + b);
            } else {
                result = (result << 8) | b;
            }
        }
    } catch (BerException e) {
        next = backup;
        throw e;
    } catch (IndexOutOfBoundsException e) {
        next = backup;
        throw new BerException();
    } catch (ArithmeticException e) {
        next = backup;
        throw new BerException();
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchIntegerValueAsLong()

/**
  * Fetch an integer value and return a long value.
  * FIX ME: someday we could have only on fetchIntegerValue() which always
  * returns a long value.
  * @return The integer
  */
private final long fetchIntegerValueAsLong() throws BerException {
    long result = 0;
    final int backup = next;
    try {
        final int length = fetchLength();
        if (length <= 0) throw new BerException();
        if (length > (bytes.length - next)) throw new IndexOutOfBoundsException('Decoded length exceeds buffer');
        final int end = next + length;
        result = bytes[next++];
        while (next < end) {
            final byte b = bytes[next++];
            if (b < 0) {
                result = (result << 8) | (256 + b);
            } else {
                result = (result << 8) | b;
            }
        }
    } catch (BerException e) {
        next = backup;
        throw e;
    } catch (IndexOutOfBoundsException e) {
        next = backup;
        throw new BerException();
    } catch (ArithmeticException e) {
        next = backup;
        throw new BerException();
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchLength()

/**
  * Fetch a length and move the current position forward.
  * @return The length
  */
private final int fetchLength() throws BerException {
    int result = 0;
    final int backup = next;
    try {
        final byte b0 = bytes[next++];
        if (b0 >= 0) {
            result = b0;
        } else {
            for (int c = 128 + b0; c > 0; c--) {
                final byte bX = bytes[next++];
                result = result << 8;
                result = result | ((bX >= 0) ? bX : bX + 256);
            }
        }
    } catch (IndexOutOfBoundsException e) {
        next = backup;
        throw new BerException();
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchNull(int)

/**
  * Fetch a <CODE>NULL</CODE> value with a specified tag.
  * @param tag The expected tag.
  * @exception BerException Current position does not point to 
  *            <CODE>NULL</CODE> value or the tag is not the expected one.
  */
public void fetchNull(int tag) throws BerException {
    final int backup = next;
    try {
        if (fetchTag() != tag) {
            throw new BerException();
        }
        final int length = fetchLength();
        if (length != 0) throw new BerException();
    } catch (BerException e) {
        next = backup;
        throw e;
    }
}

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.BerDecoder.fetchOctetString(int)

/**
  * Fetch an octet string with a specified tag.
  * @param tag The expected tag.
  * @return The decoded string.
  * @exception BerException Current position does not point to an octet string
  *                         or the tag is not the expected one.
  */
public byte[] fetchOctetString(int tag) throws BerException {
    byte[] result = null;
    final int backup = next;
    try {
        if (fetchTag() != tag) {
            throw new BerException();
        }
        result = fetchStringValue();
    } catch (BerException e) {
        next = backup;
        throw e;
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchOid(int)

/**
  * Fetch an object identifier with a specified tag.
  * @param tag The expected tag.
  * @return The decoded object identifier as an array of long.
  * @exception BerException Current position does not point to an oid
  *                         or the tag is not the expected one.
  */
public long[] fetchOid(int tag) throws BerException {
    long[] result = null;
    final int backup = next;
    try {
        if (fetchTag() != tag) {
            throw new BerException();
        }
        result = fetchOidValue();
    } catch (BerException e) {
        next = backup;
        throw e;
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchOidValue()

/**
  * Fetch an oid and move the current position forward.
  * @return The oid
  */
private final long[] fetchOidValue() throws BerException {
    long[] result = null;
    final int backup = next;
    try {
        final int length = fetchLength();
        if (length <= 0) throw new BerException();
        if (length > (bytes.length - next)) throw new IndexOutOfBoundsException('Decoded length exceeds buffer');
        int subidCount = 2;
        for (int i = 1; i < length; i++) {
            if ((bytes[next + i] & 0x80) == 0) {
                subidCount++;
            }
        }
        final int datalen = subidCount;
        final long[] data = new long[datalen];
        final byte b0 = bytes[next++];
        if (b0 < 0) throw new BerException();
        final long lb0 = b0 / 40;
        if (lb0 > 2) throw new BerException();
        final long lb1 = b0 % 40;
        data[0] = lb0;
        data[1] = lb1;
        int i = 2;
        while (i < datalen) {
            long subid = 0;
            byte b = bytes[next++];
            while ((b & 0x80) != 0) {
                subid = (subid << 7) | (b & 0x7f);
                if (subid < 0) throw new BerException();
                b = bytes[next++];
            }
            subid = (subid << 7) | b;
            if (subid < 0) throw new BerException();
            data[i++] = subid;
        }
        result = data;
    } catch (BerException e) {
        next = backup;
        throw e;
    } catch (IndexOutOfBoundsException e) {
        next = backup;
        throw new BerException();
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchStringValue()

/**
  * Fetch a byte string and move the current position forward.
  * @return The byte string
  */
private byte[] fetchStringValue() throws BerException {
    byte[] result = null;
    final int backup = next;
    try {
        final int length = fetchLength();
        if (length < 0) throw new BerException();
        if (length > (bytes.length - next)) throw new IndexOutOfBoundsException('Decoded length exceeds buffer');
        final byte data[] = new byte[length];
        java.lang.System.arraycopy(bytes, next, data, 0, length);
        next += length;
        result = data;
    } catch (BerException e) {
        next = backup;
        throw e;
    } catch (IndexOutOfBoundsException e) {
        next = backup;
        throw new BerException();
    } catch (ArithmeticException e) {
        next = backup;
        throw new BerException();
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.fetchTag()

/**
  * Fetch a tag and move the current position forward.
  * @return The tag
  */
private final int fetchTag() throws BerException {
    int result = 0;
    final int backup = next;
    try {
        final byte b0 = bytes[next++];
        result = (b0 >= 0) ? b0 : b0 + 256;
        if ((result & 31) == 31) {
            while ((bytes[next] & 128) != 0) {
                result = result << 7;
                result = result | (bytes[next++] & 127);
            }
        }
    } catch (IndexOutOfBoundsException e) {
        next = backup;
        throw new BerException();
    }
    return result;
}

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

com.sun.jmx.snmp.BerDecoder.openSequence(int)

/**
  * Fetch a sequence header with a specific tag.
  * @param tag The expected tag.
  * @exception BerException Current position does not point to a sequence header
  *                         or the tag is not the expected one.
  */
public void openSequence(int tag) throws BerException {
    final int backup = next;
    try {
        if (fetchTag() != tag) {
            throw new BerException();
        }
        final int l = fetchLength();
        if (l < 0) throw new BerException();
        if (l > (bytes.length - next)) throw new BerException();
        stackBuf[stackTop++] = next + l;
    } catch (BerException e) {
        next = backup;
        throw e;
    }
}

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.SnmpMsg.decodeVarBindValue(BerDecoder)

/**
     * For SNMP Runtime private use only.
     */
SnmpValue decodeVarBindValue(BerDecoder bdec) throws BerException {
    SnmpValue result = null;
    int tag = bdec.getTag();
    switch(tag) {
        case BerDecoder.IntegerTag:
            try {
                result = new SnmpInt(bdec.fetchInteger());
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case BerDecoder.OctetStringTag:
            try {
                result = new SnmpString(bdec.fetchOctetString());
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case BerDecoder.OidTag:
            try {
                result = new SnmpOid(bdec.fetchOid());
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case BerDecoder.NullTag:
            bdec.fetchNull();
            try {
                result = new SnmpNull();
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case SnmpValue.IpAddressTag:
            try {
                result = new SnmpIpAddress(bdec.fetchOctetString(tag));
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case SnmpValue.CounterTag:
            try {
                result = new SnmpCounter(bdec.fetchIntegerAsLong(tag));
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case SnmpValue.GaugeTag:
            try {
                result = new SnmpGauge(bdec.fetchIntegerAsLong(tag));
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case SnmpValue.TimeticksTag:
            try {
                result = new SnmpTimeticks(bdec.fetchIntegerAsLong(tag));
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case SnmpValue.OpaqueTag:
            try {
                result = new SnmpOpaque(bdec.fetchOctetString(tag));
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case SnmpValue.Counter64Tag:
            if (version == snmpVersionOne) {
                throw new BerException(BerException.BAD_VERSION);
            }
            try {
                result = new SnmpCounter64(bdec.fetchIntegerAsLong(tag));
            } catch (RuntimeException r) {
                throw new BerException();
            }
            break;
        case SnmpVarBind.errNoSuchObjectTag:
            if (version == snmpVersionOne) {
                throw new BerException(BerException.BAD_VERSION);
            }
            bdec.fetchNull(tag);
            result = SnmpVarBind.noSuchObject;
            break;
        case SnmpVarBind.errNoSuchInstanceTag:
            if (version == snmpVersionOne) {
                throw new BerException(BerException.BAD_VERSION);
            }
            bdec.fetchNull(tag);
            result = SnmpVarBind.noSuchInstance;
            break;
        case SnmpVarBind.errEndOfMibViewTag:
            if (version == snmpVersionOne) {
                throw new BerException(BerException.BAD_VERSION);
            }
            bdec.fetchNull(tag);
            result = SnmpVarBind.endOfMibView;
            break;
        default:
            throw new BerException();
    }
    return result;
}

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

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…

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.

WebLogic Admin Console

WebLogic Admin Console
The WebLogic Admin Console is a web-based, user interface used to configure and control a set of WebLogic servers or clusters (i.e. a "domain"). In any logical group of WebLogic servers there must exist one admin server, which hosts the WebLogic Admin Console application and manages the associated configuration files.
WebLogic Administrators will use the Administration Console for a number of tasks, including:
Starting and stopping WebLogic servers or entire clusters.Configuring server parameters, security, database connections and deployed applications.Viewing server status, health and metrics. Note: It is not strictly necessary to use the Weblogic Admin Console to perform these tasks, as they can be scripted using WLST (the WebLogic Scripting Tool).
Accessing the Admin Console
WebLogic Admin Console Url: http://hostname:port/console.
To access the WebLogic Administration Console, assuming the admin server has been started, goto the above url. Where hostname…