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 call getValue when getting namespace #180

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
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 @@ -183,7 +183,7 @@ public ExternalDocumentRef setChecksum(Checksum checksum) throws InvalidSPDXAnal
* @return the spdxDocumentNamespace or empty string if no namespace
*/
public String getSpdxDocumentNamespace() throws InvalidSPDXAnalysisException {
Optional<Object> docNamespace = getObjectPropertyValue(SpdxConstants.PROP_EXTERNAL_SPDX_DOCUMENT);
Optional<Object> docNamespace = getModelStore().getValue(getDocumentUri(), getId(), SpdxConstants.PROP_EXTERNAL_SPDX_DOCUMENT);
if (!docNamespace.isPresent()) {
logger.warn("SPDX document namespace not found");
return "";
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/spdx/library/model/ExternalSpdxElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ public static ExternalSpdxElement uriToExternalSpdxElement(String uri,

public static String externalDocumentIdToNamespace(String externalDocumentId,
IModelStore stModelStore, String stDocumentUri, ModelCopyManager copyManager) throws InvalidSPDXAnalysisException {
Optional<Object> retval = getObjectPropertyValue(stModelStore, stDocumentUri,
externalDocumentId, SpdxConstants.PROP_EXTERNAL_SPDX_DOCUMENT, copyManager);

Optional<Object> retval = stModelStore.getValue(stDocumentUri, externalDocumentId, SpdxConstants.PROP_EXTERNAL_SPDX_DOCUMENT);
if (!retval.isPresent()) {
throw new InvalidSPDXAnalysisException("No external document reference exists for document ID "+externalDocumentId);
}
Expand Down