certi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [certi-dev] Bug jcert CertiLogicalTime


From: Eric Noulard
Subject: Re: [certi-dev] Bug jcert CertiLogicalTime
Date: Tue, 16 Oct 2012 09:48:35 +0200

2012/10/16 Andrej Pancik <address@hidden>:
> Hi Sven,
>
> Yes, it seems you are right! It is a bug.
>

> Am I that wrong or is this really a bug?

I agree with Andrej, looks like a bug.
I would bet that nobodiy did ever use
increaseBy
or
decreaseBy

methods.


>
> public void increaseBy(LogicalTimeInterval addend) throws
> IllegalTimeArithmetic {
> if (getClass() != addend.getClass()) {
> throw new IllegalTimeArithmetic("Different implementation of
> logical time supplied" + getClass() + addend.getClass());
> }
>
> time += ((CertiLogicalTimeInterval) addend).getInterval();
> }

In think the appropriate check in those cases is:

if (!(addend instanceof CertiLogicalTimeInterval)) {
            throw new IllegalTimeArithmetic("Different implementation
of logical time supplied");
}


could even be more readable with positive check:

if (addend instanceof CertiLogicalTimeInterval) {
       time += ((CertiLogicalTimeInterval) addend).getInterval();
} else {
       throw new IllegalTimeArithmetic("Different implementation of
logical time supplied");
}

Are you ok with this change proposal?

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]