Skip to content

Commit eba67fc

Browse files
committed
Update for spec version 3.0.1
1 parent 657a4e6 commit eba67fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1651
-1910
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ buildNumber.properties
2020
.settings/
2121

2222
# IntelliJ IDE files
23-
.idea/
23+
.idea/
24+
*.iml

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@
148148
<dependency>
149149
<groupId>org.spdx</groupId>
150150
<artifactId>spdx-java-model-2_X</artifactId>
151-
<version>0.1.0-Alpha</version>
151+
<version>1.0.0-RC1</version>
152152
</dependency>
153153
<dependency>
154154
<groupId>org.spdx</groupId>
155155
<artifactId>spdx-java-core</artifactId>
156-
<version>0.1.0-Alpha</version>
156+
<version>1.0.0-RC1</version>
157157
</dependency>
158158
<dependency>
159159
<groupId>org.spdx</groupId>
160160
<artifactId>spdx-java-model-3_0</artifactId>
161-
<version>0.1.0-Alpha</version>
161+
<version>1.0.0-RC1</version>
162162
</dependency>
163163
</dependencies>
164164

src/main/java/org/spdx/Configuration.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
22
* Copyright (c) 2023 Source Auditor Inc.
3-
*
3+
* <p>
44
* SPDX-License-Identifier: Apache-2.0
5-
*
5+
* <p>
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
9-
*
9+
* <p>
1010
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
11+
* <p>
1212
* Unless required by applicable law or agreed to in writing, software
1313
* distributed under the License is distributed on an "AS IS" BASIS,
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,9 +27,9 @@
2727
/**
2828
* The configuration class for the Spdx-Java-Library. When a caller attempts to retrieve a configuration property, it
2929
* will first be checked in the Java system properties (i.e. set via `-D` command line options to the JVM, or by
30-
* programmatic calls to `System.setProperty()` in code), and will then fallback on a properties file in the classpath.
30+
* programmatic calls to `System.setProperty()` in code), and will then fall back on a properties file in the classpath.
3131
* That file must be called `/resources/spdx-java-library.properties`.
32-
*
32+
* <p>
3333
* Please see the documentation for specifics on what configuration options Spdx-Java-Library supports, and how they
3434
* impact the library's behavior.
3535
*/
@@ -100,15 +100,15 @@ private static Properties loadProperties(final String propertiesFileName) {
100100
}
101101
} catch (IOException e) {
102102
// Ignore it and fall through
103-
logger.warn("IO Exception reading configuration properties file '" + propertiesFileName + "': " + e.getMessage(), e);
103+
logger.warn("IO Exception reading configuration properties file '{}': {}", propertiesFileName, e.getMessage(), e);
104104
result = null;
105105
} finally {
106106
if (in != null) {
107107
try {
108108
in.close();
109109
} catch (IOException e) {
110110
// Ignore it and fall through
111-
logger.warn("Unable to close configuration properties file '" + propertiesFileName + "': " + e.getMessage(), e);
111+
logger.warn("Unable to close configuration properties file '{}': {}", propertiesFileName, e.getMessage(), e);
112112
}
113113
}
114114
}

