Skip to content

Commit

Permalink
Migrate from URL to URI constructor because URL constructors are depr…
Browse files Browse the repository at this point in the history
…ecated.
  • Loading branch information
jedla97 authored and fedinskiy committed Oct 12, 2023
1 parent 6dc811c commit c23ab76
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URI;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand All @@ -27,8 +27,8 @@ public void testMainPageAvailability() {

@Test
public void testBigFileAvailability() throws IOException {
URL bigFileURL = new URL(RestAssured.baseURI + ":" + RestAssured.port + "/big-file");
HttpURLConnection connection = (HttpURLConnection) bigFileURL.openConnection();
URI bigFileURL = URI.create(RestAssured.baseURI + ":" + RestAssured.port + "/big-file");
HttpURLConnection connection = (HttpURLConnection) bigFileURL.toURL().openConnection();
connection.setRequestMethod("HEAD");
connection.setConnectTimeout(TWO_SECONDS);
connection.connect();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package io.quarkus.ts.qute;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -222,8 +220,8 @@ private static URI getUri(String path) {
final String host = system.getValue("quarkus.http.host", String.class);
final Integer port = system.getValue("quarkus.http.port", Integer.class);
try {
return new URL("http", host, port, path).toURI();
} catch (URISyntaxException | MalformedURLException e) {
return new URI("http", null, host, port, path, null, null);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package io.quarkus.ts.qute;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -216,8 +214,8 @@ private static URI getUri(String path) {
final String host = system.getValue("quarkus.http.host", String.class);
final Integer port = system.getValue("quarkus.http.port", Integer.class);
try {
return new URL("http", host, port, path).toURI();
} catch (URISyntaxException | MalformedURLException e) {
return new URI("http", null, host, port, path, null, null);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
Expand Down

0 comments on commit c23ab76

Please sign in to comment.