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

Don't decode OBJECT URIs #60

Merged
merged 1 commit into from
Nov 13, 2024
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
9 changes: 2 additions & 7 deletions src/main/java/org/spdx/spdxRdfStore/RdfSpdxModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ private Optional<Object> literalNodeToObject(Object literalValue, Property prope
}

/**
* Obtain an ID from a resource
* Obtain an ObjectUri from a resource
* @param resource
* @return ID formatted appropriately for use outside the RdfStore
* @throws SpdxRdfException
Expand All @@ -834,12 +834,7 @@ private String resourceToObjectUri(Resource resource) throws SpdxRdfException {
if (resource.isAnon()) {
return RdfStore.ANON_PREFIX + resource.getId();
} else if (resource.isURIResource()) {
try {
return URLDecoder.decode(resource.getURI(), StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
logger.error("Unexpected URL decoding error for: "+resource.toString());
return resource.getURI();
}
return resource.getURI();
} else {
logger.error("Attempting to convert unsupported resource type to an ID: "+resource.toString());
throw new SpdxRdfException("Only anonymous and URI resources can be converted to an ID");
Expand Down
Loading