Skip to content

Commit

Permalink
7.3.5
Browse files Browse the repository at this point in the history
- Fixed google ping
  • Loading branch information
Osiris-Team committed Sep 7, 2023
1 parent 2d29a5f commit 1d83d1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>com.osiris.autoplug.client</groupId>
<artifactId>autoplug-client</artifactId>
<version>7.3.4</version>
<version>7.3.5</version>
<packaging>jar</packaging>

<name>AutoPlug-Client</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/osiris/autoplug/client/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static File getServerExecutable() throws NotLoadedException, YamlReaderEx
}
} else {
if (!serverExe.exists())
AL.warn("Note that the provided file doesn't seem to exist, this may cause troubles later.");
AL.warn("Note that the server executable \"" + serverExe.getName() + "\" doesn't seem to exist yet, which may cause issues. Full path: " + serverExe.getAbsolutePath());
break;
}
}
Expand Down
13 changes: 4 additions & 9 deletions src/main/java/com/osiris/autoplug/client/SystemChecker.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Osiris-Team.
* Copyright (c) 2021-2023 Osiris-Team.
* All rights reserved.
*
* This software is copyrighted work, licensed under the terms
Expand All @@ -11,8 +11,7 @@
import com.osiris.jlib.logger.AL;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.InetAddress;

public class SystemChecker {

Expand Down Expand Up @@ -43,12 +42,8 @@ public void checkReadWritePermissions() throws Exception {

public void checkInternetAccess() throws Exception {
try {
HttpURLConnection connection = (HttpURLConnection) new URL("https://www.google.com").openConnection();
connection.setRequestMethod("HEAD");
int responseCode = connection.getResponseCode();
if (responseCode != 200) {
throw new Exception("Failed to get code 200 from " + connection.getURL().toString());
}
boolean reachable = InetAddress.getByName("www.google.com").isReachable(10000);
if (!reachable) throw new Exception("Failed to reach www.google.com!");
} catch (Exception e) {
System.err.println("Make sure that you have an internet connection!");
throw e;
Expand Down

2 comments on commit 1d83d1c

@mapokapo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The InetAddress.isReachable() method always fails on Linux when ran as regular user. I think this is because the isReachable() method in Java uses the native Linux "ping" system call, which requires root privileges.

@Osiris-Team
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooof, alright I'll add the old code as backup, thanks @mapokapo !

Please sign in to comment.