fix: cannot download library when .pack.xz responded not 404

This commit is contained in:
huanghongxun 2020-04-08 21:17:21 +08:00
parent 9372d818a5
commit b957ca1931

View File

@ -214,11 +214,11 @@ public final class NetworkUtils {
}
public static boolean urlExists(URL url) throws IOException {
try (InputStream stream = url.openStream()) {
return true;
} catch (FileNotFoundException e) {
return false;
}
HttpURLConnection con = createConnection(url);
con = resolveConnection(con);
int responseCode = con.getResponseCode();
con.disconnect();
return responseCode / 100 == 2;
}
// ==== Shortcut methods for encoding/decoding URLs in UTF-8 ====