Skip to content

Commit 4906d90

Browse files
authored
Improve performance of URLFactory.create() (#565)
1 parent 39cc79b commit 4906d90

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/java/com/networknt/schema/uri/URLFactory.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ public final class URLFactory implements URIFactory {
4040
@Override
4141
public URI create(final String uri) {
4242
try {
43-
return new URL(uri).toURI();
44-
} catch (MalformedURLException e) {
45-
throw new IllegalArgumentException("Unable to create URI.", e);
46-
} catch (URISyntaxException e) {
43+
return URI.create(uri);
44+
} catch (IllegalArgumentException e) {
4745
throw new IllegalArgumentException("Unable to create URI.", e);
4846
}
4947
}

0 commit comments

Comments
 (0)