Skip to content

Commit

Permalink
Replace deprecated usage of URL()
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Feb 4, 2024
1 parent 0e7cc56 commit a121b53
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/java/org/snapbackup/business/CheckForUpdates.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URL;
import org.snapbackup.logger.Logger;
import org.snapbackup.settings.SystemAttributes;
Expand All @@ -23,13 +24,13 @@ public static String getLatestVersion() {
String version = null;
String verification = null;
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(new URL(SystemAttributes.updatesURL).openStream()));
URL url = new URI(SystemAttributes.updatesURL).toURL();
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
version = reader.readLine();
verification = reader.readLine();
reader.close();
}
catch (Exception e) { //NoRouteToHostException or ConnectException
catch (Exception e) { //catch: NoRouteToHostException or ConnectException
Logger.logMsg(e.toString());
}
return verificationCheck.equals(verification) ? version : null;
Expand Down

0 comments on commit a121b53

Please sign in to comment.