src/main/java/org/spdx/library/LicenseInfoFactory.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
22
* Copyright (c) 2019 Source Auditor Inc.
3-
*
3+
* <p>
44
* SPDX-License-Identifier: Apache-2.0
5-
*
5+
* <p>
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
9-
*
9+
* <p>
1010
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
11+
* <p>
1212
* Unless required by applicable law or agreed to in writing, software
1313
* distributed under the License is distributed on an "AS IS" BASIS,
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,9 +44,11 @@
4444
* Factory for creating SPDXLicenseInfo objects from a Jena model
4545
* @author Gary O'Neall
4646
*/
47+
@SuppressWarnings("unused")
4748
public class LicenseInfoFactory {
4849

49-
static final Logger logger = LoggerFactory.getLogger(LicenseInfoFactory.class.getName());
50+
@SuppressWarnings("unused")
51+
static final Logger logger = LoggerFactory.getLogger(LicenseInfoFactory.class.getName());
5052

5153
public static final String NOASSERTION_LICENSE_NAME = "NOASSERTION";
5254
public static final String NONE_LICENSE_NAME = "NONE";
@@ -192,8 +194,8 @@ public static AnyLicenseInfo parseSPDXLicenseString(String licenseString) throws
192194
* A licenseID must NOT be "AND" or "OR"
193195
* @param licenseString String conforming to the syntax
194196
* @return an SPDXLicenseInfo created from the string
195-
* @throws InvalidLicenseStringException
196-
* @throws DefaultStoreNotInitialized
197+
* @throws InvalidLicenseStringException On invalid license expression
198+
* @throws DefaultStoreNotInitialized On the model store not being initialized - see DefaultModelStore in SPDX core package
197199
*/
198200
public static org.spdx.library.model.v2.license.AnyLicenseInfo parseSPDXLicenseStringCompatV2(String licenseString) throws InvalidLicenseStringException, DefaultStoreNotInitialized {
199201
return parseSPDXLicenseStringCompatV2(licenseString, null, null, null);
@@ -210,7 +212,7 @@ public static boolean isSpdxListedLicenseId(String licenseID) {
210212
}
211213

212214
/**
213-
* @return Array of all SPDX listed license IDs
215+
* @return List of all SPDX listed license IDs
214216
*/
215217
public static List<String> getSpdxListedLicenseIds() {
216218
return ListedLicenses.getListedLicenses().getSpdxListedLicenseIds();
@@ -234,7 +236,7 @@ public static boolean isSpdxListedExceptionId(String id) {
234236
/**
235237
* @param id ID for the listed exception
236238
* @return the standard SPDX license exception or null if the ID is not in the SPDX license list
237-
* @throws InvalidSPDXAnalysisException
239+
* @throws InvalidSPDXAnalysisException On SPDX parsing errors
238240
*/
239241
public static ListedLicenseException getListedExceptionById(String id) throws InvalidSPDXAnalysisException {
240242
return ListedLicenses.getListedLicenses().getListedExceptionById(id);
@@ -243,7 +245,7 @@ public static ListedLicenseException getListedExceptionById(String id) throws In
243245
/**
244246
* @param id ID for the listed exception
245247
* @return the standard SPDX license exception in SPDX Spec V2.X format or null if the ID is not in the SPDX license list
246-
* @throws InvalidSPDXAnalysisException
248+
* @throws InvalidSPDXAnalysisException On SPDX parsing errors
247249
*/
248250
public static org.spdx.library.model.v2.license.ListedLicenseException getListedExceptionV2ById(String id) throws InvalidSPDXAnalysisException {
249251
return ListedLicenses.getListedLicenses().getListedExceptionByIdCompatV2(id);

src/main/java/org/spdx/library/ListedLicenses.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
22
* Copyright (c) 2019 Source Auditor Inc.
3-
*
3+
* <p>
44
* SPDX-License-Identifier: Apache-2.0
5-
*
5+
* <p>
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
9-
*
9+
* <p>
1010
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
11+
* <p>
1212
* Unless required by applicable law or agreed to in writing, software
1313
* distributed under the License is distributed on an "AS IS" BASIS,
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,6 +50,7 @@
5050
* @author Gary O'Neall
5151
*
5252
*/
53+
@SuppressWarnings({"UnusedReturnValue", "unused"})
5354
public class ListedLicenses {
5455

5556
static final Logger logger = LoggerFactory.getLogger(ListedLicenses.class.getName());
@@ -95,13 +96,13 @@ private static Properties loadLicenseProperties() {
9596
}
9697
} catch (IOException e) {
9798
// Ignore it and fall through
98-
logger.warn("IO Exception reading listed license properties file: " + e.getMessage());
99+
logger.warn("IO Exception reading listed license properties file: {}", e.getMessage());
99100
} finally {
100101
if (in != null) {
101102
try {
102103
in.close();
103104
} catch (IOException e) {
104-
logger.warn("Unable to close listed license properties file: " + e.getMessage());
105+
logger.warn("Unable to close listed license properties file: {}", e.getMessage());
105106
}
106107
}
107108
}
@@ -118,8 +119,7 @@ private void initializeLicenseModelStore() {
118119
try {
119120
baseModelStore = new SpdxListedLicenseWebStore();
120121
} catch(InvalidSPDXAnalysisException ex) {
121-
logger.warn("Unable to access the most current listed licenses from https://spdx.org/licenses - using locally cached licenses: "+ex.getMessage()+
122-
" Note: you can set the org.spdx.useJARLicenseInfoOnly property to true to avoid this warning.");
122+
logger.warn("Unable to access the most current listed licenses from https://spdx.org/licenses - using locally cached licenses: {} Note: you can set the org.spdx.useJARLicenseInfoOnly property to true to avoid this warning.", ex.getMessage());
123123
baseModelStore = null;
124124
}
125125
}
@@ -142,7 +142,7 @@ private void initializeLicenseModelStore() {
142142

143143
public static ListedLicenses getListedLicenses() {
144144

145-
ListedLicenses retval = null;
145+
ListedLicenses retval;
146146
listedLicenseModificationLock.readLock().lock();
147147
try {
148148
retval = listedLicenses;
@@ -167,7 +167,7 @@ public static ListedLicenses getListedLicenses() {
167167
* Resets all of the cached license information and reloads the license IDs
168168
* NOTE: This method should be used with caution, it will negatively impact
169169
* performance.
170-
* @return
170+
* @return a new instance of this class
171171
*/
172172
public static ListedLicenses resetListedLicenses() {
173173
listedLicenseModificationLock.writeLock().lock();
@@ -199,7 +199,7 @@ public boolean isSpdxListedExceptionId(String exceptionId) {
199199
/**
200200
* @param licenseId SPDX Listed License ID
201201
* @return an SPDX spec version 2 SPDX listed license or null if the ID is not in the SPDX license list
202-
* @throws InvalidSPDXAnalysisException
202+
* @throws InvalidSPDXAnalysisException on SPDX parsing error
203203
*/
204204
public SpdxListedLicense getListedLicenseByIdCompatV2(String licenseId) throws InvalidSPDXAnalysisException {
205205
try {
@@ -214,7 +214,7 @@ public SpdxListedLicense getListedLicenseByIdCompatV2(String licenseId) throws I
214214
/**
215215
* @param exceptionId SPDX Listed License Exception ID
216216
* @return an SPDX spec version 2 SPDX listed license exception or null if the ID is not in the SPDX license list
217-
* @throws InvalidSPDXAnalysisException
217+
* @throws InvalidSPDXAnalysisException on SPDX parsing error
218218
*/
219219
public org.spdx.library.model.v2.license.ListedLicenseException getListedExceptionByIdCompatV2(String exceptionId) throws InvalidSPDXAnalysisException {
220220
try {
@@ -229,7 +229,7 @@ public org.spdx.library.model.v2.license.ListedLicenseException getListedExcepti
229229
/**
230230
* @param licenseId SPDX Listed License ID
231231
* @return SPDX listed license or null if the ID is not in the SPDX license list
232-
* @throws InvalidSPDXAnalysisException
232+
* @throws InvalidSPDXAnalysisException on SPDX parsing error
233233
*/
234234
public ListedLicense getListedLicenseById(String licenseId) throws InvalidSPDXAnalysisException {
235235
try {
@@ -265,7 +265,7 @@ public List<String> getSpdxListedLicenseIds() {
265265

266266
/**
267267
* @return The version of the loaded license list in the form M.N, where M is the major release and N is the minor release.
268-
* If no license list is loaded, returns {@link org.spdx.storage.listedlicense.SpdxListedLicenseModelStore#DEFAULT_LICENSE_LIST_VERSION}.
268+
* If no license list is loaded, returns the default license list version.
269269
*/
270270
public String getLicenseListVersion() {
271271
return this.baseModelStore.getLicenseListVersion();

0 commit comments

Comments
 (0)