Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/graphql/scalars/url/UrlScalar.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Locale;
import java.util.Optional;
Expand Down Expand Up @@ -83,8 +84,8 @@ public Value<?> valueToLiteral(Object input, GraphQLContext graphQLContext, Loca

private URL parseURL(String input, Function<String, RuntimeException> exceptionMaker) {
try {
return new URL(input);
} catch (MalformedURLException e) {
return new URI(input).toURL();
} catch (URISyntaxException | IllegalArgumentException | MalformedURLException e) {
throw exceptionMaker.apply("Invalid URL value : '" + input + "'.");
}
}
Expand Down