[SNMP4J] SNMP4J PDUv1 Trap setting SysUpTime throws an Exception

Frank Fock fock at agentpp.com
Wed Jan 10 00:58:56 CET 2007


Hello Rory,

This is indeed a feature. You will have to mask out
the long part over 2^32-1. This is a known limitation
of the TimeTicks type. I have to admit that it is
questionable whether to throw an Exception or to
do the masking silently. I choose to throw the
Exception because otherwise this limitation could cause
undetected effects.

Best regards,
Frank

Rory Marquis wrote:
> Hello
> 
> I posed this question last year, but don't appear to have gotten a 
> reply. I'd really like to know the answer if anyone knows because I am 
> looking to implement a solution. Please?
> 
> I have been creating v1 Traps today, and have noticed that when I set the
> sysUpTime timestamp in the PDUv1, it allows a long value as the argument 
> but
> then sets the value into a TimeTicks object, which inherits the
> UnsignedInteger32.
> 
> This becomes an issue when the server has been up for more than 248 days
> (measured in TimeTicks).
> 
> I was wondering, is this an oversight, or a feature?
> 
> Code when run, throws an IllegalArgumentException:
> 
>    PDUv1 pdu = new PDUv1();
>    long sysUpTime = 100*60*60*24*249;  //248 days max
>    pdu.setTimestamp(sysUpTime);
> 
>    Exception in thread "main" java.lang.IllegalArgumentException:
>   Argument must be an unsigned 32bit value
> 
> 
> Thanks in advance
> Rory
> 
> _________________________________________________________________
> MSN Hotmail is evolving – check out the new Windows Live Mail 
> http://ideas.live.com
> 
> _______________________________________________
> 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