Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -134,13 +135,21 @@ public <T extends ApiResponse> Future<T> request(ApiRequest<T> request) {
responseType.getTypeName(), response
)));
}
} catch (IOException e) {
ApolloHttpManager.handleError("Failed to parse request!", e, request);
} catch (IOException exception) {
if (exception instanceof UnknownHostException) {
return;
}

ApolloHttpManager.handleError("Failed to parse request!", exception, request);
} finally {
connection.disconnect();
}
} catch (Throwable t) {
ApolloHttpManager.handleError("Failed to open connection!", t, request);
} catch (Throwable throwable) {
if (throwable instanceof UnknownHostException) {
return;
}

ApolloHttpManager.handleError("Failed to open connection!", throwable, request);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ public ApolloVersionManager() {
* @since 1.0.0
*/
public void checkForUpdates() {
ApolloPlatform platform = Apollo.getPlatform();

if (!platform.getOptions().get(ApolloVersionManager.SEND_UPDATE_MESSAGE)) {
return;
}

ApolloManager.getHttpManager().request(VersionRequest.builder().build())
.onSuccess(response -> {
ApolloPlatform platform = Apollo.getPlatform();
String version = response.getVersion();

ApolloVersion currentVersion = new ApolloVersion(platform.getApolloVersion());
Expand All @@ -89,10 +94,6 @@ public void checkForUpdates() {

this.updateAssets = response;

if (!platform.getOptions().get(ApolloVersionManager.SEND_UPDATE_MESSAGE)) {
return;
}

Logger logger = platform.getPlatformLogger();
logger.warning(String.format("A new version of Apollo is available! Latest release: %s", version));

Expand Down
Loading