Col-E / Recaf

The modern Java bytecode editor
https://recaf.coley.software
MIT License
6.06k stars 467 forks source link

Open from URL breaks if bad url is provided (4.0.0-SNAPSHOT) #860

Closed solonovamax closed 1 month ago

solonovamax commented 1 month ago

Describe the Bug

If a bad URL is provided to the file -> open from url, the UI breaks and does not present the user with an error

To Reproduce

Steps to reproduce the behavior:

  1. Open application
  2. Select file -> open from url
  3. insert bad url
  4. No error is presented, dialog box cannot be interacted with (can be closed)

Exception

13:35:44.616 [OpenUrlPopup/ForkJoinPool.commonPool-worker-12] ERROR: Could not read from URL 'bad url'
java.lang.IllegalArgumentException: Illegal character in path at index 3: bad url
    at java.base/java.net.URI.create(URI.java:932)
    at software.coley.recaf.ui.control.popup.OpenUrlPopup.lambda$new$0(OpenUrlPopup.java:47)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1489)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2071)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2033)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
Caused by: java.net.URISyntaxException: Illegal character in path at index 3: bad url
    at java.base/java.net.URI$Parser.fail(URI.java:2995)
    at java.base/java.net.URI$Parser.checkChars(URI.java:3166)
    at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3248)
    at java.base/java.net.URI$Parser.parse(URI.java:3207)
    at java.base/java.net.URI.<init>(URI.java:645)
    at java.base/java.net.URI.create(URI.java:930)
    ... 8 common frames omitted

Screenshots

image

Col-E commented 1 month ago

af6116f08f90f5bef19529dc075c21a4ab883a40