Use reflection to access DatatypeConverter

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2022-11-22 16:56:58 +00:00
parent bfa5fe1598
commit 8a6776731a
3 changed files with 52 additions and 10 deletions

View File

@ -82,10 +82,16 @@ public final class UrlUtils {
}
public static URLConnection openHttpConnection(URL url, Proxy proxy) throws IOException {
if (http == null)
throw new UnsupportedOperationException();
return openConnection(http, url, proxy);
}
public static URLConnection openConnection(URLStreamHandler handler, URL url, Proxy proxy) throws IOException {
if (openConnection == null)
throw new UnsupportedOperationException();
try {
return (URLConnection) openConnection.invokeExact(handler, url, proxy);
} catch (IOException | Error | RuntimeException e) {