RFR: Check if census endpoint is a URL before trying to parse it as a path.

Erik Duveblad via github.com duke at openjdk.java.net
Fri Jun 28 07:54:53 UTC 2019


On Thu, 27 Jun 2019 14:21:00 GMT, JornVernee via github.com <duke at openjdk.java.net> wrote:

> When running `git jcheck --local` I'm getting the following exception:
> 
> ```
> Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 5: https://openjdk.java.net/census.xml
>         at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
>         at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
>         at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
>         at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
>         at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
>         at java.base/java.nio.file.Path.of(Path.java:147)
>         at org.openjdk.skara.cli/org.openjdk.skara.cli.GitJCheck.main(GitJCheck.java:159)
>         at org.openjdk.skara.cli/org.openjdk.skara.cli.GitSkara.main(GitSkara.java:130)
> ```
> 
> Looking into the source code this seems to be because the fallback endpoint for getting the OpenJDK census is used, a URL, which is not a valid path (at least not on Windows), so the check to see if we're dealing with a path or not fails when parsing the path.
> 
> This PR switches to a regular expression for checking whether the endpoint is a URL or not (by checking if it starts with `http(s)://`).
> 
> ----------------
> 
> Commits:
>  - dbccc100:	Check if census endpoint is a URL before trying to parse it as a path.
> 
> Pull request:
> http://git.openjdk.java.net/skara/pull/10
> 
> Webrev:
> https://openjdk.github.io/cr/skara/10/webrev.00
> 
> Patch:
> http://git.openjdk.java.net/skara/pull/10.diff
> 
> Fetch command:
> git fetch https://github.com/openjdk/skara.git dbccc100:pr/10

@JornVernee I just nominated you to become a commiter in Skara, see https://mail.openjdk.java.net/pipermail/skara-dev/2019-June/000109.html for details.


More information about the skara-dev mailing list