private Map<String, AndroidManifest.MetaDataInfo> extractMetaDataQualifiedNames(NodeList metaDataNodes) { Map<String, AndroidManifest.MetaDataInfo> metaDataQualifiedNames = new HashMap<String, AndroidManifest.MetaDataInfo>(); for (int i = 0; i < metaDataNodes.getLength(); i++) { Node node = metaDataNodes.item(i); Node nameAttribute = node.getAttributes().getNamedItem("android:name"); Node valueAttribute = node.getAttributes().getNamedItem("android:value"); Node resourceAttribute = node.getAttributes().getNamedItem("android:resource"); if (nameAttribute == null || (valueAttribute == null && resourceAttribute == null)) { if (nameAttribute != null) { LOGGER.warn("A malformed <meta-data> has been found in the manifest with name {}", nameAttribute.getNodeValue()); } else { LOGGER.warn("A malformed <meta-data> has been found in the manifest"); } } else { String name = nameAttribute.getNodeValue(); String value = valueAttribute != null ? valueAttribute.getNodeValue() : null; String resource = resourceAttribute != null ? resourceAttribute.getNodeValue() : null; metaDataQualifiedNames.put(name, new AndroidManifest.MetaDataInfo(name, value, resource)); } } return metaDataQualifiedNames; }
private Map<String, AndroidManifest.MetaDataInfo> extractMetaDataQualifiedNames(NodeList metaDataNodes) { Map<String, AndroidManifest.MetaDataInfo> metaDataQualifiedNames = new HashMap<String, AndroidManifest.MetaDataInfo>(); for (int i = 0; i < metaDataNodes.getLength(); i++) { Node node = metaDataNodes.item(i); Node nameAttribute = node.getAttributes().getNamedItem("android:name"); Node valueAttribute = node.getAttributes().getNamedItem("android:value"); Node resourceAttribute = node.getAttributes().getNamedItem("android:resource"); if (nameAttribute == null || (valueAttribute == null && resourceAttribute == null)) { if (nameAttribute != null) { LOGGER.warn("A malformed <meta-data> has been found in the manifest with name {}", nameAttribute.getNodeValue()); } else { LOGGER.warn("A malformed <meta-data> has been found in the manifest"); } } else { String name = nameAttribute.getNodeValue(); String value = valueAttribute != null ? valueAttribute.getNodeValue() : null; String resource = resourceAttribute != null ? resourceAttribute.getNodeValue() : null; metaDataQualifiedNames.put(name, new AndroidManifest.MetaDataInfo(name, value, resource)); } } return metaDataQualifiedNames; }