Source:
private void uploadIngestFiles(Document foxml, PID pid) throws DepositException { for (Element cLocation : FOXMLJDOMUtil.getFileLocators(foxml)) { String ref = cLocation.getAttributeValue("REF"); String newref = null; try { URI uri = new URI(ref); if (uri.getScheme() == null || uri.getScheme().contains("file")) { try { String path = uri.getPath(); File file = getDepositDirectory().toPath().resolve(path).toFile(); if (!file.toPath().toAbsolutePath().startsWith(getDepositDirectory().toPath().toAbsolutePath())) { throw new ServiceException("File path was outside the deposit directory"); } if (!file.exists()) { throw new IOException("File not found"); } log.debug("uploading " + file.getPath()); newref = client.upload(file); cLocation.setAttribute("REF", newref); } catch (IOException e) { throw new DepositException("Data file missing: " + ref, e); } catch (ServiceException e) { throw new DepositException("Problem uploading file: " + ref, e); } } else if (uri.getScheme().contains("premisEvents")) { try { File file = new File(getEventsDirectory(), ref.substring(ref.indexOf(":") + 1)); Document premis = new SAXBuilder().build(file); getEventLog().logEvent(PremisEventLogger.Type.INGESTION, "ingested as PID:" + pid.getPid(), pid); getEventLog().appendLogEvents(pid, premis.getRootElement()); log.debug("uploading " + file.getPath()); newref = client.upload(premis); cLocation.setAttribute("REF", newref); } catch (Exception e) { throw new DepositException("There was a problem uploading ingest events" + ref, e); } } else { continue; } } catch (URISyntaxException e) { throw new DepositException("Bad URI syntax for file ref", e); } log.debug("uploaded " + ref + " to Fedora " + newref + " for " + pid); } }

Target:
private void uploadIngestFiles(Document foxml, PID pid) throws DepositException { for (Element cLocation : FOXMLJDOMUtil.getFileLocators(foxml)) { String ref = cLocation.getAttributeValue("REF"); String newref = null; try { URI uri = new URI(ref); if (uri.getScheme() == null || uri.getScheme().contains("file")) { try { String path = uri.getPath(); File file = getDepositDirectory().toPath().resolve(path).toFile(); if (!file.toPath().toAbsolutePath().startsWith(getDepositDirectory().toPath().toAbsolutePath())) { throw new ServiceException("File path was outside the deposit directory"); } if (!file.exists()) { throw new IOException("File not found: " + ref); } log.debug("uploading " + file.getPath()); newref = client.upload(file); cLocation.setAttribute("REF", newref); } catch (IOException e) { throw new DepositException("Data file missing: " + ref, e); } catch (ServiceException e) { throw new DepositException("Problem uploading file: " + ref, e); } } else if (uri.getScheme().contains("premisEvents")) { try { File file = new File(getEventsDirectory(), ref.substring(ref.indexOf(":") + 1)); Document premis = new SAXBuilder().build(file); getEventLog().logEvent(PremisEventLogger.Type.INGESTION, "ingested as PID:" + pid.getPid(), pid); getEventLog().appendLogEvents(pid, premis.getRootElement()); log.debug("uploading " + file.getPath()); newref = client.upload(premis); cLocation.setAttribute("REF", newref); } catch (Exception e) { throw new DepositException("There was a problem uploading ingest events" + ref, e); } } else { continue; } } catch (URISyntaxException e) { throw new DepositException("Bad URI syntax for file ref", e); } log.debug("uploaded " + ref + " to Fedora " + newref + " for " + pid); } }