Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ buildNumber.properties
.settings/

# IntelliJ IDE files
.idea/
.idea/
*.iml
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,17 @@
<dependency>
<groupId>org.spdx</groupId>
<artifactId>spdx-java-model-2_X</artifactId>
<version>0.1.0-Alpha</version>
<version>1.0.0-RC1</version>
</dependency>
<dependency>
<groupId>org.spdx</groupId>
<artifactId>spdx-java-core</artifactId>
<version>0.1.0-Alpha</version>
<version>1.0.0-RC1</version>
</dependency>
<dependency>
<groupId>org.spdx</groupId>
<artifactId>spdx-java-model-3_0</artifactId>
<version>0.1.0-Alpha</version>
<version>1.0.0-RC1</version>
</dependency>
</dependencies>

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/spdx/Configuration.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* Copyright (c) 2023 Source Auditor Inc.
*
* <p>
* SPDX-License-Identifier: Apache-2.0
*
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -27,9 +27,9 @@
/**
* The configuration class for the Spdx-Java-Library. When a caller attempts to retrieve a configuration property, it
* will first be checked in the Java system properties (i.e. set via `-D` command line options to the JVM, or by
* programmatic calls to `System.setProperty()` in code), and will then fallback on a properties file in the classpath.
* programmatic calls to `System.setProperty()` in code), and will then fall back on a properties file in the classpath.
* That file must be called `/resources/spdx-java-library.properties`.
*
* <p>
* Please see the documentation for specifics on what configuration options Spdx-Java-Library supports, and how they
* impact the library's behavior.
*/
Expand Down Expand Up @@ -100,15 +100,15 @@ private static Properties loadProperties(final String propertiesFileName) {
}
} catch (IOException e) {
// Ignore it and fall through
logger.warn("IO Exception reading configuration properties file '" + propertiesFileName + "': " + e.getMessage(), e);
logger.warn("IO Exception reading configuration properties file '{}': {}", propertiesFileName, e.getMessage(), e);
result = null;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
// Ignore it and fall through
logger.warn("Unable to close configuration properties file '" + propertiesFileName + "': " + e.getMessage(), e);
logger.warn("Unable to close configuration properties file '{}': {}", propertiesFileName, e.getMessage(), e);
}
}
}
Expand Down
22 changes: 12 additions & 10 deletions src/main/java/org/spdx/library/LicenseInfoFactory.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* Copyright (c) 2019 Source Auditor Inc.
*
* <p>
* SPDX-License-Identifier: Apache-2.0
*
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -44,9 +44,11 @@
* Factory for creating SPDXLicenseInfo objects from a Jena model
* @author Gary O'Neall
*/
@SuppressWarnings("unused")
public class LicenseInfoFactory {

static final Logger logger = LoggerFactory.getLogger(LicenseInfoFactory.class.getName());
@SuppressWarnings("unused")
static final Logger logger = LoggerFactory.getLogger(LicenseInfoFactory.class.getName());

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

/**
* @return Array of all SPDX listed license IDs
* @return List of all SPDX listed license IDs
*/
public static List<String> getSpdxListedLicenseIds() {
return ListedLicenses.getListedLicenses().getSpdxListedLicenseIds();
Expand All @@ -234,7 +236,7 @@ public static boolean isSpdxListedExceptionId(String id) {
/**
* @param id ID for the listed exception
* @return the standard SPDX license exception or null if the ID is not in the SPDX license list
* @throws InvalidSPDXAnalysisException
* @throws InvalidSPDXAnalysisException On SPDX parsing errors
*/
public static ListedLicenseException getListedExceptionById(String id) throws InvalidSPDXAnalysisException {
return ListedLicenses.getListedLicenses().getListedExceptionById(id);
Expand All @@ -243,7 +245,7 @@ public static ListedLicenseException getListedExceptionById(String id) throws In
/**
* @param id ID for the listed exception
* @return the standard SPDX license exception in SPDX Spec V2.X format or null if the ID is not in the SPDX license list
* @throws InvalidSPDXAnalysisException
* @throws InvalidSPDXAnalysisException On SPDX parsing errors
*/
public static org.spdx.library.model.v2.license.ListedLicenseException getListedExceptionV2ById(String id) throws InvalidSPDXAnalysisException {
return ListedLicenses.getListedLicenses().getListedExceptionByIdCompatV2(id);
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/org/spdx/library/ListedLicenses.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* Copyright (c) 2019 Source Auditor Inc.
*
* <p>
* SPDX-License-Identifier: Apache-2.0
*
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -50,6 +50,7 @@
* @author Gary O'Neall
*
*/
@SuppressWarnings({"UnusedReturnValue", "unused"})
public class ListedLicenses {

static final Logger logger = LoggerFactory.getLogger(ListedLicenses.class.getName());
Expand Down Expand Up @@ -95,13 +96,13 @@ private static Properties loadLicenseProperties() {
}
} catch (IOException e) {
// Ignore it and fall through
logger.warn("IO Exception reading listed license properties file: " + e.getMessage());
logger.warn("IO Exception reading listed license properties file: {}", e.getMessage());
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
logger.warn("Unable to close listed license properties file: " + e.getMessage());
logger.warn("Unable to close listed license properties file: {}", e.getMessage());
}
}
}
Expand All @@ -118,8 +119,7 @@ private void initializeLicenseModelStore() {
try {
baseModelStore = new SpdxListedLicenseWebStore();
} catch(InvalidSPDXAnalysisException ex) {
logger.warn("Unable to access the most current listed licenses from https://spdx.org/licenses - using locally cached licenses: "+ex.getMessage()+
" Note: you can set the org.spdx.useJARLicenseInfoOnly property to true to avoid this warning.");
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());
baseModelStore = null;
}
}
Expand All @@ -142,7 +142,7 @@ private void initializeLicenseModelStore() {

public static ListedLicenses getListedLicenses() {

ListedLicenses retval = null;
ListedLicenses retval;
listedLicenseModificationLock.readLock().lock();
try {
retval = listedLicenses;
Expand All @@ -167,7 +167,7 @@ public static ListedLicenses getListedLicenses() {
* Resets all of the cached license information and reloads the license IDs
* NOTE: This method should be used with caution, it will negatively impact
* performance.
* @return
* @return a new instance of this class
*/
public static ListedLicenses resetListedLicenses() {
listedLicenseModificationLock.writeLock().lock();
Expand Down Expand Up @@ -199,7 +199,7 @@ public boolean isSpdxListedExceptionId(String exceptionId) {
/**
* @param licenseId SPDX Listed License ID
* @return an SPDX spec version 2 SPDX listed license or null if the ID is not in the SPDX license list
* @throws InvalidSPDXAnalysisException
* @throws InvalidSPDXAnalysisException on SPDX parsing error
*/
public SpdxListedLicense getListedLicenseByIdCompatV2(String licenseId) throws InvalidSPDXAnalysisException {
try {
Expand All @@ -214,7 +214,7 @@ public SpdxListedLicense getListedLicenseByIdCompatV2(String licenseId) throws I
/**
* @param exceptionId SPDX Listed License Exception ID
* @return an SPDX spec version 2 SPDX listed license exception or null if the ID is not in the SPDX license list
* @throws InvalidSPDXAnalysisException
* @throws InvalidSPDXAnalysisException on SPDX parsing error
*/
public org.spdx.library.model.v2.license.ListedLicenseException getListedExceptionByIdCompatV2(String exceptionId) throws InvalidSPDXAnalysisException {
try {
Expand All @@ -229,7 +229,7 @@ public org.spdx.library.model.v2.license.ListedLicenseException getListedExcepti
/**
* @param licenseId SPDX Listed License ID
* @return SPDX listed license or null if the ID is not in the SPDX license list
* @throws InvalidSPDXAnalysisException
* @throws InvalidSPDXAnalysisException on SPDX parsing error
*/
public ListedLicense getListedLicenseById(String licenseId) throws InvalidSPDXAnalysisException {
try {
Expand Down Expand Up @@ -265,7 +265,7 @@ public List<String> getSpdxListedLicenseIds() {

/**
* @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.
* If no license list is loaded, returns {@link org.spdx.storage.listedlicense.SpdxListedLicenseModelStore#DEFAULT_LICENSE_LIST_VERSION}.
* If no license list is loaded, returns the default license list version.
*/
public String getLicenseListVersion() {
return this.baseModelStore.getLicenseListVersion();
Expand Down
Loading
Loading