moditect / layrry

A Runner and API for Layered Java Applications
Apache License 2.0
332 stars 33 forks source link

UrlDownloader cannot handle URLs without port definition #87

Closed aalmiray closed 3 years ago

aalmiray commented 3 years ago

If an URL has no port then the value -1 will be returned. This results in the following exception

Exception in thread "main" java.lang.IllegalArgumentException: port out of range:-1
    at java.base/java.net.InetSocketAddress.checkPort(InetSocketAddress.java:153)
    at java.base/java.net.InetSocketAddress.<init>(InetSocketAddress.java:234)
    at org.moditect.layrry.config.UrlDownloader.setupProxy(UrlDownloader.java:115)
    at org.moditect.layrry.config.UrlDownloader.download(UrlDownloader.java:48)
    at org.moditect.layrry.config.LayersConfigLoader.loadConfig(LayersConfigLoader.java:102)
    at org.moditect.layrry.config.LayersConfigLoader.loadConfig(LayersConfigLoader.java:66)
    at org.moditect.layrry.Layrry.run(Layrry.java:48)
    at org.moditect.layrry.launcher.LayrryLauncher.launch(LayrryLauncher.java:70)
    at org.moditect.layrry.launcher.LayrryLauncher.main(LayrryLauncher.java:41)

Solution: check the value of the given port and use url.getDefaultPort() if needed.

github-actions[bot] commented 1 year ago

Released in v1.0.0.Alpha2 -> https://github.com/moditect/layrry/releases/tag/v1.0.0.Alpha2