[SNMP4J] Agent bug

Simakis, William William_Simakis at srtelecom.com
Wed May 4 22:59:09 CEST 2005


Hi,

I am trying to implement a simple agent and I am trying to familiarize myself with the API etc. I am getting the following exception when I run the TestAgent example.

Exception in thread "main" java.lang.NullPointerException
	at org.snmp4j.agent.mo.MOScalar.isVolatileByDefault(MOScalar.java:54)
	at org.snmp4j.agent.mo.MOScalar.<init>(MOScalar.java:50)
	at org.snmp4j.agent.mo.snmp.SnmpFrameworkMIB$1.<init>(SnmpFrameworkMIB.java:56)
	at org.snmp4j.agent.mo.snmp.SnmpFrameworkMIB.createMOs(SnmpFrameworkMIB.java:56)
	at org.snmp4j.agent.mo.snmp.SnmpFrameworkMIB.<init>(SnmpFrameworkMIB.java:52)
	at org.snmp4j.agent.BaseAgent.init(BaseAgent.java:80)
	at org.snmp4j.agent.test.TestAgent.main(TestAgent.java:270)

Here is the problem in the code:

1) In SnmpFrameworkMIB.createMOs, a MOScalar is created and passed null to the constructor for the value parameter. 
2) The MOScalar constructor calls isVolatileByDefault with the null reference
3) isVolatileByDefault tries to call value.getSyntax without checking if the reference is null. 

from the name I would guess it should return false if the value is null but I am not that familiar with what it is used for.

Bill



More information about the SNMP4J mailing list