Skip to main content

SnmpTooBigException

com.sun.jmx.snmp.SnmpTooBigException

SnmpTooBigException is described in the javadoc comments as:

Is used internally to signal that the size of a PDU exceeds the packet size limitation.

You will not usually need to use this class, except if you decide to implement your own {link: com.sun.jmx.snmp.SnmpPduFactory SnmPduFactory} object.

The varBindCount property contains the number of SnmpVarBind successfully encoded before the exception was thrown. Its value is 0 when this number is unknown.

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


version: 1.1 07/23/98 author: Sun Microsystems, Inc

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.SnmpMessage.encodeMessage(byte[])

/**
     * Encodes this message and puts the result in the specified byte array.
     * For internal use only.
     * @param outputBytes An array to receive the resulting encoding.
     * @exception ArrayIndexOutOfBoundsException If the result does not fit
     *                                           into the specified array.
     */
public int encodeMessage(byte[] outputBytes) throws SnmpTooBigException {
    int encodingLength = 0;
    if (data == null) throw new IllegalArgumentException('Data field is null');
    try {
        BerEncoder benc = new BerEncoder(outputBytes);
        benc.openSequence();
        benc.putAny(data, dataLength);
        benc.putOctetString((community != null) ? community : new byte[0]);
        benc.putInteger(version);
        benc.closeSequence();
        encodingLength = benc.trim();
    } catch (ArrayIndexOutOfBoundsException x) {
        throw new SnmpTooBigException();
    }
    return encodingLength;
}

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.SnmpMessage.encodeSnmpPdu(SnmpPdu, int)

/**
     * Initializes this message with the specified <CODE>pdu</CODE>.
     * <P>
     * This method initializes the data field with an array of 
     * <CODE>maxDataLength</CODE> bytes. It encodes the <CODE>pdu</CODE>. 
     * The resulting encoding is stored in the data field
     * and the length of the encoding is stored in <CODE>dataLength</CODE>.
     * If the encoding length exceeds <CODE>maxDataLength</CODE>, 
     * the method throws an exception.
     * @param pdu The PDU to be encoded.
     * @param maxDataLength The maximum length permitted for the data field.
     * @exception SnmpStatusException If the specified <CODE>pdu</CODE> is not valid.
     * @exception SnmpTooBigException If the resulting encoding does not fit
     * into <CODE>maxDataLength</CODE> bytes.
     * @exception ArrayIndexOutOfBoundsException If the encoding exceeds <CODE>maxDataLength</CODE>.
     * @since 1.5
     */
public void encodeSnmpPdu(SnmpPdu pdu, int maxDataLength) throws SnmpStatusException, SnmpTooBigException {
    SnmpPduPacket pdupacket = (SnmpPduPacket) pdu;
    version = pdupacket.version;
    community = pdupacket.community;
    address = pdupacket.address;
    port = pdupacket.port;
    data = new byte[maxDataLength];
    try {
        BerEncoder benc = new BerEncoder(data);
        benc.openSequence();
        encodeVarBindList(benc, pdupacket.varBindList);
        switch(pdupacket.type) {
            case pduGetRequestPdu:
            case pduGetNextRequestPdu:
            case pduInformRequestPdu:
            case pduGetResponsePdu:
            case pduSetRequestPdu:
            case pduV2TrapPdu:
            case pduReportPdu:
                SnmpPduRequest reqPdu = (SnmpPduRequest) pdupacket;
                benc.putInteger(reqPdu.errorIndex);
                benc.putInteger(reqPdu.errorStatus);
                benc.putInteger(reqPdu.requestId);
                break;
            case pduGetBulkRequestPdu:
                SnmpPduBulk bulkPdu = (SnmpPduBulk) pdupacket;
                benc.putInteger(bulkPdu.maxRepetitions);
                benc.putInteger(bulkPdu.nonRepeaters);
                benc.putInteger(bulkPdu.requestId);
                break;
            case pduV1TrapPdu:
                SnmpPduTrap trapPdu = (SnmpPduTrap) pdupacket;
                benc.putInteger(trapPdu.timeStamp, SnmpValue.TimeticksTag);
                benc.putInteger(trapPdu.specificTrap);
                benc.putInteger(trapPdu.genericTrap);
                if (trapPdu.agentAddr != null) benc.putOctetString(trapPdu.agentAddr.byteValue(), SnmpValue.IpAddressTag); else benc.putOctetString(new byte[0], SnmpValue.IpAddressTag);
                benc.putOid(trapPdu.enterprise.longValue());
                break;
            default:
                throw new SnmpStatusException('Invalid pdu type ' + String.valueOf(pdupacket.type));
        }
        benc.closeSequence(pdupacket.type);
        dataLength = benc.trim();
    } catch (ArrayIndexOutOfBoundsException x) {
        throw new SnmpTooBigException();
    }
}

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.SnmpV3Message.encodeSnmpPdu(SnmpPdu, int)

/**
     * Initializes this message with the specified <CODE>pdu</CODE>.
     * <P>
     * This method initializes the data field with an array of 
     * <CODE>maxDataLength</CODE> bytes. It encodes the <CODE>pdu</CODE>. 
     * The resulting encoding is stored in the data field
     * and the length of the encoding is stored in <CODE>dataLength</CODE>.
     * If the encoding length exceeds <CODE>maxDataLength</CODE>, 
     * the method throws an exception.
     * @param p The PDU to be encoded.
     * @param maxDataLength The maximum length permitted for the data field.
     * @exception SnmpStatusException If the specified <CODE>pdu</CODE> 
     *   is not valid.
     * @exception SnmpTooBigException If the resulting encoding does not fit
     * into <CODE>maxDataLength</CODE> bytes.
     * @exception ArrayIndexOutOfBoundsException If the encoding exceeds 
     *    <CODE>maxDataLength</CODE>.
     */
