Refactor: Rename fields and methods, return early

This commit is contained in:
chimp1984 2020-10-01 16:46:09 -05:00
parent 802dcad2fb
commit d27e4dc249
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3

View File

@ -29,28 +29,28 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@Singleton
public class CorruptedStorageFileHandler {
private final List<String> corruptedDatabaseFiles = new ArrayList<>();
private final List<String> files = new ArrayList<>();
@Inject
public CorruptedStorageFileHandler() {
}
public void onFileCorrupted(String fileName) {
corruptedDatabaseFiles.add(fileName);
public void addFile(String fileName) {
files.add(fileName);
}
public Optional<List<String>> getCorruptedDatabaseFiles() {
if (!corruptedDatabaseFiles.isEmpty()) {
if (corruptedDatabaseFiles.size() == 1 && corruptedDatabaseFiles.get(0).equals("ViewPathAsString")) {
log.debug("We detected incompatible data base file for Navigation. " +
"That is a minor issue happening with refactoring of UI classes " +
"and we don't display a warning popup to the user.");
return Optional.empty();
} else {
return Optional.of(corruptedDatabaseFiles);
}
} else {
public Optional<List<String>> getFiles() {
if (files.isEmpty()) {
return Optional.empty();
}
if (files.size() == 1 && files.get(0).equals("ViewPathAsString")) {
log.debug("We detected incompatible data base file for Navigation. " +
"That is a minor issue happening with refactoring of UI classes " +
"and we don't display a warning popup to the user.");
return Optional.empty();
}
return Optional.of(files);
}
}