Skip to content

Commit aee83ec

Browse files
Shaik AsaduddinShaik Asaduddin
Shaik Asaduddin
authored and
Shaik Asaduddin
committedMar 25, 2022
chore: performed extract method code rafactoring when adding error messages in retrieval list
1 parent d8cbabb commit aee83ec

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
 

‎src/org/spdx/html/FileContext.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,16 @@ public String spdxId() {
8181
return spdxFile.getId();
8282
}
8383

84+
public List<String> fileInfoErrorWithRetrievalList(String errorMessage) {
85+
List<String> retval = Lists.newArrayList();
86+
retval.add(errorMessage);
87+
return retval;
88+
}
89+
8490
public List<String> checksums() {
91+
8592
if (spdxFile == null) {
86-
List<String> retval = Lists.newArrayList();
87-
retval.add("Error getting SPDX file information: "+ (error != null ? error.getMessage() : "null"));
88-
return retval;
93+
return fileInfoErrorWithRetrievalList("Error getting SPDX file information: "+ (error != null ? error.getMessage() : "null"));
8994
}
9095
Checksum[] fileChecksums = this.spdxFile.getChecksums();
9196
if (fileChecksums == null || fileChecksums.length ==0) {
@@ -102,9 +107,7 @@ public List<String> checksums() {
102107

103108
public List<String> fileType() {
104109
if (spdxFile == null && error != null) {
105-
List<String> retval = Lists.newArrayList();
106-
retval.add("Error getting SPDX file information: "+error.getMessage());
107-
return retval;
110+
return fileInfoErrorWithRetrievalList("Error getting SPDX file information: "+error.getMessage());
108111
} else {
109112
if (spdxFile != null && spdxFile.getFileTypes() != null &&
110113
spdxFile.getFileTypes().length > 0) {

0 commit comments

Comments
 (0)
Please sign in to comment.