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

JornVernee via github.com duke at openjdk.java.net
Thu Jun 27 14:21:00 UTC 2019


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


More information about the skara-dev mailing list