Fix NPE problems when no scheme can be resolved
@@ -70,14 +70,16 @@ public class ReferenceUtils {
public static String readURI(String absoluteUri, List<AuthorizationValue> auths) throws Exception {
URI resolved = new URI(absoluteUri);
+ if (StringUtils.isNotBlank(resolved.getScheme())) {
if (resolved.getScheme().startsWith("http")) {
return readHttp(absoluteUri, auths);
} else if (resolved.getScheme().startsWith("file")) {
return readFile(absoluteUri);
} else if (resolved.getScheme().startsWith("classpath")) {
return readClasspath(absoluteUri);
- } else {
- // try file
+ }
+ }
+ // If no matches exists, try file
String content = null;
try {
content = readFile(absoluteUri);
@@ -89,7 +91,6 @@ public class ReferenceUtils {
}
return content;
}
- }
public static JsonNode deserializeIntoTree(String content) throws Exception {
boolean isJson = content.trim().startsWith("{");
