changeset 22416:5473b73ce396

8025018: Enhance JAX-P set up Reviewed-by: alanb, dfuchs, lancea, ahgross
author joehw
date Tue, 22 Oct 2013 13:15:50 -0700
parents 4e3bef0828af
children 278570df46ad
files jaxp/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java jaxp/src/com/sun/org/apache/xalan/internal/lib/Extensions.java
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jaxp/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java	Mon Aug 26 21:08:58 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java	Tue Oct 22 13:15:50 2013 -0700
@@ -52,6 +52,8 @@
  */
 public class ExsltStrings extends ExsltBase
 {
+   static final String JDK_DEFAULT_DOM = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
+
   /**
    * The str:align function aligns a string within another string.
    * <p>
@@ -343,7 +345,11 @@
         static {
             try
             {
-                m_doc =DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+                if (System.getSecurityManager() == null) {
+                    m_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+                } else {
+                    m_doc = DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument();
+                }
             }
 
             catch(ParserConfigurationException pce)
--- a/jaxp/src/com/sun/org/apache/xalan/internal/lib/Extensions.java	Mon Aug 26 21:08:58 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/lib/Extensions.java	Tue Oct 22 13:15:50 2013 -0700
@@ -56,6 +56,7 @@
  */
 public class Extensions
 {
+    static final String JDK_DEFAULT_DOM = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
   /**
    * Constructor Extensions
    *
@@ -407,7 +408,11 @@
         {
             try
             {
-                m_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+                if (System.getSecurityManager() == null) {
+                    m_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+                } else {
+                    m_doc = DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument();
+                }
             }
 
             catch(ParserConfigurationException pce)