jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Milamber <milam...@apache.org>
Subject Re: Java 7 multiple Exception catching - layout convention
Date Mon, 29 Jun 2015 22:03:02 GMT


On 29/06/2015 16:21, sebb wrote:
> Java 7 allows multiple Exceptions to be listed in a single catch
> clause, which can simplify code considerably.
>
> However, I find it a bit awkward to read the clause when no spaces are used.
>
> Compare
>
> } catch (NumberFormatException|IOException|ScriptException e) { // nospaces
>
> with
>
> } catch (NumberFormatException | IOException | ScriptException e) { //
> spaced out
>
>
>
> I find the second version with spaces both sides of the "|" character
> much easier to read.
>
> This is particularly true where the exception name starts with the
> letters "Ill" as in
>
> } catch (NumberFormatException|IllegalArgumentException|ScriptException
> e) { // nospaces
>
> Agreed?

Yes, the spaces version seems better for have a better readable.
Milamber


>


Mime
View raw message