Author: tilman
Date: Sat Mar 28 10:54:02 2026
New Revision: 1932608
Log:
PDFBOX-5660: refactor
Modified:
pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RecentFiles.java
Modified:
pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RecentFiles.java
==============================================================================
---
pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RecentFiles.java
Sat Mar 28 10:42:24 2026 (r1932607)
+++
pdfbox/branches/3.0/debugger/src/main/java/org/apache/pdfbox/debugger/ui/RecentFiles.java
Sat Mar 28 10:54:02 2026 (r1932608)
@@ -51,10 +51,6 @@ public class RecentFiles
this.maximum = maximumFile;
this.pref = Preferences.userNodeForPackage(className);
filePaths = readHistoryFromPref();
- if (filePaths == null)
- {
- filePaths = new ArrayDeque<>();
- }
}
/**
@@ -108,18 +104,14 @@ public class RecentFiles
*/
public List<String> getFiles()
{
- if (!isEmpty())
+ List<String> files = filePaths.stream().
+ filter(path -> new File(path).exists()).
+ collect(Collectors.toList());
+ if (files.size() > maximum)
{
- List<String> files = filePaths.stream().
- filter(path -> new File(path).exists()).
- collect(Collectors.toList());
- if (files.size() > maximum)
- {
- files.remove(0);
- }
- return files;
+ files.remove(0);
}
- return null;
+ return files;
}
/**
@@ -175,12 +167,7 @@ public class RecentFiles
{
Preferences node = pref.node(KEY);
int historyLength = node.getInt(HISTORY_LENGTH, 0);
- if (historyLength == 0)
- {
- return null;
- }
Queue<String> history = new ArrayDeque<>();
-
for (int i = 1; i <= historyLength; i++)
{
int totalPieces = node.getInt(String.format(PIECES_LENGTH_KEY, i),
0);