[SNMP4J] bug on persistence!

Frank Fock fock at agentpp.com
Thu Jul 12 01:21:36 CEST 2007


Hi Elena,

Your are right, for non-default contexts it did not
work. The following patch fixes that:

@@ -100,7 +100,7 @@
        if (logger.isDebugEnabled()) {
          logger.debug("Loading data for context 
'"+context.getContext()+"'");
        }
-      mos = (LinkedHashMap) serializableMO.get(context);
+      mos = (LinkedHashMap) serializableMO.get(context.getContext());
        if (mos == null) {
          input.skipContext(context);
          continue;
@@ -154,7 +154,7 @@
          logger.debug("Trying to write MIB data for context '"+
                       c.getContext()+"'");
        }
-      mos = (LinkedHashMap) serializableMO.get(c);
+      mos = (LinkedHashMap) serializableMO.get(c.getContext());
        if (mos != null) {
          writeData(output, c, mos);
        }

Best regards,
Frank

Quarantotto Elena wrote:
> Hi all!
> Probably we have found a bug on module persistence.
> In class org.snmp4j.agent.io.MOServerPersistence there is a private
> method buildCache that builds a map which contains objects to be saved.
> This method is called inside saveData method. The map returned has
> OctectString keys, which represents context names. But when map is used
> into the saveData, the access key is the object Context (not the
> OctetString contained in it). So the method get on the map returns null
> and there is nothing to be saved.
> Changing access on the serializableMO map it works!!!
>  
> bye
> Elena
> --------------------------------------------------------------------
> 
> CONFIDENTIALITY NOTICE
> 
> This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to webmaster at telecomitalia.it.
> 
>         Thank you
> 
>                                         www.telecomitalia.it
> 
> --------------------------------------------------------------------
>                         
> _______________________________________________
> 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