[288046] Ensure "allow-java-encodings" feature for Xerces parsers is enabled.
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLUtil.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLUtil.java
index d43f1f2..f9ca6ac 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLUtil.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/xml/XMLUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.jst.server.tomcat.core.internal.Trace;
import org.w3c.dom.*;
@@ -41,6 +42,13 @@
factory.setValidating(false);
factory.setNamespaceAware(false);
factory.setExpandEntityReferences(false);
+ // In case we happen to have a Xerces parser, try to set the feature that allows Java encodings to be used
+ try {
+ factory.setFeature("http://apache.org/xml/features/allow-java-encodings", true);
+ }
+ catch (ParserConfigurationException e) {
+ // Ignore if feature isn't supported
+ }
//factory.setAttribute("http://apache.org/xml/features/nonvalidating/load-external-dtd", new Boolean(false));
documentBuilder = factory.newDocumentBuilder();
documentBuilder.setEntityResolver(new EntityResolver() {