Richard Frovarp schrieb:
> I've been using findbugs to track down issues in the code. I've got 89
> issues remaining. I'm looking for feedback on three of the classes of
> issues.
> 
> One is using the + operator for string concatenation in loops. These
> probably should be StringBuffers, as this would eliminate the creation
> of several temp objects. Any objections to moving to this? There are 12
> of those.

+1 to fix them.


> The other class has to do with mutable fields being exposed. There are
> 30 of these. The biggest group of those are all of the public/protected
> static final String[]. The final protects the reference of the array
> that the variable points to, but does not protect the contents of the
> array. Anything that can get its hands on the reference can change the
> contents. I think these should also be fixed, but that would require
> using getters instead of the direct reference to the array. There are
> some get and set issues I can take care of easily enough as well.

+1 to fix them, this issue is really critical.

> It is also concerned about all of the catching of Exception:
> 
> Exception is caught when Exception is not thrown
> This method uses a try-catch block that catches Exception objects, but
> Exception is not thrown within the try block, and RuntimeException is
> not explicitly caught. It is a common bug pattern to say try { ... }
> catch (Exception e) { something } as a shorthand for catching a number
> of types of exception each of whose catch blocks is identical, but this
> construct also accidentally catches RuntimeException as well, masking
> potential bugs.

Generally we re-throw the exceptions (apart from the AbstractUsecase
methods, which catch even RuntimeExceptions to avoid showing a stack
trace to the user). But nevertheless it would be nice to fix this
issue as well if it is not too complicated.

Thanks a lot for the pointers!

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  • Code clean up Richard Frovarp
    • Re: Code clean up Andreas Hartmann

Reply via email to