diff --git a/src/main/java/cn/reddragon/eportal/Authenticator.java b/src/main/java/cn/reddragon/eportal/Authenticator.java index a44a33c..5dad15a 100644 --- a/src/main/java/cn/reddragon/eportal/Authenticator.java +++ b/src/main/java/cn/reddragon/eportal/Authenticator.java @@ -10,7 +10,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.net.HttpURLConnection; -import java.net.NoRouteToHostException; +import java.net.SocketException; import java.net.SocketTimeoutException; import java.util.List; import java.util.Map; @@ -117,23 +117,25 @@ public static void checkOnline() { error = false; if (connection.getResponseCode() != HttpURLConnection.HTTP_MOVED_TEMP) { if (HelloApplication.controller != null) { - Platform.runLater(() -> HelloApplication.controller.resultText.setText("Auth server error!")); + Platform.runLater(() -> HelloApplication.controller.resultText.setText("Error: Auth server error!")); error = true; } } } catch (SocketTimeoutException e) { + System.err.println(e.getMessage()); if (HelloApplication.controller != null) { Platform.runLater(() -> { - HelloApplication.controller.resultText.setText("Auth server connection timeout!"); + HelloApplication.controller.resultText.setText("Error: Auth server connection timeout!"); error = true; //HelloApplication.controller.button.setDisable(true); }); } online = false; - } catch (NoRouteToHostException e) { + } catch (SocketException e) { + System.err.println(e.getMessage()); if (HelloApplication.controller != null) { Platform.runLater(() -> { - HelloApplication.controller.resultText.setText("No Internet connection!"); + HelloApplication.controller.resultText.setText("Error: No Internet connection!"); error = true; //HelloApplication.controller.button.setDisable(true); }); diff --git a/src/main/java/cn/reddragon/eportal/HelloController.java b/src/main/java/cn/reddragon/eportal/HelloController.java index b0d1eeb..01f0ae9 100644 --- a/src/main/java/cn/reddragon/eportal/HelloController.java +++ b/src/main/java/cn/reddragon/eportal/HelloController.java @@ -62,6 +62,7 @@ public void updateUI() { remainLabel.setText("Time remaining:"); } statusLabel.setText(sb.toString()); + button.setDisable(Authenticator.error); } @FXML