[SNMP4J] SNMP Agent 2.0.5 - StaticMOGroup.get(..)
Sylvain POGNANT
s.pognant at overkiz.com
Fri Jan 13 14:12:48 CET 2012
Hi,
I'm using SNMP Agent 2.0.5
I think there is a small issue with class StaticMOGroup, in method
get() :
[Extract]
> public void get(SubRequest request) {
>
> OID oid = request.getVariableBinding().getOid();
> Variable vb = vbs.get(oid);
> if (vb == null) {
> request.getVariableBinding().setVariable(Null.noSuchInstance);
> }
> request.getVariableBinding().setVariable(vb);
> request.completed();
> }
The method tries to replace a missing variable by Null.noSuchInstance
but fails to do so because it immediately replaces it by null
afterwards.
Therefore, when someone tries to access an unknown OID, an
IllegalArgumentException: Variable of a VariableBinding must not be null
is thrown instead of returning the proper no such instance SMI code.
I think the code should read (note the extra _else_) :
if (vb == null) {
request.getVariableBinding().setVariable(Null.noSuchInstance);
}
+ else {
request.getVariableBinding().setVariable(vb);
+ }
Regards.
More information about the SNMP4J
mailing list