Re: [SNMP4J] TableUtils.getTable() null pointer exception

2017-04-12 Thread Frank Fock
Hi Stuart,

What SNMP4J version are you using?

Best regards,
Frank


> On 12. Apr 2017, at 18:19, Stuart Johnston  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
> SNMP4J@agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j

___
SNMP4J mailing list
SNMP4J@agentpp.org
https://oosnmp.net/mailman/listinfo/snmp4j


Re: [SNMP4J] interesting

2017-04-12 Thread Frank Fock
Hi,

I have unsubscribed and blocked this user, please ignore this posting.

Best regards,
Frank Fock
___
SNMP4J mailing list
SNMP4J@agentpp.org
https://oosnmp.net/mailman/listinfo/snmp4j


[SNMP4J] TableUtils.getTable() null pointer exception

2017-04-12 Thread Stuart Johnston
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
SNMP4J@agentpp.org
https://oosnmp.net/mailman/listinfo/snmp4j