Bug 572343 - Avoid deprecated org.xml.sax.helpers.XMLReaderFactory

Change-Id: I5d5ca5726fc18760032476fd53e96bb5ec180c71
Signed-off-by: Ed Merks <ed.merks@gmail.com>
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/190649
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/SecureXMLUtil.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/SecureXMLUtil.java
index 202921c..0afeb29 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/SecureXMLUtil.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/SecureXMLUtil.java
@@ -16,7 +16,6 @@
 import javax.xml.XMLConstants;
 import javax.xml.parsers.*;
 import org.xml.sax.*;
-import org.xml.sax.helpers.XMLReaderFactory;
 
 /**
  * A utility class for creating an XML-related factories suitable for
@@ -52,10 +51,11 @@
 	 * Create a new {@link XMLReader}.
 	 *
 	 * @throws SAXException
+	 * @throws ParserConfigurationException
 	 */
-	public static XMLReader newSecureXMLReader() throws SAXException {
-		XMLReader reader = XMLReaderFactory.createXMLReader();
-		reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-		return reader;
+	public static XMLReader newSecureXMLReader() throws SAXException, ParserConfigurationException {
+		SAXParserFactory factory = newSecureSAXParserFactory();
+		factory.setNamespaceAware(true);
+		return factory.newSAXParser().getXMLReader();
 	}
 }
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF
index 277ae2f..fbfa7e0 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name
 Bundle-SymbolicName: org.eclipse.equinox.p2.discovery.compatibility;singleton:=true
-Bundle-Version: 1.2.100.qualifier
+Bundle-Version: 1.2.200.qualifier
 Bundle-Vendor: %Bundle-Vendor
 Bundle-RequiredExecutionEnvironment: JavaSE-11
 Require-Bundle: org.eclipse.core.runtime;bundle-version="3.3.0",
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml b/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml
index 23c6cc4..11e7583 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/pom.xml
@@ -19,6 +19,6 @@
   </parent>
   <groupId>org.eclipse.equinox</groupId>
   <artifactId>org.eclipse.equinox.p2.discovery.compatibility</artifactId>
-  <version>1.2.100-SNAPSHOT</version>
+  <version>1.2.200-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java
index 97a2144..9cbb8d0 100644
--- a/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java
+++ b/bundles/org.eclipse.equinox.p2.discovery.compatibility/src/org/eclipse/equinox/internal/p2/discovery/compatibility/DirectoryParser.java
@@ -16,6 +16,7 @@
 
 import java.io.IOException;
 import java.io.Reader;
+import javax.xml.parsers.ParserConfigurationException;
 import org.eclipse.equinox.internal.p2.core.helpers.SecureXMLUtil;
 import org.eclipse.equinox.internal.p2.discovery.compatibility.Directory.Entry;
 import org.eclipse.equinox.internal.p2.discovery.compatibility.util.DefaultSaxErrorHandler;
@@ -42,7 +43,7 @@
 		XMLReader xmlReader;
 		try {
 			xmlReader = SecureXMLUtil.newSecureXMLReader();
-		} catch (SAXException e) {
+		} catch (SAXException | ParserConfigurationException e) {
 			throw new IOWithCauseException(e.getMessage(), e);
 		}
 		xmlReader.setErrorHandler(new DefaultSaxErrorHandler());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
index f1b090a..81d99b1 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
@@ -281,7 +281,7 @@
 		detailedMessage.append(" install location is ").append(getInstallLocation()).append('\n');
 		String message = "Need to set the \"org.eclipse.equinox.p2.reconciler.tests.platform.archive\" system property with a valid path to the platform binary drop or copy the archive to be a sibling of the install folder.";
 		assertNotNull(message + "\n" + detailedMessage, file);
-		assertTrue(message, file.exists());
+		assertTrue(message + "\nThe file '" + file.getAbsolutePath() + "' does not exist", file.exists());
 		assertTrue("File is zero length: " + file.getAbsolutePath(), file.length() > 0);
 		return file;
 	}
diff --git a/features/org.eclipse.equinox.p2.discovery.feature/feature.xml b/features/org.eclipse.equinox.p2.discovery.feature/feature.xml
index 5a831e4..49c7f0d 100644
--- a/features/org.eclipse.equinox.p2.discovery.feature/feature.xml
+++ b/features/org.eclipse.equinox.p2.discovery.feature/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.equinox.p2.discovery.feature"
       label="%featureName"
-      version="1.2.1000.qualifier"
+      version="1.2.1100.qualifier"
       provider-name="%providerName"
       license-feature="org.eclipse.license"
       license-feature-version="0.0.0">
diff --git a/features/org.eclipse.equinox.p2.discovery.feature/pom.xml b/features/org.eclipse.equinox.p2.discovery.feature/pom.xml
index 0a70607..4cf2ba4 100644
--- a/features/org.eclipse.equinox.p2.discovery.feature/pom.xml
+++ b/features/org.eclipse.equinox.p2.discovery.feature/pom.xml
@@ -19,7 +19,7 @@
   </parent>
   <groupId>org.eclipse.equinox</groupId>
   <artifactId>org.eclipse.equinox.p2.discovery.feature</artifactId>
-  <version>1.2.1000-SNAPSHOT</version>
+  <version>1.2.1100-SNAPSHOT</version>
   <packaging>eclipse-feature</packaging>
 
   <build>