Source:
void parse() throws Exception { final Map<String, String> properties = getProperties("repository/properties/property"); properties.put("repoUrl", base.resolve("") .toString()); try (Processor parent = new Processor()) { parent.addProperties(properties); rules = getRules(); NodeList artifactNodes = getNodes("repository/artifacts/artifact"); for (int i = 0; i < artifactNodes.getLength(); i++) { final Node artifactNode = artifactNodes.item(i) .cloneNode(true); final XMLArtifact xmlArtifact = getFromType(artifactNode, XMLArtifact.class); Classifier classifier; if (Classifier.BUNDLE.name.equals(xmlArtifact.classifier)) { classifier = Classifier.BUNDLE; } else if (Classifier.FEATURE.name.equals(xmlArtifact.classifier)) { classifier = Classifier.FEATURE; } else { continue; } Map<String, String> artifactProperties = getProperties(artifactNode, "properties/property"); xmlArtifact.format = artifactProperties.get("format"); if ("packed".equals(xmlArtifact.format) && !Unpack200.canUnpack()) { continue; } Map<String, String> map = Converter.cnv(new TypeReference<Map<String, String>>() {}, xmlArtifact); try (Processor domain = new Processor(parent)) { domain.addProperties(map); for (Rule r : rules) { if (r.matches(map)) { String s = domain.getReplacer() .process(r.output); URI uri = new URI(s).normalize(); Artifact artifact = new Artifact(); artifact.classifier = classifier; artifact.uri = uri; artifact.id = xmlArtifact.id; artifact.version = new Version(xmlArtifact.version); artifact.md5 = artifactProperties.get("download.md5"); artifact.format = xmlArtifact.format; String download_size = artifactProperties.getOrDefault("download.size", "-1L"); try { artifact.download_size = Long.parseLong(download_size); } catch (NumberFormatException e) { artifact.download_size = -1L; } artifacts.add(artifact); break; } } } } } }

Target:
void parse() throws Exception { final Map<String, String> properties = getProperties("repository/properties/property"); properties.put("repoUrl", base.resolve("") .toString()); try (Processor parent = new Processor()) { parent.addProperties(properties); rules = getRules(); NodeList artifactNodes = getNodes("repository/artifacts/artifact"); for (int i = 0; i < artifactNodes.getLength(); i++) { final Node artifactNode = artifactNodes.item(i) .cloneNode(true); final XMLArtifact xmlArtifact = getFromType(artifactNode, XMLArtifact.class); Classifier classifier; if (Classifier.BUNDLE.name.equals(xmlArtifact.classifier)) { classifier = Classifier.BUNDLE; } else if (Classifier.FEATURE.name.equals(xmlArtifact.classifier)) { classifier = Classifier.FEATURE; } else { continue; } Map<String, String> artifactProperties = getProperties(artifactNode, "properties/property"); xmlArtifact.format = artifactProperties.get("format"); if (Artifact.FORMAT_PACKED.equals(xmlArtifact.format) && !unpack) { continue; } Map<String, String> map = Converter.cnv(new TypeReference<Map<String, String>>() {}, xmlArtifact); try (Processor domain = new Processor(parent)) { domain.addProperties(map); for (Rule r : rules) { if (r.matches(map)) { String s = domain.getReplacer() .process(r.output); URI uri = new URI(s).normalize(); Artifact artifact = new Artifact(); artifact.classifier = classifier; artifact.uri = uri; artifact.id = xmlArtifact.id; artifact.version = new Version(xmlArtifact.version); artifact.md5 = artifactProperties.get("download.md5"); artifact.format = xmlArtifact.format; String download_size = artifactProperties.getOrDefault("download.size", "-1L"); try { artifact.download_size = Long.parseLong(download_size); } catch (NumberFormatException e) { artifact.download_size = -1L; } artifacts.add(artifact); break; } } } } } }