Skip to content

Commit 0a1cd82

Browse files
authored
Merge pull request #65 from spdx/renunknown
Update to latest Java library version
2 parents 263b07a + 38522a4 commit 0a1cd82

3 files changed

Lines changed: 14 additions & 16 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<dependency>
119119
<groupId>org.spdx</groupId>
120120
<artifactId>java-spdx-library</artifactId>
121-
<version>2.0.0-RC1</version>
121+
<version>2.0.0-RC2</version>
122122
</dependency>
123123
<dependency>
124124
<groupId>org.apache.jena</groupId>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public class RdfSpdxModelManager implements IModelStoreLock {
105105

106106
public class RdfListIterator implements Iterator<Object> {
107107

108-
NodeIterator listIterator;
108+
final NodeIterator listIterator;
109109
private final Property property;
110110

111111
public RdfListIterator(Resource idResource, Property property) {
@@ -171,7 +171,7 @@ public void removedStatement(Statement s) {
171171
private final NextIdListener nextIdListener = new NextIdListener();
172172

173173
private final String documentUri;
174-
protected Model model;
174+
final protected Model model;
175175
/**
176176
* Map of a lower case ID to the case-sensitive ID
177177
*/

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public class RdfStore implements IModelStore, ISerializableModelStore {
6565
static final Logger logger = LoggerFactory.getLogger(RdfStore.class.getName());
6666

6767
static final String GENERATED = "gnrtd";
68-
static Pattern DOCUMENT_ID_PATTERN_GENERATED = Pattern.compile(SpdxConstantsCompatV2.EXTERNAL_DOC_REF_PRENUM+GENERATED+"(\\d+)$");
69-
static Pattern SPDX_ID_PATTERN_GENERATED = Pattern.compile(SpdxConstantsCompatV2.SPDX_ELEMENT_REF_PRENUM+GENERATED+"(\\d+)$");
70-
static Pattern LICENSE_ID_PATTERN_GENERATED = Pattern.compile(SpdxConstantsCompatV2.NON_STD_LICENSE_ID_PRENUM+GENERATED+"(\\d+)$");
68+
static final Pattern DOCUMENT_ID_PATTERN_GENERATED = Pattern.compile(SpdxConstantsCompatV2.EXTERNAL_DOC_REF_PRENUM+GENERATED+"(\\d+)$");
69+
static final Pattern SPDX_ID_PATTERN_GENERATED = Pattern.compile(SpdxConstantsCompatV2.SPDX_ELEMENT_REF_PRENUM+GENERATED+"(\\d+)$");
70+
static final Pattern LICENSE_ID_PATTERN_GENERATED = Pattern.compile(SpdxConstantsCompatV2.NON_STD_LICENSE_ID_PRENUM+GENERATED+"(\\d+)$");
7171
static final String ANON_PREFIX = "__anon__";
72-
static Pattern ANON_ID_PATTERN = Pattern.compile(ANON_PREFIX+"(.+)$");
72+
static final Pattern ANON_ID_PATTERN = Pattern.compile(ANON_PREFIX+"(.+)$");
7373
RdfSpdxModelManager modelManager;
7474
String documentUri;
7575
boolean dontStoreLicenseDetails = false;
@@ -84,10 +84,9 @@ public class RdfStore implements IModelStore, ISerializableModelStore {
8484
* Create an RDF store and initialize it with an SPDX document deserialized from stream
8585
* Note that the stream must contain one and only one SPDX document in SPDX version 2.X format
8686
* @param stream input stream of a model
87-
* @throws IOException on IO error
8887
* @throws InvalidSPDXAnalysisException on SPDX parsing errors
8988
*/
90-
public RdfStore(InputStream stream) throws InvalidSPDXAnalysisException, IOException {
89+
public RdfStore(InputStream stream) throws InvalidSPDXAnalysisException {
9190
deSerialize(stream, false);
9291
}
9392

@@ -100,13 +99,12 @@ public RdfStore() {
10099
}
101100

102101
/**
103-
* Create an RDF store and initialize it with an data deserialized from stream using the documentUri
102+
* Create an RDF store and initialize it with a data deserialized from stream using the documentUri
104103
* for ID prefixes
105104
* @param stream stream of an RDF model
106-
* @throws IOException on IO error
107105
* @throws InvalidSPDXAnalysisException on SPDX parsing errors
108106
*/
109-
public RdfStore(InputStream stream, String documentUri) throws InvalidSPDXAnalysisException, IOException {
107+
public RdfStore(InputStream stream, String documentUri) throws InvalidSPDXAnalysisException {
110108
this.documentUri = documentUri;
111109
deSerialize(stream, false, documentUri);
112110
}
@@ -222,7 +220,7 @@ public IdType getIdType(String objectUri) {
222220
id = CompatibleModelStoreWrapper.objectUriToId(false, objectUri, documentUri);
223221
} catch (InvalidSPDXAnalysisException e) {
224222
logger.warn("Error converting object URI to ID for URI: {}", objectUri, e);
225-
return IdType.Unkown;
223+
return IdType.Unknown;
226224
}
227225
if (SpdxConstantsCompatV2.LICENSE_ID_PATTERN.matcher(id).matches()) {
228226
return IdType.LicenseRef;
@@ -233,7 +231,7 @@ public IdType getIdType(String objectUri) {
233231
if (SpdxConstantsCompatV2.SPDX_ELEMENT_REF_PATTERN.matcher(id).matches()) {
234232
return IdType.SpdxId;
235233
}
236-
return IdType.Unkown;
234+
return IdType.Unknown;
237235
}
238236

239237
/* (non-Javadoc)
@@ -645,7 +643,7 @@ public void deSerialize(InputStream stream, boolean overwrite, String documentNa
645643
}
646644

647645
@Override
648-
public Optional<String> getCaseSensisitiveId(String documentUri, String caseInsensisitiveId) {
646+
public Optional<String> getCaseSensitiveId(String documentUri, String caseInsensisitiveId) {
649647
if (Objects.isNull(modelManager)) {
650648
return Optional.empty();
651649
}
@@ -675,7 +673,7 @@ public void delete(String objectUri) throws InvalidSPDXAnalysisException {
675673
}
676674

677675
@Override
678-
public void close() throws Exception {
676+
public void close() {
679677
if (Objects.nonNull(modelManager)) {
680678
modelManager.close();
681679
modelManager = null;

0 commit comments

Comments
 (0)