Skip to content

Commit

Permalink
Merge pull request #207 from spdx/cleanup
Browse files Browse the repository at this point in the history
General code cleanup
  • Loading branch information
goneall committed Sep 22, 2023
2 parents d4bf741 + 1126990 commit e850e4b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,9 +32,6 @@
*/
public class SpdxListedLicenseWebStore extends SpdxListedLicenseModelStore {

private static final Logger logger = LoggerFactory.getLogger(SpdxListedLicenseModelStore.class);


/**
* @throws InvalidSPDXAnalysisException
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/spdx/utility/DownloadCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/spdx/utility/compare/SpdxItemComparer.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ public SpdxItemComparer(Map<SpdxDocument, Map<SpdxDocument, Map<String, String>>
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<String> oName = spdxItem.getName();
if (this.name == null) {
if (oName.isPresent()) {
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;
Expand Down Expand Up @@ -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");
}
}

Expand All @@ -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");
}
}

Expand Down

0 comments on commit e850e4b

Please sign in to comment.