[SNMP4J] ArrayIndexOutOfBounds exception

Konicki, Jason jkonicki at harris.com
Thu Nov 2 21:57:38 CET 2006


In my code I only want a MessageProcessingModel depending on the version
a user wishes to select for their agent. I have recently seen a problem
where the user selects V1 processing model, but they are receiving V2
traps. I know this is a configuration problem on the users side, but I
am getting an ArrayIndexOutOfBounds in processMessage method of the
MessageDispatcherImpl when the following code is called.

MessageDispatcherImpl.processMessage():

      Integer32 version = new Integer32();
      version.decodeBER(wholeMessage);
      MessageProcessingModel mp =
          (MessageProcessingModel) mpm.get(version.getValue());

Since the only MpM I have added is V1, when the v2 message is decoded,
it tries to get the v2 model, which does not exist and therefore gets a
ArrayIndexOutOfBounds exception.

Thanks,

Jason




More information about the SNMP4J mailing list