Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ReferenceUtils to better support windows filesystem #1819

Merged
merged 2 commits into from
Oct 4, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,26 @@ public static boolean isAnchor(String ref) {

public static String readURI(String absoluteUri, List<AuthorizationValue> auths) throws Exception {
URI resolved = new URI(absoluteUri);
if (StringUtils.isBlank(resolved.getScheme())) {
// try file
String content = null;
try {
content = readFile(absoluteUri);
} catch (Exception e) {
//
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);
}
if (StringUtils.isBlank(content)) {
content = readClasspath(absoluteUri);
}
return content;
} else 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);
}
throw new RuntimeException("scheme not supported for uri: " + absoluteUri);
// If no matches exists, try file
String content = null;
try {
content = readFile(absoluteUri);
} catch (Exception e) {
//
}
if (StringUtils.isBlank(content)) {
content = readClasspath(absoluteUri);
}
return content;
}

public static JsonNode deserializeIntoTree(String content) throws Exception {
Expand Down