package eu.europa.esig.dss.asic.validation;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import eu.europa.esig.dss.DSSDocument;
import eu.europa.esig.dss.DomUtils;
import eu.europa.esig.dss.asic.ManifestNamespace;
import eu.europa.esig.dss.utils.Utils;
import eu.europa.esig.dss.validation.ManifestFile;

public class ASiCEWithXAdESManifestParser {

	private static final Logger LOG = LoggerFactory.getLogger(ASiCEWithXAdESManifestParser.class);

	static {
		DomUtils.registerNamespace("manifest", ManifestNamespace.NS);
	}

	private final DSSDocument signatureDocument;
	private final DSSDocument manifestDocument;

	public ASiCEWithXAdESManifestParser(DSSDocument signatureDocument, DSSDocument manifestDocument) {
		this.signatureDocument = signatureDocument;
		this.manifestDocument = manifestDocument;
	}

	public ManifestFile getDescription() {
		ManifestFile description = new ManifestFile();
		description.setSignatureFilename(signatureDocument.getName());
		description.setFilename(manifestDocument.getName());
		description.setEntries(getEntries());
		return description;
	}

	private List<String> getEntries() {
		List<String> result = new ArrayList<String>();
		InputStream is = null;
		try {
			is = manifestDocument.openStream();
			Document manifestDom = DomUtils.buildDOM(is);
			NodeList nodeList = DomUtils.getNodeList(manifestDom, "/manifest:manifest/manifest:file-entry");
			if (nodeList != null && nodeList.getLength() > 0) {
				for (int i = 0; i < nodeList.getLength(); i++) {
					Element fileEntryElement = (Element) nodeList.item(i);
					String fullpathValue = fileEntryElement.getAttribute(ManifestNamespace.FULL_PATH);
					if (!isContainerDefinition(fullpathValue) && !isSignatureFile(fullpathValue)) {
						result.add(fullpathValue);
					}
				}
			}
		} catch (Exception e) {
			LOG.error("Unable to parse manifest file " + manifestDocument.getName(), e);
		} finally {
			Utils.closeQuietly(is);
		}
		return result;
	}

	/**
	 * Sometimes signature files can be listed in the manifest file
	 * 
	 */
	private boolean isSignatureFile(String fullpathValue) {
		return fullpathValue.matches("META-INF/.*signature.*\\.xml");
	}

	private boolean isContainerDefinition(String fullpathValue) {
		return "/".equals(fullpathValue);
	}

}

@@ -1872,43 +1872,8 @@
 lue)
- && !isSignatureFile(fullpathValue)
 ) %7B%0A
@@ -2099,213 +2099,8 @@
 %09%7D%0A%0A
-%09/**%0A%09 * Sometimes signature files can be listed in the manifest file%0A%09 * %0A%09 */%0A%09private boolean isSignatureFile(String fullpathValue) %7B%0A%09%09return fullpathValue.matches(%22META-INF/.*signature.*%5C%5C.xml%22);%0A%09%7D%0A%0A
 %09pri

Remove wrong code