diff --git a/src/main/java/org/spdx/library/model/license/ListedLicenses.java b/src/main/java/org/spdx/library/model/license/ListedLicenses.java index f390fbf2..e2e33f8a 100644 --- a/src/main/java/org/spdx/library/model/license/ListedLicenses.java +++ b/src/main/java/org/spdx/library/model/license/ListedLicenses.java @@ -17,12 +17,9 @@ */ package org.spdx.library.model.license; -import java.io.IOException; -import java.io.InputStream; import java.util.List; import java.util.Objects; import java.util.Optional; -import java.util.Properties; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; diff --git a/src/main/java/org/spdx/storage/listedlicense/SpdxListedLicenseWebStore.java b/src/main/java/org/spdx/storage/listedlicense/SpdxListedLicenseWebStore.java index 30228514..eeacb80a 100644 --- a/src/main/java/org/spdx/storage/listedlicense/SpdxListedLicenseWebStore.java +++ b/src/main/java/org/spdx/storage/listedlicense/SpdxListedLicenseWebStore.java @@ -21,8 +21,6 @@ import java.io.InputStream; import java.net.URL; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.spdx.library.InvalidSPDXAnalysisException; import org.spdx.library.SpdxConstants; import org.spdx.utility.DownloadCache; @@ -34,9 +32,6 @@ */ public class SpdxListedLicenseWebStore extends SpdxListedLicenseModelStore { - private static final Logger logger = LoggerFactory.getLogger(SpdxListedLicenseModelStore.class); - - /** * @throws InvalidSPDXAnalysisException */ diff --git a/src/main/java/org/spdx/utility/DownloadCache.java b/src/main/java/org/spdx/utility/DownloadCache.java index 9cced00a..63cc61b3 100644 --- a/src/main/java/org/spdx/utility/DownloadCache.java +++ b/src/main/java/org/spdx/utility/DownloadCache.java @@ -84,7 +84,7 @@ public final class DownloadCache { // See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html private final String cacheDir = ((System.getenv("XDG_CACHE_HOME") == null || - System.getenv("XDG_CACHE_HOME").trim() == "") ? + System.getenv("XDG_CACHE_HOME").trim().isEmpty()) ? System.getProperty("user.home") + File.separator + ".cache" : System.getenv("XDG_CACHE_HOME")) + File.separator + "Spdx-Java-Library"; diff --git a/src/main/java/org/spdx/utility/compare/SpdxItemComparer.java b/src/main/java/org/spdx/utility/compare/SpdxItemComparer.java index 8d6a92d4..3baf7203 100644 --- a/src/main/java/org/spdx/utility/compare/SpdxItemComparer.java +++ b/src/main/java/org/spdx/utility/compare/SpdxItemComparer.java @@ -93,7 +93,7 @@ public SpdxItemComparer(Map> public void addDocumentItem(SpdxDocument spdxDocument, SpdxItem spdxItem) throws SpdxCompareException, InvalidSPDXAnalysisException { if (this.itemInProgress) { - new SpdxCompareException("Trying to add a document item while another document item is being added."); + throw new SpdxCompareException("Trying to add a document item while another document item is being added."); } Optional oName = spdxItem.getName(); if (this.name == null) { @@ -101,7 +101,7 @@ public void addDocumentItem(SpdxDocument spdxDocument, this.name = oName.get(); } } else if (oName.isPresent() && !this.name.equals(oName.get()) && !(this instanceof SpdxSnippetComparer)) { - new SpdxCompareException("Names do not match for item being added to comparer: "+ + throw new SpdxCompareException("Names do not match for item being added to comparer: "+ spdxItem.getName()+", expecting "+this.name); } this.itemInProgress = true; @@ -384,7 +384,7 @@ public boolean isLicenseCommmentsEquals() throws SpdxCompareException { */ protected void checkInProgress() throws SpdxCompareException { if (itemInProgress) { - new SpdxCompareException("File compare in progress - can not obtain compare results until compare has completed"); + throw new SpdxCompareException("File compare in progress - can not obtain compare results until compare has completed"); } } @@ -393,7 +393,7 @@ protected void checkInProgress() throws SpdxCompareException { */ protected void checkCompareMade() throws SpdxCompareException { if (this.documentItem.entrySet().size() < 1) { - new SpdxCompareException("Trying to obtain results of a file compare before a file compare has been performed"); + throw new SpdxCompareException("Trying to obtain results of a file compare before a file compare has been performed"); } }