Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entering server address with missing '/' suffix results in exception #54

Closed
ALoTron opened this issue Jul 22, 2020 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@ALoTron
Copy link
Collaborator

ALoTron commented Jul 22, 2020

Environment info

  • BlockMap version: 2.1.0
  • Java version: openjdk 14.0.2
  • Operating system: Arch Linux 5.4.52-1-lts

Description

Entering a server address as example.address instead of https://example.address/ results in an IllegalArgumentException (first log below). Even a missing slash at the end (https://example.address instead of https://example.address/) throws an exception (second log below). The second exception is not shown in the log if blockmap-gui -v was used.

Steps to reproduce

  1. launch blockmap-gui
  2. enter example.url or https://example.address via File > Load from server or top address bar
  3. observe exception

Actual result

The user is confronted with a stack trace.

Expected result:

Blockmap detects a address and completes it accordingly by adding a missing https:// prefix, a missing slash at the end etc. If the error is intended behaviour the error dialog should display a user friendly error message instead of a stack trace at least.

Debug log

Log for missing https:// prefix. Actual server address has been replaced by server.stuff:

> blockmap-gui -v
20-07-23 00:33:05 INFO  RegionFolderCache [73] - Removed 0 worlds from cache
20-07-23 00:33:17 WARN  GuiControllerServer [139] - Could not load server world server.stuff
java.lang.IllegalArgumentException: URI is not absolute
        at java.net.URL.fromURI(URL.java:719) ~[?:?]
        at java.net.URI.toURL(URI.java:1139) ~[?:?]
        at de.piegames.blockmap.gui.standalone.GuiControllerServer.reload(GuiControllerServer.java:113) ~[BlockMap-gui.jar:?]
        at de.piegames.blockmap.gui.standalone.GuiControllerServer.load(GuiControllerServer.java:109) ~[BlockMap-gui.jar:?]
        at de.piegames.blockmap.gui.standalone.GuiController.loadRemote(GuiController.java:512) ~[BlockMap-gui.jar:?]
        at de.piegames.blockmap.gui.standalone.GuiController.load(GuiController.java:424) ~[BlockMap-gui.jar:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
        at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76) ~[javafx-base-13-linux.jar:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
        at com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83) ~[javafx-fxml-13-linux.jar:?]
        at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1784) ~[javafx-fxml-13-linux.jar:?]
        at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670) ~[javafx-fxml-13-linux.jar:?]
        at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49) ~[javafx-base-13-linux.jar:?]
        at javafx.event.Event.fireEvent(Event.java:198) ~[javafx-base-13-linux.jar:?]
        at javafx.scene.Node.fireEvent(Node.java:8890) ~[javafx-graphics-13-linux.jar:?]
        at com.sun.javafx.scene.control.behavior.TextFieldBehavior.fire(TextFieldBehavior.java:184) ~[javafx-controls-13-linux.jar:?]
        at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.lambda$keyMapping$62(TextInputControlBehavior.java:330) ~[javafx-controls-13-linux.jar:?]
        at com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274) ~[javafx-controls-13-linux.jar:?]
        at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) ~[javafx-base-13-linux.jar:?]
        at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) ~[javafx-base-13-linux.jar:?]
        at javafx.event.Event.fireEvent(Event.java:198) ~[javafx-base-13-linux.jar:?]
        at javafx.scene.Scene$KeyHandler.process(Scene.java:4070) ~[javafx-graphics-13-linux.jar:?]
        at javafx.scene.Scene.processKeyEvent(Scene.java:2121) ~[javafx-graphics-13-linux.jar:?]
        at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2597) ~[javafx-graphics-13-linux.jar:?]
        at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:217) ~[javafx-graphics-13-linux.jar:?]
        at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:149) ~[javafx-graphics-13-linux.jar:?]
        at java.security.AccessController.doPrivileged(AccessController.java:391) ~[?:?]
        at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$1(GlassViewEventHandler.java:248) ~[javafx-graphics-13-linux.jar:?]
        at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412) ~[javafx-graphics-13-linux.jar:?]
        at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:247) ~[javafx-graphics-13-linux.jar:?]
        at com.sun.glass.ui.View.handleKeyEvent(View.java:547) ~[javafx-graphics-13-linux.jar:?]
        at com.sun.glass.ui.View.notifyKey(View.java:971) ~[javafx-graphics-13-linux.jar:?]
        at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) ~[javafx-graphics-13-linux.jar:?]
        at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277) ~[javafx-graphics-13-linux.jar:?]
        at java.lang.Thread.run(Thread.java:832) [?:?]

