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.
5050 * @author Gary O'Neall
5151 *
5252 */
53+ @ SuppressWarnings ({"UnusedReturnValue" , "unused" })
5354public 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