private static FPID readPatch(XMLExtendedStreamReader reader, FeaturePackDepsConfigBuilder<?> depsBuilder) throws XMLStreamException { FeaturePackLocation fpl = null; for (int i = 0; i < reader.getAttributeCount(); i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i).getLocalPart()); switch (attribute) { case ID: fpl = parseFpl(reader, i); break; default: throw ParsingUtils.unexpectedContent(reader); } } if(fpl == null) { throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.ID)); } ParsingUtils.parseNoContent(reader); fpl = resolveUniverse(depsBuilder, fpl); return fpl.getFPID(); }
private void parsePatchFor(final XMLExtendedStreamReader reader, FeaturePackSpec.Builder builder) throws XMLStreamException { final int count = reader.getAttributeCount(); FPID patchFor = null; for (int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i).getLocalPart()); switch (attribute) { case FOR: final FeaturePackLocation location; try { location = FeaturePackLocation.fromString(reader.getAttributeValue(i)); } catch(IllegalArgumentException e) { throw new XMLStreamException("Failed to parse patch for FPID '" + reader.getAttributeValue(i) + "'", e); } patchFor = ProvisioningXmlParser20.resolveUniverse(builder, location).getFPID(); break; default: throw ParsingUtils.unexpectedContent(reader); } } if (patchFor == null) { throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.FOR)); } ParsingUtils.parseNoContent(reader); if(patchFor.getBuild() == null) { throw new XMLStreamException("Build number is missing for the version the patch is applied to: " + patchFor); } builder.setPatchFor(patchFor); }
location = resolveUniverse(builder, location);