Source:
public void init() throws Exception { try { DefaultConfigurationBuilder reposConfiguration = new DefaultConfigurationBuilder(); reposConfiguration.addProperty("[@destinationURL]", destination); objectRepository = new FilePersistentObjectRepository(); objectRepository.setFileSystem(fileSystem); objectRepository.configure(reposConfiguration); objectRepository.init(); streamRepository = new FilePersistentStreamRepository(); streamRepository.setFileSystem(fileSystem); streamRepository.configure(reposConfiguration); streamRepository.init(); if (cacheKeys) keys = Collections.synchronizedSet(new HashSet<String>()); HashSet<String> streamKeys = new HashSet<>(); for (Iterator<String> i = streamRepository.list(); i.hasNext(); ) { streamKeys.add(i.next()); } HashSet<String> objectKeys = new HashSet<>(); for (Iterator<String> i = objectRepository.list(); i.hasNext(); ) { objectKeys.add(i.next()); } @SuppressWarnings("unchecked") Collection<String> strandedStreams = (Collection<String>) streamKeys.clone(); strandedStreams.removeAll(objectKeys); for (Object strandedStream : strandedStreams) { String key = (String) strandedStream; remove(key); } @SuppressWarnings("unchecked") Collection<String> strandedObjects = (Collection<String>) objectKeys.clone(); strandedObjects.removeAll(streamKeys); for (Object strandedObject : strandedObjects) { String key = (String) strandedObject; remove(key); } if (keys != null) { keys.clear(); for (Iterator<String> i = objectRepository.list(); i.hasNext(); ) { keys.add(i.next()); } } LOGGER.debug("{} created in {}", getClass().getName(), destination); } catch (Exception e) { LOGGER.error("Failed to retrieve Store component:{}", e.getMessage(), e); throw e; } }

Target:
public void init() throws Exception { try { DefaultConfigurationBuilder reposConfiguration = new DefaultConfigurationBuilder(); reposConfiguration.addProperty("[@destinationURL]", destination); objectRepository = new FilePersistentObjectRepository(); objectRepository.setFileSystem(fileSystem); objectRepository.configure(reposConfiguration); objectRepository.init(); streamRepository = new FilePersistentStreamRepository(); streamRepository.setFileSystem(fileSystem); streamRepository.configure(reposConfiguration); streamRepository.init(); if (cacheKeys) keys = Collections.synchronizedSet(new HashSet<String>()); HashSet<String> streamKeys = new HashSet<>(); for (Iterator<String> i = streamRepository.list(); i.hasNext(); ) { streamKeys.add(i.next()); } HashSet<String> objectKeys = new HashSet<>(); for (Iterator<String> i = objectRepository.list(); i.hasNext(); ) { objectKeys.add(i.next()); } @SuppressWarnings("unchecked") Collection<String> strandedStreams = (Collection<String>) streamKeys.clone(); strandedStreams.removeAll(objectKeys); for (Object strandedStream : strandedStreams) { String key = (String) strandedStream; remove(key); } @SuppressWarnings("unchecked") Collection<String> strandedObjects = (Collection<String>) objectKeys.clone(); strandedObjects.removeAll(streamKeys); for (Object strandedObject : strandedObjects) { String key = (String) strandedObject; remove(key); } if (keys != null) { keys.clear(); for (Iterator<String> i = objectRepository.list(); i.hasNext(); ) { keys.add(i.next()); } } LOGGER.debug("{} created in {}", getClass().getName(), destination); } catch (Exception e) { LOGGER.error("Failed to retrieve Store component", e); throw e; } }