Skip to content

Commit

Permalink
Merge pull request #291 from asadshaik1103/issue290
Browse files Browse the repository at this point in the history
Extract method code rafactoring in FileContext
  • Loading branch information
goneall committed Mar 27, 2022
2 parents d8cbabb + aee83ec commit 0ff34cd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/org/spdx/html/FileContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,16 @@ public String spdxId() {
return spdxFile.getId();
}

public List<String> fileInfoErrorWithRetrievalList(String errorMessage) {
List<String> retval = Lists.newArrayList();
retval.add(errorMessage);
return retval;
}

public List<String> checksums() {

if (spdxFile == null) {
List<String> retval = Lists.newArrayList();
retval.add("Error getting SPDX file information: "+ (error != null ? error.getMessage() : "null"));
return retval;
return fileInfoErrorWithRetrievalList("Error getting SPDX file information: "+ (error != null ? error.getMessage() : "null"));
}
Checksum[] fileChecksums = this.spdxFile.getChecksums();
if (fileChecksums == null || fileChecksums.length ==0) {
Expand All @@ -102,9 +107,7 @@ public List<String> checksums() {

public List<String> fileType() {
if (spdxFile == null && error != null) {
List<String> retval = Lists.newArrayList();
retval.add("Error getting SPDX file information: "+error.getMessage());
return retval;
return fileInfoErrorWithRetrievalList("Error getting SPDX file information: "+error.getMessage());
} else {
if (spdxFile != null && spdxFile.getFileTypes() != null &&
spdxFile.getFileTypes().length > 0) {
Expand Down

0 comments on commit 0ff34cd

Please sign in to comment.