Skip to content

Commit 1126990

Browse files
committed
General code cleanup
Fix issues identified by findbugs and Eclipse IDE warnings Signed-off-by: Gary O'Neall <gary@sourceauditor.com>
1 parent 150b5e2 commit 1126990

4 files changed

Lines changed: 5 additions & 13 deletions

File tree

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
1717
*/
1818
package org.spdx.library.model.license;
1919

20-
import java.io.IOException;
21-
import java.io.InputStream;
2220
import java.util.List;
2321
import java.util.Objects;
2422
import java.util.Optional;
25-
import java.util.Properties;
2623
import java.util.concurrent.locks.ReadWriteLock;
2724
import java.util.concurrent.locks.ReentrantReadWriteLock;
2825

src/main/java/org/spdx/storage/listedlicense/SpdxListedLicenseWebStore.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import java.io.InputStream;
2222
import java.net.URL;
2323

24-
import org.slf4j.Logger;
25-
import org.slf4j.LoggerFactory;
2624
import org.spdx.library.InvalidSPDXAnalysisException;
2725
import org.spdx.library.SpdxConstants;
2826
import org.spdx.utility.DownloadCache;
@@ -34,9 +32,6 @@
3432
*/
3533
public class SpdxListedLicenseWebStore extends SpdxListedLicenseModelStore {
3634

37-
private static final Logger logger = LoggerFactory.getLogger(SpdxListedLicenseModelStore.class);
38-
39-
4035
/**
4136
* @throws InvalidSPDXAnalysisException
4237
*/

src/main/java/org/spdx/utility/DownloadCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public final class DownloadCache {
8484

8585
// See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
8686
private final String cacheDir = ((System.getenv("XDG_CACHE_HOME") == null ||
87-
System.getenv("XDG_CACHE_HOME").trim() == "") ?
87+
System.getenv("XDG_CACHE_HOME").trim().isEmpty()) ?
8888
System.getProperty("user.home") + File.separator + ".cache" :
8989
System.getenv("XDG_CACHE_HOME")) +
9090
File.separator + "Spdx-Java-Library";

src/main/java/org/spdx/utility/compare/SpdxItemComparer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ public SpdxItemComparer(Map<SpdxDocument, Map<SpdxDocument, Map<String, String>>
9393
public void addDocumentItem(SpdxDocument spdxDocument,
9494
SpdxItem spdxItem) throws SpdxCompareException, InvalidSPDXAnalysisException {
9595
if (this.itemInProgress) {
96-
new SpdxCompareException("Trying to add a document item while another document item is being added.");
96+
throw new SpdxCompareException("Trying to add a document item while another document item is being added.");
9797
}
9898
Optional<String> oName = spdxItem.getName();
9999
if (this.name == null) {
100100
if (oName.isPresent()) {
101101
this.name = oName.get();
102102
}
103103
} else if (oName.isPresent() && !this.name.equals(oName.get()) && !(this instanceof SpdxSnippetComparer)) {
104-
new SpdxCompareException("Names do not match for item being added to comparer: "+
104+
throw new SpdxCompareException("Names do not match for item being added to comparer: "+
105105
spdxItem.getName()+", expecting "+this.name);
106106
}
107107
this.itemInProgress = true;
@@ -384,7 +384,7 @@ public boolean isLicenseCommmentsEquals() throws SpdxCompareException {
384384
*/
385385
protected void checkInProgress() throws SpdxCompareException {
386386
if (itemInProgress) {
387-
new SpdxCompareException("File compare in progress - can not obtain compare results until compare has completed");
387+
throw new SpdxCompareException("File compare in progress - can not obtain compare results until compare has completed");
388388
}
389389
}
390390

@@ -393,7 +393,7 @@ protected void checkInProgress() throws SpdxCompareException {
393393
*/
394394
protected void checkCompareMade() throws SpdxCompareException {
395395
if (this.documentItem.entrySet().size() < 1) {
396-
new SpdxCompareException("Trying to obtain results of a file compare before a file compare has been performed");
396+
throw new SpdxCompareException("Trying to obtain results of a file compare before a file compare has been performed");
397397
}
398398
}
399399

0 commit comments

Comments
 (0)