1
1
/**
2
2
* Copyright (c) 2019 Source Auditor Inc.
3
- *
3
+ * <p>
4
4
* SPDX-License-Identifier: Apache-2.0
5
- *
5
+ * <p>
6
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
7
* you may not use this file except in compliance with the License.
8
8
* You may obtain a copy of the License at
9
- *
9
+ * <p>
10
10
* http://www.apache.org/licenses/LICENSE-2.0
11
- *
11
+ * <p>
12
12
* Unless required by applicable law or agreed to in writing, software
13
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50
50
* @author Gary O'Neall
51
51
*
52
52
*/
53
+ @ SuppressWarnings ({"UnusedReturnValue" , "unused" })
53
54
public class ListedLicenses {
54
55
55
56
static final Logger logger = LoggerFactory .getLogger (ListedLicenses .class .getName ());
@@ -95,13 +96,13 @@ private static Properties loadLicenseProperties() {
95
96
}
96
97
} catch (IOException e ) {
97
98
// 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 ());
99
100
} finally {
100
101
if (in != null ) {
101
102
try {
102
103
in .close ();
103
104
} 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 ());
105
106
}
106
107
}
107
108
}
@@ -118,8 +119,7 @@ private void initializeLicenseModelStore() {
118
119
try {
119
120
baseModelStore = new SpdxListedLicenseWebStore ();
120
121
} 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 ());
123
123
baseModelStore = null ;
124
124
}
125
125
}
@@ -142,7 +142,7 @@ private void initializeLicenseModelStore() {
142
142
143
143
public static ListedLicenses getListedLicenses () {
144
144
145
- ListedLicenses retval = null ;
145
+ ListedLicenses retval ;
146
146
listedLicenseModificationLock .readLock ().lock ();
147
147
try {
148
148
retval = listedLicenses ;
@@ -167,7 +167,7 @@ public static ListedLicenses getListedLicenses() {
167
167
* Resets all of the cached license information and reloads the license IDs
168
168
* NOTE: This method should be used with caution, it will negatively impact
169
169
* performance.
170
- * @return
170
+ * @return a new instance of this class
171
171
*/
172
172
public static ListedLicenses resetListedLicenses () {
173
173
listedLicenseModificationLock .writeLock ().lock ();
@@ -199,7 +199,7 @@ public boolean isSpdxListedExceptionId(String exceptionId) {
199
199
/**
200
200
* @param licenseId SPDX Listed License ID
201
201
* @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
203
203
*/
204
204
public SpdxListedLicense getListedLicenseByIdCompatV2 (String licenseId ) throws InvalidSPDXAnalysisException {
205
205
try {
@@ -214,7 +214,7 @@ public SpdxListedLicense getListedLicenseByIdCompatV2(String licenseId) throws I
214
214
/**
215
215
* @param exceptionId SPDX Listed License Exception ID
216
216
* @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
218
218
*/
219
219
public org .spdx .library .model .v2 .license .ListedLicenseException getListedExceptionByIdCompatV2 (String exceptionId ) throws InvalidSPDXAnalysisException {
220
220
try {
@@ -229,7 +229,7 @@ public org.spdx.library.model.v2.license.ListedLicenseException getListedExcepti
229
229
/**
230
230
* @param licenseId SPDX Listed License ID
231
231
* @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
233
233
*/
234
234
public ListedLicense getListedLicenseById (String licenseId ) throws InvalidSPDXAnalysisException {
235
235
try {
@@ -265,7 +265,7 @@ public List<String> getSpdxListedLicenseIds() {
265
265
266
266
/**
267
267
* @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 .
269
269
*/
270
270
public String getLicenseListVersion () {
271
271
return this .baseModelStore .getLicenseListVersion ();
0 commit comments