Skip to content

Commit 9a26095

Browse files
committed
Replace deprecated URL constructor call
1 parent 12add60 commit 9a26095

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/graphql/scalars/url/UrlScalar.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.io.File;
1515
import java.net.MalformedURLException;
1616
import java.net.URI;
17+
import java.net.URISyntaxException;
1718
import java.net.URL;
1819
import java.util.Locale;
1920
import java.util.Optional;
@@ -83,8 +84,8 @@ public Value<?> valueToLiteral(Object input, GraphQLContext graphQLContext, Loca
8384

8485
private URL parseURL(String input, Function<String, RuntimeException> exceptionMaker) {
8586
try {
86-
return new URL(input);
87-
} catch (MalformedURLException e) {
87+
return new URI(input).toURL();
88+
} catch (URISyntaxException | IllegalArgumentException | MalformedURLException e) {
8889
throw exceptionMaker.apply("Invalid URL value : '" + input + "'.");
8990
}
9091
}

0 commit comments

Comments
 (0)