public void encodeSnmpPdu(SnmpPdu p, int maxDataLength) throws SnmpStatusException, SnmpTooBigException {
    SnmpScopedPduPacket pdu = (SnmpScopedPduPacket) p;
    if (isTraceOn()) {
        trace('encodeSnmpPdu', 'Pdu to marshall: \n' + 'security parameters : ' + pdu.securityParameters + '\n' + 'type :' + pdu.type + '\n' + 'version :' + pdu.version + '\n' + 'requestId :' + pdu.requestId + '\n' + 'msgId :' + pdu.msgId + '\n' + 'msgMaxSize :' + pdu.msgMaxSize + '\n' + 'msgFlags :' + pdu.msgFlags + '\n' + 'msgSecurityModel :' + pdu.msgSecurityModel + '\n' + 'contextEngineId :' + pdu.contextEngineId + '\n' + 'contextName :' + pdu.contextName + '\n');
    }
    version = pdu.version;
    address = pdu.address;
    port = pdu.port;
    msgId = pdu.msgId;
    msgMaxSize = pdu.msgMaxSize;
    msgFlags = pdu.msgFlags;
    msgSecurityModel = pdu.msgSecurityModel;
    contextEngineId = pdu.contextEngineId;
    contextName = pdu.contextName;
    securityParameters = pdu.securityParameters;
    data = new byte[maxDataLength];
    try {
        BerEncoder benc = new BerEncoder(data);
        benc.openSequence();
        encodeVarBindList(benc, pdu.varBindList);
        switch(pdu.type) {
            case pduGetRequestPdu:
            case pduGetNextRequestPdu:
            case pduInformRequestPdu:
            case pduGetResponsePdu:
            case pduSetRequestPdu:
            case pduV2TrapPdu:
            case pduReportPdu:
                SnmpPduRequestType reqPdu = (SnmpPduRequestType) pdu;
                benc.putInteger(reqPdu.getErrorIndex());
                benc.putInteger(reqPdu.getErrorStatus());
                benc.putInteger(pdu.requestId);
                break;
            case pduGetBulkRequestPdu:
                SnmpPduBulkType bulkPdu = (SnmpPduBulkType) pdu;
                benc.putInteger(bulkPdu.getMaxRepetitions());
                benc.putInteger(bulkPdu.getNonRepeaters());
                benc.putInteger(pdu.requestId);
                break;
            default:
                throw new SnmpStatusException('Invalid pdu type ' + String.valueOf(pdu.type));
        }
        benc.closeSequence(pdu.type);
        dataLength = benc.trim();
    } catch (ArrayIndexOutOfBoundsException x) {
        throw new SnmpTooBigException();
    }
}

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.encodeVarBindList(BerEncoder, SnmpVarBind[])

/**
     * For SNMP Runtime private use only.
     */
public void encodeVarBindList(BerEncoder benc, SnmpVarBind[] varBindList) throws SnmpStatusException, SnmpTooBigException {
    int encodedVarBindCount = 0;
    try {
        benc.openSequence();
        if (varBindList != null) {
            for (int i = varBindList.length - 1; i >= 0; i--) {
                SnmpVarBind bind = varBindList[i];
                if (bind != null) {
                    benc.openSequence();
                    encodeVarBindValue(benc, bind.value);
                    benc.putOid(bind.oid.longValue());
                    benc.closeSequence();
                    encodedVarBindCount++;
                }
            }
        }
        benc.closeSequence();
    } catch (ArrayIndexOutOfBoundsException x) {
        throw new SnmpTooBigException(encodedVarBindCount);
    }
}

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.SnmpRequestHandler.reduceResponsePdu(SnmpPduPacket, SnmpPduPacket, int)

private SnmpPduPacket reduceResponsePdu(SnmpPduPacket req, SnmpPduPacket resp, int acceptedVbCount) throws SnmpTooBigException {
    if (req.type != req.pduGetBulkRequestPdu) {
        if (isDebugOn()) {
            debug('reduceResponsePdu', 'cannot remove anything');
        }
        throw new SnmpTooBigException(acceptedVbCount);
    }
    int vbCount = resp.varBindList.length;
    if (acceptedVbCount >= 3) vbCount = Math.min(acceptedVbCount - 1, resp.varBindList.length); else if (acceptedVbCount == 1) vbCount = 1; else vbCount = resp.varBindList.length / 2;
    if (vbCount < 1) {
        if (isDebugOn()) {
            debug('reduceResponsePdu', 'cannot remove anything');
        }
        throw new SnmpTooBigException(acceptedVbCount);
    } else {
        SnmpVarBind[] newVbList = new SnmpVarBind[vbCount];
        for (int i = 0; i < vbCount; i++) {
            newVbList[i] = resp.varBindList[i];
        }
        if (isDebugOn()) {
            debug('reduceResponsePdu', (resp.varBindList.length - newVbList.length) + ' items have been removed');
        }
        resp.varBindList = newVbList;
    }
    return resp;
}

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...