Skip to content

Commit 722c597

Browse files
committed
[refactor] replace URL constructor
1 parent 0755d61 commit 722c597

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

exist-core/src/main/java/org/exist/validation/resolver/AnyUriResolver.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
import java.io.IOException;
3636
import java.io.InputStream;
37-
import java.net.URL;
37+
import java.net.URI;
3838

3939
import static java.nio.charset.StandardCharsets.UTF_8;
4040

@@ -120,7 +120,8 @@ public XMLInputSource resolveEntity(final XMLResourceIdentifier xri) throws XNIE
120120
}
121121

122122
} else {
123-
is = new URL(resourcePath).openStream();
123+
124+
is = URI.create(resourcePath).toURL().openStream();
124125
}
125126

126127
final XMLInputSource xis = new XMLInputSource(xri.getPublicId(), resourcePath,

exist-core/src/main/java/org/exist/validation/resolver/SearchResourceResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
import java.io.InputStream;
5454
import java.io.StringReader;
5555
import java.io.StringWriter;
56+
import java.net.URI;
5657
import java.net.URISyntaxException;
57-
import java.net.URL;
5858
import java.util.Arrays;
5959
import java.util.List;
6060
import java.util.Optional;
@@ -172,7 +172,7 @@ public XMLInputSource resolveEntity(final XMLResourceIdentifier xri) throws XNIE
172172
LOG.debug("resourcePath='" + resourcePath + "'");
173173
}
174174

175-
final InputStream is = new URL(resourcePath).openStream();
175+
final InputStream is = URI.create(resourcePath).toURL().openStream();
176176

177177
final XMLInputSource xis = new XMLInputSource(xri.getPublicId(), xri.getExpandedSystemId(), xri.getBaseSystemId(), is, UTF_8.name());
178178

exist-core/src/main/java/org/exist/validation/resolver/unstable/ExistResolver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import java.io.File;
3838
import java.io.IOException;
3939
import java.io.InputStream;
40-
import java.net.URL;
40+
import java.net.URI;
4141

4242
/**
4343
*
@@ -124,7 +124,7 @@ private InputSource resolveInputSource(final BrokerPool bPool, final String path
124124
inputsource.setSystemId(path);
125125

126126
} else {
127-
final InputStream is = new URL(path).openStream();
127+
final InputStream is = URI.create(path).toURL().openStream();
128128
inputsource.setByteStream(is);
129129
inputsource.setSystemId(path);
130130
}
@@ -147,7 +147,7 @@ private StreamSource resolveStreamSource(final BrokerPool bPool, final String pa
147147
streamsource.setSystemId(path);
148148

149149
} else {
150-
final InputStream is = new URL(path).openStream();
150+
final InputStream is = URI.create(path).toURL().openStream();
151151
streamsource.setInputStream(is);
152152
streamsource.setSystemId(path);
153153
}

exist-core/src/main/java/org/exist/validation/resolver/unstable/eXistLSResourceResolver.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131

3232
import java.io.IOException;
3333
import java.io.InputStream;
34-
import java.net.MalformedURLException;
35-
import java.net.URL;
34+
import java.net.URI;
3635

3736
/**
3837
* eXistLSResourceResolver provides a way for applications to redirect
@@ -82,7 +81,7 @@ private InputStream getInputStream(String resourcePath) throws IOException {
8281
}
8382

8483
} else {
85-
is = new URL(resourcePath).openStream();
84+
is = URI.create(resourcePath).toURL().openStream();
8685
}
8786
return is;
8887
}

0 commit comments

Comments
 (0)