File tree Expand file tree Collapse file tree
HMCLCore/src/main/java/org/jackhuang/hmcl/util/io Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,8 +144,7 @@ public static URLConnection createConnection(URI uri) throws IOException {
144144 }
145145 connection .setConnectTimeout (TIME_OUT );
146146 connection .setReadTimeout (TIME_OUT );
147- if (connection instanceof HttpURLConnection ) {
148- var httpConnection = (HttpURLConnection ) connection ;
147+ if (connection instanceof HttpURLConnection httpConnection ) {
149148 httpConnection .setRequestProperty ("Accept-Language" , Locale .getDefault ().toLanguageTag ());
150149 httpConnection .setInstanceFollowRedirects (false );
151150 }
@@ -276,7 +275,11 @@ public static String doGet(String uri) throws IOException {
276275 }
277276
278277 public static String doGet (URI uri ) throws IOException {
279- return readFullyAsString (resolveConnection (createHttpConnection (uri )));
278+ URLConnection connection = createConnection (uri );
279+ if (connection instanceof HttpURLConnection httpURLConnection ) {
280+ connection = resolveConnection (httpURLConnection );
281+ }
282+ return readFullyAsString (connection );
280283 }
281284
282285 public static String doGet (List <URI > uris ) throws IOException {
You can’t perform that action at this time.
0 commit comments