Skip to content

Commit 080f899

Browse files
committed
Remove incorrect dependency
Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
1 parent 63120dc commit 080f899

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<dependency>
9292
<groupId>org.spdx</groupId>
9393
<artifactId>java-spdx-library</artifactId>
94-
<version>1.1.1-SNAPSHOT</version>
94+
<version>1.1.0</version>
9595
</dependency>
9696
<dependency>
9797
<groupId>org.apache.jena</groupId>

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,12 @@ public Optional<Object> getPropertyValue(String id, String propertyName) throws
665665
Property property = model.createProperty(SpdxResourceFactory.propertyNameToUri(propertyName));
666666
NodeIterator iter = model.listObjectsOfProperty(idResource, property);
667667
if (!iter.hasNext()) {
668-
return Optional.empty();
668+
if (isListedLicenseOrException(idResource)) {
669+
return ListedLicenses.getListedLicenses().getLicenseModelStore()
670+
.getValue(HTTPS_LISTED_LICENSE_NAMESPACE_PREFIX, id, propertyName);
671+
} else {
672+
return Optional.empty();
673+
}
669674
}
670675
Optional<Object> result = valueNodeToObject(iter.next(), property);
671676
if (iter.hasNext()) {
@@ -678,6 +683,24 @@ public Optional<Object> getPropertyValue(String id, String propertyName) throws
678683
}
679684
}
680685

686+
/**
687+
* @param idResource Resource for the ID
688+
* @return true if the type of the ID is a ListedLicenseException or a Listed License
689+
*/
690+
private boolean isListedLicenseOrException(Resource idResource) {
691+
Resource valueType = idResource.getPropertyResourceValue(RDF.type);
692+
if (Objects.isNull(valueType)) {
693+
return false;
694+
}
695+
Optional<String> sValueType = SpdxResourceFactory.resourceToSpdxType(valueType);
696+
if (sValueType.isEmpty()) {
697+
return false;
698+
}
699+
String sValueTypeStr = sValueType.get();
700+
return SpdxConstants.CLASS_SPDX_LISTED_LICENSE.equals(sValueTypeStr) ||
701+
SpdxConstants.CLASS_SPDX_LISTED_LICENSE_EXCEPTION.equals(sValueTypeStr);
702+
}
703+
681704
/**
682705
* Convert a node in the RDF graph to a Java object
683706
* @param propertyValue node containing the value

0 commit comments

Comments
 (0)