[SNMP4J] java.lang.StackOverflowError
Michael Higgins
mhiggins at zhone.com
Thu Jun 17 22:28:14 CEST 2004
Hello,
I've recently started working with this software and so far quite
pleased. Good Job! I did find a something that I think is a bug.
I'm implementing an agent to emulate some functionality on a device we
are developing. We use version 2c of the protocol. At initialization I
set the agent to 2c.
During the course of processing, the snmp client I'm using (developed by
another group) issues a get-next for three of our private oids. Instead
of setting the protocol to version 2c, it inadverdently sets the pdu to
version 1.
Basically it boils down to recursive calls in getting the
BERPayloadLengthPDU
This fixes my problem (corrections in PDUv1):
protected int getBERPayloadLengthPDU() {
if (getType() != PDU.V1TRAP) {
// should be this...
return super.getBERPayloadLengthPDU();
// not this...
//return super.getBERPayloadLength();
}
else {
int length = 0;
// length for all vbs
for (int i = 0; i < variableBindings.size(); i++) {
length += ((VariableBinding)variableBindings.get(i)).getBERLength();
}
length += BER.getBERLengthOfLength(length) + 1;
length += agentAddress.getBERLength();
length += enterprise.getBERLength();
length += genericTrap.getBERLength();
length += specificTrap.getBERLength();
length += timeStamp.getBERLength();
return length;
}
}
Mike
More information about the SNMP4J
mailing list