Skip to content

Commit 0c2b874

Browse files
committed
Don't use Jean getLocalName for listed license URI's
Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
1 parent 52d55c0 commit 0c2b874

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import java.util.concurrent.locks.ReadWriteLock;
4141
import java.util.concurrent.locks.ReentrantReadWriteLock;
4242
import java.util.regex.Matcher;
43+
import java.util.regex.Pattern;
4344
import java.util.stream.Stream;
4445
import java.util.stream.StreamSupport;
4546

@@ -102,6 +103,7 @@ public class RdfSpdxDocumentModelManager implements IModelStoreLock {
102103

103104
private static final String HTTPS_LISTED_LICENSE_NAMESPACE_PREFIX = SpdxConstants.LISTED_LICENSE_NAMESPACE_PREFIX.replaceAll("http:", "https:");
104105

106+
private static final Pattern LICENSE_NAMESPACE_PATTERN = Pattern.compile("(http:|https:)"+SpdxConstants.LISTED_LICENSE_NAMESPACE_PREFIX.substring("http:".length())+".+");
105107
/**
106108
* subset of the listed license namespace to be used for matching
107109
*/
@@ -818,6 +820,8 @@ private String resourceToId(Resource resource) throws SpdxRdfException {
818820
} else {
819821
retval = resource.getURI().substring(resource.getURI().lastIndexOf('/')+1);
820822
}
823+
} else if (LICENSE_NAMESPACE_PATTERN.matcher(resource.getURI()).matches()) {
824+
retval = resource.getURI().substring(resource.getURI().lastIndexOf('/')+1);
821825
} else {
822826
retval = resource.getLocalName();
823827
}

0 commit comments

Comments
 (0)