RFR: Do not catch NoSuchElementException in HgOpenJDKImport

Robin Westberg via github.com duke at openjdk.java.net
Thu Aug 22 14:29:35 UTC 2019


On Thu, 22 Aug 2019 14:16:17 GMT, Erik Duveblad via github.com <duke at openjdk.java.net> wrote:

> Hi all,
> 
> this patch removes catching `NoSuchElementException` in the `main` method for `HgOpenJDKImport` to ease debugging.
> 
> ## Testing
> - [x] `sh gradlew test` passes on Linux x86_64
> 
> Thanks,
> Erik
> 
> ----------------
> 
> Commits:
>  - 5536e051:	Do not catch NoSuchElementException in HgOpenJDKImport
> 
> Pull request:
> https://git.openjdk.java.net/skara/pull/70
> 
> Webrev:
> https://webrevs.openjdk.java.net/skara/70/webrev.00
> 
> Patch:
> https://git.openjdk.java.net/skara/pull/70.diff
> 
> Fetch command:
> git fetch https://git.openjdk.java.net/skara pull/70/head:pull/70

This PR has been reviewed by Robin Westberg via github.com - a comment has been added. Review comment:

Looks good otherwise!

PR: https://git.openjdk.java.net/skara/pull/70

cli/src/main/java/org/openjdk/skara/cli/HgOpenJDKImport.java line 44:

> 43:     public static void main(String[] args) throws IOException, NoSuchElementException {
> 44:         var flags = List.of(
> 45:             Switch.shortcut("")

Pre-existing, but it's a bit unclear why NoSuchElementException is used - plain RuntimeException (or Exception) would probably make more sense? Or perhaps something like NoSuchFileException?

PR: https://git.openjdk.java.net/skara/pull/70

cli/src/main/java/org/openjdk/skara/cli/HgOpenJDKImport.java line 49:

> 48:                   .optional(),
> 49:             Switch.shortcut("")
> 50:                   .fullname("debug")

And if you go with a RuntimeException-based one I guess there's no need to declare it here either.

PR: https://git.openjdk.java.net/skara/pull/70


More information about the skara-dev mailing list