On Sun, Oct 9, 2011 at 7:16 PM, Stefan Seelmann <[email protected]> wrote:
> Hi guys,
>
> I just had a strange behaviour that the TestSnapshotBTree worked when
> I started it with "mvn test" but not when started from within Eclipse.
> I found out that in the test a Java "assert" is used but Java
> assertions are used. Java assertions are disabled by default (the must
> be enabled with -ea) but the maven surefire plugin enables them by
> default so it worked with "mvn test". I just fixed it by using JUnit
> assertTrue instead, not a big problem.
>
> But I also discovered that Java assertions are used within the JDBM
> productive code. I'm not sure if it was always used or if it was
> introduced during the recent refactorings. But I think we should not
> use Java assert at all. They should not be used as guards to check
> arguments or state because if disabled they don't fire an exception.
> They are just not reliable. I think its better to throw something like
> an IllegalArgumentException or IllegalStateException in such cases.
>
I had introduced the asserts with the jdbm refactoring changes
thinking they are always enabled. I will change them to throw
illegalstate exceptions as you suggested.


> Thoughts?
>
> Kind Regards,
> Stefan
>

regards,
Selcuk

Reply via email to