Source:
<code>public void processFiles(Iterable<File> files) { try { JAXBContext context = JAXBContext.newInstance("org.atlasapi.remotesite.pa.channels.bindings"); Unmarshaller unmarshaller = context.createUnmarshaller(); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); XMLReader reader = factory.newSAXParser().getXMLReader(); reader.setContentHandler(unmarshaller.getUnmarshallerHandler()); File latestFile = null; DateTime latestTime = null; for (File file : files) { if(!shouldContinue()) { break; } final String filename = file.toURI().toString(); Matcher matcher = FILEDATE.matcher(filename); if (matcher.matches()) { DateTime startTime = FILEDATETIME_FORMAT.parseDateTime(matcher.group(1)); if (latestTime == null) { latestFile = file; latestTime = startTime; } else { if (startTime.isAfter(latestTime)) { log.info("Not processing file " + latestFile.toString() + " as file has been superseded by one that is more recent"); <START> FileUploadResult.failedUpload(SERVICE, latestFile.getName()).withMessage("Outdated file"); <END> latestFile = file; latestTime = startTime; } } } else { log.info("Not processing file " + file.toString() + " as filename format is not recognised"); FileUploadResult.failedUpload(SERVICE, file.getName()).withMessage("Format not recognised"); } } if (latestFile == null) { throw new RuntimeException("Found no files which matched"); } try { log.info("Processing file " + latestFile.toString()); final File fileToProcess = dataStore.copyForProcessing(latestFile); unmarshaller.setListener(channelsProcessingListener()); reader.parse(fileToProcess.toURI().toString()); FileUploadResult.successfulUpload(SERVICE, latestFile.getName()); } catch (Exception e) { FileUploadResult.failedUpload(SERVICE, latestFile.getName()).withCause(e); log.error("Error processing file " + latestFile.toString(), e); } reportStatus(String.format("found %s files, processed latest file: %s", Iterables.size(files), latestFile.getName())); } catch (Exception e) { log.error("Exception running PA channels updater", e); Throwables.propagate(e); } }</code><technical_language>Is this a failed status? This is expected</technical_language>

Target:
public void processFiles(Iterable<File> files) { try { JAXBContext context = JAXBContext.newInstance("org.atlasapi.remotesite.pa.channels.bindings"); Unmarshaller unmarshaller = context.createUnmarshaller(); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); XMLReader reader = factory.newSAXParser().getXMLReader(); reader.setContentHandler(unmarshaller.getUnmarshallerHandler()); File latestFile = null; DateTime latestTime = null; for (File file : files) { if(!shouldContinue()) { break; } final String filename = file.toURI().toString(); Matcher matcher = FILEDATE.matcher(filename); if (matcher.matches()) { DateTime startTime = FILEDATETIME_FORMAT.parseDateTime(matcher.group(1)); if (latestTime == null) { latestFile = file; latestTime = startTime; } else { if (startTime.isAfter(latestTime)) { log.info("Not processing file " + latestFile.toString() + " as file has been superseded by one that is more recent"); FileUploadResult.failedUpload(SERVICE, latestFile.getName()).withMessage("Outdated file"); latestFile = file; latestTime = startTime; } } } else { log.info("Not processing file " + file.toString() + " as filename format is not recognised"); FileUploadResult.successfulUpload(SERVICE, file.getName()).withMessage("Format not recognised"); } } if (latestFile == null) { throw new RuntimeException("Found no files which matched"); } try { log.info("Processing file " + latestFile.toString()); reportStatus(String.format("processed latest file: %s", latestFile.getName())); final File fileToProcess = dataStore.copyForProcessing(latestFile); unmarshaller.setListener(channelsProcessingListener()); reader.parse(fileToProcess.toURI().toString()); FileUploadResult.successfulUpload(SERVICE, latestFile.getName()); } catch (Exception e) { FileUploadResult.failedUpload(SERVICE, latestFile.getName()).withCause(e); Throwables.propagate(e); } reportStatus(String.format("found %s files, processed latest file: %s", Iterables.size(files), latestFile.getName())); } catch (Exception e) { log.error("Exception running PA channels updater", e); Throwables.propagate(e); } }