File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
core/src/main/java/org/everit/json/schema/loader Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 4
4
import static java .util .Collections .unmodifiableList ;
5
5
import static java .util .Objects .requireNonNull ;
6
6
7
+ import java .io .IOException ;
7
8
import java .io .InputStream ;
9
+ import java .io .UncheckedIOException ;
8
10
import java .util .List ;
9
11
import java .util .Optional ;
10
12
@@ -19,9 +21,17 @@ class ClassPathAwareSchemaClient implements SchemaClient {
19
21
}
20
22
21
23
@ Override public InputStream get (String url ) {
22
- return handleProtocol (url )
23
- .map (this ::loadFromClasspath )
24
- .orElseGet (() -> fallbackClient .get (url ));
24
+ Optional <String > maybeString = handleProtocol (url );
25
+ if (maybeString .isPresent ()) {
26
+ InputStream stream = this .loadFromClasspath (maybeString .get ());
27
+ if (stream != null ) {
28
+ return stream ;
29
+ } else {
30
+ throw new UncheckedIOException (new IOException (String .format ("Could not find %s" , url )));
31
+ }
32
+ } else {
33
+ return fallbackClient .get (url );
34
+ }
25
35
}
26
36
27
37
private InputStream loadFromClasspath (String str ) {
You can’t perform that action at this time.
0 commit comments