Hello,
Sorry if you're getting this twice, I got an email the first time saying I'm not allowed to post. I thought I had signed up but apparently did not. I'm using the 2.0.2 version of snmp-4j I think a race condition exists in DefaultUdpTransportMapping() that leads to a NullPointerException: Here is the scenario : TransportMapping transport = new DefaultUdpTransportMapping(); transport.listen(); /* * set up all the pdu and target stuff here */ Snmp snmp = new Snmp(transport); snmp.send(pdu, cTarget); snmp.close(); Here is the exception that gets generated (on occassion) Exception in thread "DefaultUDPTransportMapping_127.0.0.1/0" java.lang.NullPointerException at org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:321) at java.lang.Thread.run(Thread.java:662) Now, the reason I think this is a race condition is because it only happens occassionally when running my test. After looking through the code this is what I think is happening: - snmp.close() is calling the transport.close() which sets socket = null; -this happens before transport.listen() can start it's listening thread, but after it ensures the socket, so line 321 : socket.setSoTimeout(....) has a null socket object? Or am I just not using snmp4j correctly? Thanks _______________________________________________ SNMP4J mailing list SNMP4J@agentpp.org http://lists.agentpp.org/mailman/listinfo/snmp4j