Source:
public Object apply(Resource input) { final InputStream fis; try { fis = input.getInputStream(); } catch (IOException e) { if (this.options == null || this.options.isFailOnError()) { throw new RuntimeException("Failed to create InputStream for: " + input, e); } logger.warn("Failed to create InputStream, resource will be ignored: {}", input); return null; } final PortalDataKey portalDataKey; final BufferedXMLEventReader xmlEventReader; try { xmlEventReader = new BufferedXMLEventReader(this.xmlInputFactory.createXMLEventReader(fis), -1); final StartElement rootElement = StaxUtils.getRootElement(xmlEventReader); portalDataKey = new PortalDataKey(rootElement); } catch (Exception e) { if (this.options != null && !this.options.isIngoreNonDataFiles()) { throw new RuntimeException("Failed to parse: " + input, e); } logger.warn("Failed to parse resource, it will be ignored: {}", input); return null; } finally { IOUtils.closeQuietly(fis); } xmlEventReader.reset(); final IPortalDataType portalDataType = this.dataKeyTypes.get(portalDataKey); if (portalDataType == null) { Iterator<PortalDataKey> iter = dataKeyTypes.keySet().iterator(); logger.warn("---------------- Keys:-------------------"); while(iter.hasNext()) { PortalDataKey key = iter.next(); logger.warn("{}",key); } logger.warn("No IPortalDataType configured for {}, the resource will be ignored: {}", portalDataKey, input); return null; } final String resourceUri = ResourceUtils.getResourceUri(input); final Set<PortalDataKey> processedPortalDataKeys = portalDataType.postProcessPortalDataKey(resourceUri, portalDataKey, xmlEventReader); xmlEventReader.reset(); for (final PortalDataKey processedPortalDataKey : processedPortalDataKeys) { Queue<Resource> queue = this.dataToImport.get(processedPortalDataKey); if (queue == null) { queue = ConcurrentMapUtils.putIfAbsent(this.dataToImport, processedPortalDataKey, new ConcurrentLinkedQueue<Resource>()); } queue.offer(input); count.incrementAndGet(); } return null; }

Target:
public Object apply(Resource input) { final InputStream fis; try { fis = input.getInputStream(); } catch (IOException e) { if (this.options == null || this.options.isFailOnError()) { throw new RuntimeException("Failed to create InputStream for: " + input, e); } logger.warn("Failed to create InputStream, resource will be ignored: {}", input); return null; } final PortalDataKey portalDataKey; final BufferedXMLEventReader xmlEventReader; try { xmlEventReader = new BufferedXMLEventReader(this.xmlInputFactory.createXMLEventReader(fis), -1); final StartElement rootElement = StaxUtils.getRootElement(xmlEventReader); portalDataKey = new PortalDataKey(rootElement); } catch (Exception e) { if (this.options != null && !this.options.isIngoreNonDataFiles()) { throw new RuntimeException("Failed to parse: " + input, e); } logger.warn("Failed to parse resource, it will be ignored: {}", input); return null; } finally { IOUtils.closeQuietly(fis); } xmlEventReader.reset(); final IPortalDataType portalDataType = this.dataKeyTypes.get(portalDataKey); if (portalDataType == null) { Iterator<PortalDataKey> iter = dataKeyTypes.keySet().iterator(); StringBuffer potentialKeys = new StringBuffer(); potentialKeys.append("---------------- Potential Keys To Match -------------------"); while(iter.hasNext()) { PortalDataKey key = iter.next(); potentialKeys.append(key + "\n"); } logger.warn("{}No IPortalDataType configured for {}, the resource will be ignored: {}", potentialKeys, portalDataKey, input); return null; } final String resourceUri = ResourceUtils.getResourceUri(input); final Set<PortalDataKey> processedPortalDataKeys = portalDataType.postProcessPortalDataKey(resourceUri, portalDataKey, xmlEventReader); xmlEventReader.reset(); for (final PortalDataKey processedPortalDataKey : processedPortalDataKeys) { Queue<Resource> queue = this.dataToImport.get(processedPortalDataKey); if (queue == null) { queue = ConcurrentMapUtils.putIfAbsent(this.dataToImport, processedPortalDataKey, new ConcurrentLinkedQueue<Resource>()); } queue.offer(input); count.incrementAndGet(); } return null; }