Skip to content

Commit 37333a6

Browse files
authored
Merge pull request #48 from spdx/unitfailures
Fix unit test failures
2 parents 586fc25 + c247247 commit 37333a6

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

TestFiles/SPDXRdfExampleHttps.rdf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,7 @@ under the Apache License 2.0 (see: StringUtils.containsWhitespace())</spdx:notic
11231123
<spdx:relatedSpdxElement>
11241124
<spdx:Package rdf:about="http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301#SPDXRef-Saxon">
11251125
<spdx:name>Saxon</spdx:name>
1126+
<spdx:copyrightText>NOASSERTION</spdx:copyrightText>
11261127
<spdx:checksum>
11271128
<spdx:Checksum>
11281129
<spdx:checksumValue>85ed0817af83a24ad8da68c2b5094de69833983c</spdx:checksumValue>

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
import org.spdx.library.model.DuplicateSpdxIdException;
7373
import org.spdx.library.model.IndividualUriValue;
7474
import org.spdx.library.model.SimpleUriValue;
75+
import org.spdx.library.model.SpdxIdNotFoundException;
7576
import org.spdx.library.model.SpdxInvalidTypeException;
7677
import org.spdx.library.model.SpdxModelFactory;
7778
import org.spdx.library.model.TypedValue;
@@ -667,11 +668,15 @@ public Optional<Object> getPropertyValue(String id, String propertyName) throws
667668
Property property = model.createProperty(SpdxResourceFactory.propertyNameToUri(propertyName));
668669
NodeIterator iter = model.listObjectsOfProperty(idResource, property);
669670
if (!iter.hasNext()) {
670-
if (isListedLicenseOrException(idResource) && !this.exists(id)) {
671+
if (isListedLicenseOrException(idResource)) {
671672
// If there is no locally stored property for a listed license or exception
672673
// fetch it from listed licenses store
673-
return ListedLicenses.getListedLicenses().getLicenseModelStore()
674-
.getValue(HTTPS_LISTED_LICENSE_NAMESPACE_PREFIX, id, propertyName);
674+
try {
675+
return ListedLicenses.getListedLicenses().getLicenseModelStore()
676+
.getValue(HTTPS_LISTED_LICENSE_NAMESPACE_PREFIX, id, propertyName);
677+
} catch(SpdxIdNotFoundException e) {
678+
return Optional.empty();
679+
}
675680
} else {
676681
return Optional.empty();
677682
}

src/test/java/org/spdx/library/model/license/SpdxListedLicenseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public void testSetComment() throws InvalidSPDXAnalysisException {
178178
public void testSetFsfLibre() throws InvalidSPDXAnalysisException {
179179

180180
String name = "name";
181-
String id = "AFL-3.0";
181+
String id = "DIFFERENT";
182182
String text = "text";
183183
Collection<String> sourceUrls = new ArrayList<String>(Arrays.asList(new String[] {"source url1", "source url2"}));
184184
String notes = "notes";

0 commit comments

Comments
 (0)