Log for missing slash at the end. Actual server address has been replaced by server.stuff:

> blockmap-gui -v
20-07-23 00:34:45 INFO  RegionFolderCache [73] - Removed 0 worlds from cache
20-07-23 00:34:56 WARN  GuiControllerServer [91] - Could not load world Overworld from remote file https://server.stuff

Stack trace provided by the gui. Actual server address has been replaced by server.stuff:

java.net.UnknownHostException: blockmap.server.stuffOverworld
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:333)
	at java.base/java.net.Socket.connect(Socket.java:648)
	at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:290)
	at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
	at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
	at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:265)
	at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372)
	at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:177)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1194)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1082)
	at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:163)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1600)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1528)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
	at java.base/java.net.URL.openStream(URL.java:1167)
	at de.piegames.blockmap.world.RegionFolder$RemoteRegionFolder.getInputStream(RegionFolder.java:347)
	at de.piegames.blockmap.world.RegionFolder$RemoteRegionFolder.load(RegionFolder.java:352)
	at de.piegames.blockmap.world.RegionFolder$RemoteRegionFolder.load(RegionFolder.java:339)
	at de.piegames.blockmap.world.RegionFolder$SavedRegionFolder.<init>(RegionFolder.java:251)
	at de.piegames.blockmap.world.RegionFolder$RemoteRegionFolder.<init>(RegionFolder.java:342)
	at de.piegames.blockmap.gui.standalone.GuiControllerServer.lambda$new$1(GuiControllerServer.java:88)
	at de.piegames.blockmap.gui.standalone.GuiControllerServer.reload(GuiControllerServer.java:136)
	at de.piegames.blockmap.gui.standalone.GuiControllerServer.load(GuiControllerServer.java:109)
	at de.piegames.blockmap.gui.standalone.GuiController.loadRemote(GuiController.java:512)
	at de.piegames.blockmap.gui.standalone.GuiController.load(GuiController.java:424)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273)
	at com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
	at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1784)
	at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Node.fireEvent(Node.java:8890)
	at com.sun.javafx.scene.control.behavior.TextFieldBehavior.fire(TextFieldBehavior.java:184)
	at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.lambda$keyMapping$62(TextInputControlBehavior.java:330)
	at com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
	at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Scene$KeyHandler.process(Scene.java:4070)
	at javafx.scene.Scene.processKeyEvent(Scene.java:2121)
	at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2597)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:217)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:149)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$1(GlassViewEventHandler.java:248)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:247)
	at com.sun.glass.ui.View.handleKeyEvent(View.java:547)
	at com.sun.glass.ui.View.notifyKey(View.java:971)
	at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
	at java.base/java.lang.Thread.run(Thread.java:832)
@saibotk saibotk added the bug Something isn't working label Jul 23, 2020
@piegamesde piegamesde changed the title Entering server address with missing https prefix results in exception Entering server address with missing '/' suffix results in exception Jul 23, 2020
@piegamesde
Copy link
Owner

As for the exception with missing https://. This probably won't be fixed. The schema is an essential part of any URL, although web browsers try to hide it from the user for some reason. They probably do some black magic to figure out the correct schema and I'm not inclined to implementing this in BlockMap as well. Furthermore, this issue only arises when manually typing in the URL, which should be less necessary in the future.

@ALoTron
Copy link
Collaborator Author

ALoTron commented Jul 23, 2020

As long as the user is not confronted with the exception anymore. This would seem like an internal bug instead of an user error.

@piegamesde
Copy link
Owner

True. I'll change the exception handling to make more clear that this error is a "you fucked up" and not a software bug or the like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants