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

NullPointerException

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

Connection refused: No available router to destination

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

Recovering WebLogic Passwords

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