Skip to content

Commit

Permalink
'#1904: Use Item's ID instead of path to check if the evidence changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
wladimirleite committed Sep 29, 2023
1 parent dd6ac34 commit 1933b15
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions iped-app/src/main/java/iped/app/processing/ui/ProgressFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class ProgressFrame extends JFrame implements PropertyChangeListener, Act
long secsToEnd;
private Date indexStart;
private Worker[] workers;
private String[] lastWorkerTaskPath;
private String[] lastWorkerTaskItemId;
private long[] lastWorkerTime;
private static final NumberFormat nf = LocalizedFormat.getNumberInstance();
private boolean paused = false;
Expand Down Expand Up @@ -264,7 +264,7 @@ public void propertyChange(PropertyChangeEvent evt) {

} else if ("workers".equals(evt.getPropertyName())) { //$NON-NLS-1$
workers = (Worker[]) evt.getNewValue();
lastWorkerTaskPath = new String[workers.length];
lastWorkerTaskItemId = new String[workers.length];
lastWorkerTime = new long[workers.length];
}

Expand All @@ -289,22 +289,21 @@ private String getItemList() {
String taskName = task == null ? null : task.getName();

IItem evidence = worker.evidence;
String evidencePath = evidence == null ? null : evidence.getPath();

String wt = "-";
int pct = -1;
if (taskName != null && evidencePath != null) {
String taskPath = taskName + evidencePath;
if (!taskPath.equals(lastWorkerTaskPath[i])) {
if (taskName != null && evidence != null) {
String taskId = taskName + evidence.getId();
if (!taskId.equals(lastWorkerTaskItemId[i])) {
lastWorkerTime[i] = now;
lastWorkerTaskPath[i] = taskPath;
lastWorkerTaskItemId[i] = taskId;
} else if (worker.state != STATE.PAUSED) {
long t = (now - lastWorkerTime[i]) / 1000;
wt = t < 60 ? t + "s" : t / 60 + "m";
pct = (int) Math.min(t / 30, 60);
}
} else {
lastWorkerTaskPath[i] = null;
lastWorkerTaskItemId[i] = null;
}

startRow(msg, worker.getName(), worker.state != STATE.PAUSED, pct);
Expand All @@ -325,7 +324,7 @@ private String getItemList() {
String len = "";
if (evidence.getLength() != null && evidence.getLength() > 0)
len = " (" + nf.format(evidence.getLength()) + " bytes)";
finishRow(msg, evidencePath + len);
finishRow(msg, evidence.getPath() + len);
} else {
finishRow(msg, Messages.getString("ProgressFrame.WaitingItem"));
}
Expand Down

0 comments on commit 1933b15

Please sign in to comment.