[SNMP4J] NPE when calling usm.removeAllUsers();
Frank Fock
fock at agentpp.com
Thu Aug 9 19:50:09 CEST 2007
Hi Matthieu,
Thanks for reporting this bug!
The following patch should fix it:
@@ -279,9 +279,14 @@
break;
}
case UsmUserEvent.USER_REMOVED: {
- OID index = createIndex(event.getUser().getEngineID(),
- event.getUser().getUserName());
- usmUserTableModel.removeRow(index);
+ if (event.getUser() == null) {
+ usmUserTableModel.clear();
+ }
+ else {
+ OID index = createIndex(event.getUser().getEngineID(),
+ event.getUser().getUserName());
+ usmUserTableModel.removeRow(index);
+ }
}
}
}
Best regards,
Frank
Matthieu Casanova wrote:
> Hi, I want to change dynamically the usm users in my agent. So I first
> remove all users and add the new users again after that.
> But when I call
> usm.removeAllUsers();
> I have this exception
> java.lang.NullPointerException
> at org.snmp4j.agent.mo.snmp.UsmMIB.usmUserChange(UsmMIB.java:282)
> at org.snmp4j.security.USM.fireUsmUserChange(USM.java:1050)
> at org.snmp4j.security.USM.removeAllUsers(USM.java:943)
>
>
> The reason is that in removeAllUsers() there is the following code
> fireUsmUserChange(new UsmUserEvent(this, null, UsmUserEvent.USER_REMOVED));
>
> And in the UsmMIB line 282
>
> OID index = createIndex(event.getUser().getEngineID(),
> event.getUser().getUserName());
>
> But event.getUser() is null so it fails.
> I use the agent version 1.1.4
>
> Matthieu
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list