[SNMP4J] UsmUserEntry.java question

PHIL BERGSTRESSER phil.bergstresser at adtran.com
Wed Jan 12 21:33:41 CET 2005


Frank,
    It's more than one line in error. 
    Kenping clearly noted that the second if (else if) has the same
conditional expression as the first, so it will never be true as coded if
the first if evaluated to true. Did you see that he expanded the check for
null pointer on either object into 2 conditional expressions so the return
result would show +1 or -1 depending on which engine.ID was null.
    Likely to be unlikely situations, but still in need of repair to make
sense.
    HTH,
Phil


-----Original Message-----
From: Frank Fock [mailto:fock at agentpp.com]
Sent: Wednesday, January 12, 2005 12:40 PM
To: kenping
Cc: snmp4j at agentpp.org
Subject: Re: [SNMP4J] UsmUserEntry.java question


Hi Kenping,

Yes, well observed, it's obviously a bug.
The correct line should read:

result = engineID.compareTo(other.engineID);

A patch release will be available for download
soon. Many thanks for reporting the bug!

Best regards,
Frank

kenping wrote:

>Hi,
>    Has there a bug in UsmUserEntry.java at line 135 ?:
>
>    if ((engineID != null) && (other.engineID != null)) {
>      engineID.compareTo(other.engineID);   <----- ???
>    }
>    else if ((engineID != null) && (other.engineID != null)) {
>      result = 1;
>    }
>
>    I changed it to follows:
>
>    if ((engineID != null) && (other.engineID != null)) {
>      result = engineID.compareTo(other.engineID);
>    }
>    else if ((engineID != null) && (other.engineID == null)) {
>      result = 1;
>    }
>    else if ((engineID == null) && (other.engineID != null)) {
>      result = -1;
>    }
>
>    Is it correct?
>
>thanks for all.
>yours kenping
>
>------------------------------------------------------------------------
>
>_______________________________________________
>SNMP4J mailing list
>SNMP4J at agentpp.org
>http://p15141779.pureserver.info/mailman/listinfo/snmp4j
>  
>


_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://p15141779.pureserver.info/mailman/listinfo/snmp4j



More information about the SNMP4J mailing list