Hi Stuart,

What SNMP4J version are you using?

Best regards,
Frank


> On 12. Apr 2017, at 18:19, Stuart Johnston <[email protected]> wrote:
> 
> Using TableUtils.getTable() can cause a null pointer exception when used with 
> SNMPv3, when the PDU is created. DefaultPDUFactory.createPDU() is called, 
> which calls 
> applyContextInfoToScopedPDU() to set the engine ID. If the engine ID has not 
> previously been set in the DefaultPDUFactory, then an NPE will be thrown. In 
> fact, we really don’t want to have to specify the engine ID in the PDU 
> factory, since snmp4j will automatically discover it and apply it if it isn’t 
> set. The solution is to create a DefaultPDUFactory with an empty (rather than 
> null) engine ID. In this cause, everything works as expected.
> 
> The immediate workaround is to call new DefaultPDUFactory(PDU.GET) rather 
> than new DefaultPDUFactory(). new DefaultPDUFactory(PDU.GET) will create an 
> empty, rather than null engine ID. I think the correct, long term fix is to 
> change the constructor to:
> 
> /**
>  * Creates a PDU factory for the {@link PDU#GET} PDU type.
>  */
> public DefaultPDUFactory() {
>     this(PDU.GET);
> }
> _______________________________________________
> SNMP4J mailing list
> [email protected]
> https://oosnmp.net/mailman/listinfo/snmp4j

_______________________________________________
SNMP4J mailing list
[email protected]
https://oosnmp.net/mailman/listinfo/snmp4j

Reply via email to