diff --git a/common/source/java/ch/systemsx/cisd/common/utilities/DirectoryScanningTimerTask.java b/common/source/java/ch/systemsx/cisd/common/utilities/DirectoryScanningTimerTask.java index 2a0fb7b4cdcba927dc2f1f09d37a4a0823b1fba5..51545773333c599c9d0190afbb9550c4b18f8bdd 100644 --- a/common/source/java/ch/systemsx/cisd/common/utilities/DirectoryScanningTimerTask.java +++ b/common/source/java/ch/systemsx/cisd/common/utilities/DirectoryScanningTimerTask.java @@ -114,36 +114,42 @@ public final class DirectoryScanningTimerTask extends TimerTask implements ISelf @Override public void run() { - if (operationLog.isTraceEnabled()) - { - operationLog.trace("Start scanning directory."); - } - checkForFaultyPathsFileChanged(); - final File[] paths = listFiles(); - if (paths == null) // Means: error reading directory listing + try { - return; - } - // Sort in order of "oldest first" in order to move older items before newer items. This becomes important when - // doing online quality control of measurements. - Arrays.sort(paths, new Comparator<File>() + if (operationLog.isTraceEnabled()) + { + operationLog.trace("Start scanning directory."); + } + checkForFaultyPathsFileChanged(); + final File[] paths = listFiles(); + if (paths == null) // Means: error reading directory listing { - public int compare(File o1, File o2) + return; + } + // Sort in order of "oldest first" in order to move older items before newer items. This becomes important when + // doing online quality control of measurements. + Arrays.sort(paths, new Comparator<File>() + { + public int compare(File o1, File o2) + { + return (int) (o1.lastModified() - o2.lastModified()); + } + }); + for (File path : paths) + { + if (faultyPathsFile.equals(path)) // Never touch the faultyPathsFile. { - return (int) (o1.lastModified() - o2.lastModified()); + continue; } - }); - for (File path : paths) - { - if (faultyPathsFile.equals(path)) // Never touch the faultyPathsFile. + handle(path); + } + if (operationLog.isTraceEnabled()) { - continue; + operationLog.trace("Finished scanning directory."); } - handle(path); - } - if (operationLog.isTraceEnabled()) + } catch (Exception ex) { - operationLog.trace("Finished scanning directory."); + notificationLog.error("An exception has occurred.", ex); } }