Skip to content

Commit 1bcee2c

Browse files
committed
Merge branch 'master' into issue32-2
2 parents 2cf49ad + 26327ee commit 1bcee2c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/java/org/spdx/spdxRdfStore/RdfSpdxDocumentModelManager.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,16 +1311,22 @@ public void delete(String id) throws SpdxInvalidIdException {
13111311
}
13121312

13131313
/**
1314-
* @param id
1314+
* @param id associated with a type
13151315
* @return Type typed value for the ID if it exists and is of an SPDX type, otherwise empty
13161316
* @throws InvalidSPDXAnalysisException
13171317
*/
13181318
public Optional<TypedValue> getTypedValue(String id) throws InvalidSPDXAnalysisException {
13191319
Objects.requireNonNull(id, "Missing required ID");
1320+
if (!exists(id)) {
1321+
return Optional.empty();
1322+
}
13201323
model.enterCriticalSection(false);
13211324
try {
13221325
try {
13231326
Resource idResource = idToResource(id);
1327+
if (!this.model.containsResource(idResource)) {
1328+
return Optional.empty();
1329+
}
13241330
Resource idClass = idToClass(idResource);
13251331
if (Objects.isNull(idClass)) {
13261332
return Optional.empty();

0 commit comments

Comments
 (0)