creadur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [tentacles] assertions
Date Tue, 26 Mar 2013 20:31:02 GMT
On 26 March 2013 09:58, Robert Burrell Donkin
<robertburrelldonkin@blueyonder.co.uk> wrote:
> Tentacles is a little unusual in using Java assertions. When assertions are
> off, then [1] no longer works as expected (rather than running with
> debugging checks off).
>
> For applications in runnable jars, I think using assertions to allow
> debugging is a cool idea - controlling logging levels is sometimes tricky in
> this situation. However - by the principle of least surprise - when on the
> golden path, I think tentacles should function correctly whether assertions
> are on or off.
>
> Opinions?

That use of assert is clearly a bug because it has side effects.

The return code from mkdirs() should have been saved in a variable,
which is then tested by the assert.

Maybe it was that way once and someone inadvertently inlined the code.

If so - and to prevent it happening again - the variable should be
documented as being required.

> Robert
> [1]
> http://svn.apache.org/viewvc/creadur/tentacles/trunk/src/main/java/org/apache/creadur/tentacles/Files.java?revision=1355691&view=markup

Mime
View raw message