Author: [log in to unmask] Date: Wed Jul 8 11:53:26 2015 New Revision: 3250 Log: Merge in minor trunk change. Modified: java/branches/HPSJAVA-488/ (props changed) java/branches/HPSJAVA-488/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java Modified: java/branches/HPSJAVA-488/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java ============================================================================= --- java/branches/HPSJAVA-488/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java (original) +++ java/branches/HPSJAVA-488/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java Wed Jul 8 11:53:26 2015 @@ -26,6 +26,7 @@ * * @author Jeremy McCormick, SLAC */ +// FIXME: Replace this class with Freehep loop implementation, EvioFileSource, etc. final class RunProcessor { /** @@ -163,9 +164,11 @@ // Get the list of files to process, taking into account the max files setting. List<File> files = this.runSummary.getEvioFileList(); if (this.maxFiles != -1) { - LOGGER.info("limiting processing to first " + this.maxFiles + " files from max files setting"); - files = files.subList(0, this.maxFiles); - LOGGER.info("using file list with size " + files.size()); + int toIndex = this.maxFiles; + if (toIndex > files.size()) { + toIndex = files.size(); + } + files = files.subList(0, toIndex); } return files; } @@ -236,12 +239,16 @@ processor.startJob(); } + List<File> files = this.getFiles(); + + LOGGER.info("processing " + files.size() + " from run " + this.runSummary.getRun()); + // Process all the files. - for (final File file : this.getFiles()) { + for (final File file : files) { this.process(file); } - // Run the end of job hooks. + // Run the end job hooks. for (final EvioEventProcessor processor : this.processors) { processor.endJob(); } @@ -300,7 +307,7 @@ LOGGER.info("done running EVIO processors"); // Check if END event is present if this is the last file in the run. - if (file.equals(this.runSummary.getEvioFileList().last())) { + if (file.equals(getFiles().get(getFiles().size() - 1))) { final boolean endOkay = this.isEndOkay(reader); this.runSummary.setEndOkay(endOkay); LOGGER.info("endOkay set to " + endOkay); @@ -337,7 +344,7 @@ /** * Set the maximum number of files to process. * <p> - * This is primarily used for debugging purposes. + * This is intended primarily for debugging. * * @param maxFiles the maximum number of files to process */ @@ -391,7 +398,7 @@ LOGGER.config("added extra EVIO processor " + processor.getClass().getName()); } - // Process all of the runs files. + // Process all of the run's files. runProcessor.process(); } }