db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1604758 - in /db/derby/code/trunk: ./ java/engine/org/apache/derby/iapi/types/ java/testing/org/apache/derbyTesting/junit/ tools/ant/properties/ tools/ide/netbeans/nbproject/ tools/java/ tools/release/notices/
Date Mon, 23 Jun 2014 11:44:08 GMT
Author: kahatlen
Date: Mon Jun 23 11:44:08 2014
New Revision: 1604758

URL: http://svn.apache.org/r1604758
Log:
DERBY-6624: Use javax.xml.xpath interfaces for XPath support

Stop using the interfaces in the org.w3c.dom.xpath package, since they
are not part of the Java SE specification.

Removed:
    db/derby/code/trunk/tools/java/xml-apis.jar
    db/derby/code/trunk/tools/release/notices/xalan.txt
Modified:
    db/derby/code/trunk/build.xml
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java
    db/derby/code/trunk/tools/ant/properties/extrapath.properties
    db/derby/code/trunk/tools/ide/netbeans/nbproject/project.xml

Modified: db/derby/code/trunk/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/build.xml?rev=1604758&r1=1604757&r2=1604758&view=diff
==============================================================================
--- db/derby/code/trunk/build.xml (original)
+++ db/derby/code/trunk/build.xml Mon Jun 23 11:44:08 2014
@@ -2125,7 +2125,6 @@
      <antcall target="appendnotice"><param name="sourcefile" value="nisttestgrant.txt"/></antcall>
      <antcall target="appendnotice"><param name="sourcefile" value="jdbcstubs.txt"/></antcall>
      <antcall target="appendnotice"><param name="sourcefile" value="felix.txt"/></antcall>
-     <antcall target="appendnotice"><param name="sourcefile" value="xalan.txt"/></antcall>
      <antcall target="appendnotice"><param name="sourcefile" value="lucene.txt"/></antcall>
      
       <antcall target="checkinfile">

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java?rev=1604758&r1=1604757&r2=1604758&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java Mon Jun 23
11:44:08 2014
@@ -28,29 +28,30 @@ import org.apache.derby.shared.common.sa
 import java.util.Properties;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 import java.io.IOException;
 import java.io.StringReader;
 
-import java.math.BigDecimal;
-
 // -- JDBC 3.0 JAXP API classes.
 
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
 
-import org.w3c.dom.xpath.XPathEvaluator;
-import org.w3c.dom.xpath.XPathExpression;
-import org.w3c.dom.xpath.XPathResult;
-
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
+import javax.xml.XMLConstants;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
@@ -62,6 +63,12 @@ import javax.xml.transform.TransformerFa
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
 /**
  * This class contains "utility" methods that work with XML-specific
  * objects that are only available if JAXP and/or Xalan are in
@@ -115,10 +122,12 @@ public class SqlXmlUtil
     // XML serialization rules.
     private Transformer serializer;
 
-    // Classes used to compile and execute an XPath expression
-    // against Xalan.
+    /** The compiled XPath query. */
     private XPathExpression query;
 
+    /** The return type of the XPath query. {@code null} if it is unknown. */
+    private QName returnType;
+
     // Used to recompile the XPath expression when this formatable
     // object is reconstructed.  e.g.:  SPS 
     private String queryExpr;
@@ -247,15 +256,15 @@ public class SqlXmlUtil
 
             /* The following XPath constructor compiles the expression
              * as part of the construction process.  We pass a null
-             * namespace resolver object so that the implementation will
-             * provide one for us, which means prefixes will not be resolved
+             * namespace context object so that prefixes will not be resolved
              * in the query (Xalan will just throw an error if a prefix
              * is used).  In the future we may want to revisit this
              * to make it easier for users to query based on namespaces.
              */
-            XPathEvaluator eval = (XPathEvaluator)
-                dBuilder.getDOMImplementation().getFeature("+XPath", "3.0");
-            query = eval.createExpression(queryExpr, null);
+            XPath xpath = XPathFactory.newInstance().newXPath();
+            xpath.setNamespaceContext(NullNamespaceContext.SINGLETON);
+
+            query = xpath.compile(queryExpr);
 
             this.queryExpr = queryExpr;
             this.opName = opName;
@@ -571,72 +580,43 @@ public class SqlXmlUtil
                 (returnResults ? "XMLQUERY" : "XMLEXISTS"));
         } 
 
-        Document docNode = null;
-        docNode = dBuilder.parse(
+        Document docNode = dBuilder.parse(
             new InputSource(
                 new StringReader(xmlContext.getString())));
 
-        // Evaluate the expresion using Xalan.
-        XPathResult result = (XPathResult)
-                query.evaluate(docNode, XPathResult.ANY_TYPE, null);
+        Object result = evaluate(docNode);
 
         if (!returnResults)
         {
+            // This is for XMLEXISTS.
+            //
             // We don't want to return the actual results, we just
             // want to know if there was at least one item in the
             // result sequence.
-            switch (result.getResultType()) {
-                case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
-                case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
-                    if (result.iterateNext() == null) {
-                        // We have an empty sequence, so return null.
-                        return null;
-                    } else {
-                        // We have a non-empty sequence, so return a non-null
-                        // list to indicate that we found at least one item.
-                        return Collections.EMPTY_LIST;
-                    }
-                default:
-                    // We have a single atomic value, which means the result is
-                    // non-empty. So return a non-null list.
-                    return Collections.EMPTY_LIST;
+            if (result instanceof NodeList
+                    && ((NodeList) result).getLength() == 0) {
+                // We have an empty sequence, so return null to indicate
+                // there were no results from the query.
+                return null;
+            } else {
+                // We have either a non-empty sequence or a scalar, so
+                // return a non-null value to indicate that we found at
+                // least one item.
+                return Collections.emptyList();
             }
         }
 
         // Else process the results.
         List itemRefs;
-        switch (result.getResultType()) {
-            case XPathResult.NUMBER_TYPE:
-                // Single atomic number. Get its string value.
-                String val = numberToString(result.getNumberValue());
-                itemRefs = Collections.singletonList(val);
-                break;
-            case XPathResult.STRING_TYPE:
-                // Single atomic string value.
-                itemRefs = Collections.singletonList(result.getStringValue());
-                break;
-            case XPathResult.BOOLEAN_TYPE:
-                // Single atomic boolean. Get its string value.
-                itemRefs = Collections.singletonList(
-                        String.valueOf(result.getBooleanValue()));
-                break;
-            case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
-            case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
-                // We have a sequence. Get all nodes.
-                ArrayList<Node> nodes = new ArrayList<Node>();
-                Node node;
-                while ((node = result.iterateNext()) != null) {
-                    nodes.add(node);
-                }
-                itemRefs = nodes;
-                break;
-            default:
-                if (SanityManager.DEBUG) {
-                    SanityManager.THROWASSERT(
-                            "Don't know how to handle XPath result type " +
-                            result.getResultType());
-                }
-                itemRefs = null;
+        if (result instanceof NodeList) {
+            NodeList list = (NodeList) result;
+            ArrayList<Node> nodes = new ArrayList<Node>();
+            for (int i = 0; i < list.getLength(); i++) {
+                nodes.add(list.item(i));
+            }
+            itemRefs = nodes;
+        } else {
+            itemRefs = Collections.singletonList(result);
         }
 
         /* Indicate what kind of XML result value we have.  If
@@ -658,6 +638,32 @@ public class SqlXmlUtil
      * */
 
     /**
+     * Evaluate the XPath query on the specified document.
+     */
+    private Object evaluate(Document doc) throws XPathExpressionException {
+
+        // If we know the return type, just evaluate the expression with
+        // that type.
+        if (returnType != null) {
+            return query.evaluate(doc, returnType);
+        }
+
+        // Otherwise, first try to evaluate the expression as if it returned
+        // a set of nodes. If that fails, evaluate it as if it returned a
+        // string. Remember which type was successful so that we can use that
+        // type directly the next time we evaluate the expression.
+        try {
+            Object result = query.evaluate(doc, XPathConstants.NODESET);
+            returnType = XPathConstants.NODESET;
+            return result;
+        } catch (XPathExpressionException xpee) {
+            Object result = query.evaluate(doc, XPathConstants.STRING);
+            returnType = XPathConstants.STRING;
+            return result;
+        }
+    }
+
+    /**
      * Create an instance of Xalan serializer for the sake of
      * serializing an XML value according the SQL/XML specification
      * for serialization.
@@ -704,35 +710,6 @@ public class SqlXmlUtil
         // Load the serializer with the correct properties.
         serializer = TransformerFactory.newInstance().newTransformer();
         serializer.setOutputProperties(props);
-        return;
-    }
-
-    /**
-     * Convert a number returned by an XPath query to a string, following the
-     * rules for the <a href="http://www.w3.org/TR/xpath/#function-string">
-     * XPath string function</a>.
-     *
-     * @param d {@code double} representation of the number
-     * @return {@code String} representation of the number
-     */
-    private static String numberToString(double d) {
-        if (Double.isNaN(d) || Double.isInfinite(d)) {
-            // BigDecimal doesn't know how to handle NaN or +/- infinity, so
-            // use Double to handle those cases.
-            return Double.toString(d);
-        } else if (d == 0.0d) {
-            // If the result is zero, return plain "0". This special case is
-            // needed because BigDecimal.stripTrailingZeros() does not remove
-            // trailing zeros from zero, and will end up producing "0.0", see
-            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6480539
-            return "0";
-        } else {
-            // Otherwise, use BigDecimal to format the number the way we want.
-            // We could have used Double to format it, but then the resulting
-            // string would have been in scientific format (like 1.0e-3), and
-            // we want it to be in plain format (like 0.001).
-            return BigDecimal.valueOf(d).stripTrailingZeros().toPlainString();
-        }
     }
 
     /*
@@ -760,4 +737,28 @@ public class SqlXmlUtil
             throw new SAXException (exception);
         }
     }
+
+    /**
+     * A NamespaceContext that reports all namespaces as unbound.
+     */
+    private static class NullNamespaceContext implements NamespaceContext {
+
+        private final static NullNamespaceContext
+                SINGLETON = new NullNamespaceContext();
+
+        @Override
+        public String getNamespaceURI(String prefix) {
+            return XMLConstants.NULL_NS_URI;
+        }
+
+        @Override
+        public String getPrefix(String namespaceURI) {
+            return null;
+        }
+
+        @Override
+        public Iterator getPrefixes(String namespaceURI) {
+            return Collections.emptyList().iterator();
+        }
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java?rev=1604758&r1=1604757&r2=1604758&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/XML.java Mon Jun 23 11:44:08
2014
@@ -29,7 +29,6 @@ import org.apache.derby.iapi.services.io
 import org.apache.derby.iapi.services.io.StreamStorable;
 import org.apache.derby.iapi.services.io.Storable;
 import org.apache.derby.iapi.services.io.TypedFormat;
-import org.apache.derby.iapi.services.loader.ClassInspector;
 import org.apache.derby.shared.common.sanity.SanityManager;
 import org.apache.derby.iapi.sql.conn.ConnectionUtil;
 
@@ -44,7 +43,6 @@ import java.io.InputStream;
 import java.io.IOException;
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
-import java.lang.reflect.Method;
 
 import java.util.List;
 
@@ -830,7 +828,7 @@ public class XML
          * fail but Derby will continue to run as normal. 
          */
             throw StandardException.newException(
-                SQLState.LANG_XML_QUERY_ERROR,
+                SQLState.LANG_XML_QUERY_ERROR, xe,
                 "XMLEXISTS", xe.getMessage());
         }
     }
@@ -903,7 +901,7 @@ public class XML
          * fail but Derby will continue to run as normal. 
          */
             throw StandardException.newException(
-                SQLState.LANG_XML_QUERY_ERROR,
+                SQLState.LANG_XML_QUERY_ERROR, xe,
                 "XMLQUERY", xe.getMessage());
         }
     }
@@ -983,7 +981,7 @@ public class XML
         {
             xmlReqCheck = "";
 
-            /* If the w3c Document class exists, then we
+            /* If the DocumentBuilderFactory class exists, then we
              * assume a JAXP implementation is present in
              * the classpath.  If this assumption is incorrect
              * then we at least know that the JAXP *interface*
@@ -997,21 +995,16 @@ public class XML
              * provided as part the JVM if it is jdk 1.4 or
              * greater.
              */
-            Object docImpl = checkJAXPRequirement();
-            if (docImpl == null)
+            if (!checkJAXPRequirement()) {
                 xmlReqCheck = "JAXP";
+            }
 
-            /* If the XPath class exists, then we assume that our XML
-             * query processor (in this case, Xalan), is present in the
-             * classpath.  Note: if JAXP API classes aren't present
-             * then the following check will return false even if the
-             * Xalan classes *are* present; this is because the Xalan
-             * XPath class relies on JAXP, as well.  Thus there's no
-             * point in checking for Xalan unless we've already confirmed
-             * that we have the JAXP interfaces.
+            /* If the XPathFactory class exists, then we assume that
+             * our XML query processor is present in the classpath.
              */
-            else if (!checkXPathRequirement(docImpl))
-                xmlReqCheck = "XPath 3.0";
+            else if (!checkXPathRequirement()) {
+                xmlReqCheck = "XPath";
+            }
         }
 
         if (xmlReqCheck.length() != 0)
@@ -1019,63 +1012,36 @@ public class XML
             throw StandardException.newException(
                 SQLState.LANG_MISSING_XML_CLASSES, xmlReqCheck);
         }
-
-        return;
     }
 
     /**
      * Check if we have a JAXP implementation installed.
      *
-     * @return a {@code DOMImplementation} object retrieved from the
-     * JAXP implementation, if one is installed, or {@code null} if an
-     * implementation couldn't be found
+     * @return {@code true} if JAXP is installed, or {@code false} otherwise
      */
-    private static Object checkJAXPRequirement() {
+    private static boolean checkJAXPRequirement() {
         try {
-            Class<?> factoryClass =
-                    Class.forName("javax.xml.parsers.DocumentBuilderFactory");
-            Method newFactory = factoryClass.getMethod(
-                    "newInstance", new Class[0]);
-            Method newBuilder = factoryClass.getMethod(
-                    "newDocumentBuilder", new Class[0]);
-
-            Class<?> builderClass =
-                    Class.forName("javax.xml.parsers.DocumentBuilder");
-            Method getImpl = builderClass.getMethod(
-                    "getDOMImplementation", new Class[0]);
-
-            Object factory = newFactory.invoke(null, new Object[0]);
-            Object builder = newBuilder.invoke(factory, new Object[0]);
-            Object impl = getImpl.invoke(builder, new Object[0]);
-
-            return impl;
-
+            Class.forName("javax.xml.parsers.DocumentBuilderFactory");
+            return true;
         } catch (Throwable t) {
-            // Oops... Couldn't get a DOMImplementation object for
+            // Oops... Couldn't load the DocumentBuilderFactory class for
             // some reason. Assume we don't have JAXP.
-            return null;
+            return false;
         }
     }
 
     /**
-     * Check if the supplied {@code DOMImplementation} object has
-     * support for DOM Level 3 XPath.
+     * Check if XPath is supported on this platform.
      *
-     * @param domImpl the {@code DOMImplementation} instance to check
-     * @return {@code true} if the required XPath level is supported,
-     * {@code false} otherwise
+     * @return {@code true} if XPath is supported, or {@code false} otherwise
      */
-    private static boolean checkXPathRequirement(Object domImpl) {
+    private static boolean checkXPathRequirement() {
         try {
-            Class<?> domImplClass = Class.forName("org.w3c.dom.DOMImplementation");
-            Method getFeature = domImplClass.getMethod(
-                    "getFeature", new Class[] {String.class, String.class});
-            Object impl =
-                    getFeature.invoke(domImpl, new Object[] {"+XPath", "3.0"});
-            return impl != null;
+            Class.forName("javax.xml.xpath.XPathFactory");
+            return true;
         } catch (Throwable t) {
             // Oops... Something went wrong when checking for XPath
-            // 3.0 support. Assume we don't have it.
+            // support. Assume we don't have it.
             return false;
         }
     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml?rev=1604758&r1=1604757&r2=1604758&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml Mon Jun 23 11:44:08
2014
@@ -35,31 +35,6 @@
 <!-- Targets -->
 
   <target name="compile_types">
-    <!--
-        Compile SqlXmlUtil separately because it uses some XML
-        interfaces that are not part of the Java SE specification, and
-        requires xml-apis.jar on the compile classpath.
-    -->
-    <javac
-      source="1.6"
-      target="1.6"
-      bootclasspath="${empty}"
-      nowarn="on"
-      debug="${debug}"
-      depend="${depend}"
-      deprecation="${deprecation}"
-      optimize="${optimize}"
-      proceed="${proceed}"
-      verbose="${verbose}"
-      srcdir="${derby.engine.src.dir}"
-      destdir="${out.dir}">
-      <classpath>
-        <pathelement path="${xmlApis};${java16compile.classpath}"/>
-      </classpath>
-      <include name="${derby.dir}/iapi/types/SqlXmlUtil.java"/>
-      <compilerarg value="-Xlint:unchecked"/>
-    </javac>
-
     <javac
       source="1.6"
       target="1.6"
@@ -77,7 +52,6 @@
         <pathelement path="${java16compile.classpath}"/>
       </classpath>
       <include name="${derby.dir}/iapi/types/*.java"/>
-      <exclude name="${derby.dir}/iapi/types/SqlXmlUtil.java"/>
       <compilerarg value="-Xlint:unchecked"/>
     </javac>
   </target>

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java?rev=1604758&r1=1604757&r2=1604758&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/XML.java Mon Jun 23 11:44:08
2014
@@ -35,37 +35,6 @@ import junit.framework.Assert;
  * <p>
  * XML utility methods for the JUnit tests.
  * </p>
- *
- * <p>
- * Note that The XML tests require a more advanced version of Xalan
- * than the default version bundled with JDK 1.4. The XML tests silently
- * exit if the required environment is not found.
- * </p>
- *
- * <p>
- * To run the XML tests under JDK 1.4, you must do the following:
- * </p>
- *
- * <ul>
- * <li>Download the latest version of Xalan (2.7.0 as of this writing).</li>
- * <li>Copy all of the downloaded jars into the jre/lib/endorsed directory
- * of your JDK 1.4 installation. Those jar files are:
- * serializer.jar, xalan.jar, xercesImpl.jar, and xsltc.jar.</li>
- * </ul>
- *
- * <p>
- *That's it! Now the XML tests should run for you under JDK 1.4.
- * </p>
- *
- * <p>
- * To run the XML tests under a higher version of the JDK, you must do the
- * following:
- * </p>
- *
- * <ul>
- * <li>Download the latest version of Xalan as described above.</li>
- * <li>Wire the downloaded jar files into your CLASSPATH.</li>
- * </ul>
  */
 public class XML {
 
@@ -85,10 +54,9 @@ public class XML {
             HAVE_JAXP && checkJAXPImplementation();
 
     /**
-     * Determine if we have support for DOM level 3 XPath, which is required
-     * for successful use of the XML operators.
+     * Determine if we have support evaluating XPath queries.
      */
-    private static final boolean HAVE_XPATH_LEVEL_3
+    private static final boolean HAVE_XPATH
             = HAVE_JAXP_IMPL && checkXPathSupport();
 
     /**
@@ -102,7 +70,7 @@ public class XML {
      * Return true if the classpath contains JAXP and
      * an implementation of the JAXP interfaces, for example the
      * Xalan classes (this method doesn't care about
-     * support for DOM level 3 XPath).
+     * support for XPath queries).
      */
     public static boolean classpathHasJAXP()
     {
@@ -111,13 +79,11 @@ public class XML {
 
     /**
      * Return true if the classpath meets all of the requirements
-     * for use of the SQL/XML operators.  This means that all
-     * required classes exist in the classpath AND there is support
-     * for DOM level 3 XPath.
+     * for use of the SQL/XML operators.
      */
     public static boolean classpathMeetsXMLReqs()
     {
-        return HAVE_XPATH_LEVEL_3;
+        return HAVE_XPATH;
     }
 
     /**
@@ -247,7 +213,7 @@ public class XML {
      * <p>
      * Determine whether or not the classpath with which we're
      * running contains a JAXP implementation that supports
-     * DOM level 3 XPath.
+     * evaluating XPath queries.
      * </p>
      *
      * <p>
@@ -257,54 +223,22 @@ public class XML {
      */
     private static boolean checkXPathSupport()
     {
-        boolean supportsXPath;
-
-        // Invoke the following using reflection to see if we have support
-        // for DOM level 3 XPath:
-        //
-        //     DocumentBuilderFactory.newInstance().newDocumentBuilder()
-        //             .getDOMImplementation().getFeature("+XPath", "3.0");
-        //
         try {
             Class<?> factoryClass =
-                    Class.forName("javax.xml.parsers.DocumentBuilderFactory");
+                    Class.forName("javax.xml.xpath.XPathFactory");
 
             Method newFactory =
-                    factoryClass.getMethod("newInstance", new Class[0]);
+                    factoryClass.getMethod("newInstance");
 
-            Object factory = newFactory.invoke(null, new Object[0]);
+            Object factory = newFactory.invoke(null);
 
-            Method newBuilder = factoryClass.getMethod(
-                    "newDocumentBuilder", new Class[0]);
-
-            Object builder = newBuilder.invoke(factory, new Object[0]);
-
-            Class<?> builderClass =
-                    Class.forName("javax.xml.parsers.DocumentBuilder");
-
-            Method getImpl = builderClass.getMethod(
-                    "getDOMImplementation", new Class[0]);
-
-            Object impl = getImpl.invoke(builder, new Object[0]);
-
-            Class<?> domImplClass =
-                    Class.forName("org.w3c.dom.DOMImplementation");
-
-            Method getFeature = domImplClass.getMethod(
-                    "getFeature", new Class[] {String.class, String.class});
-
-            Object ret =
-                    getFeature.invoke(impl, new Object[] {"+XPath", "3.0"});
-
-            supportsXPath = (ret != null);
+            return factory != null;
 
         } catch (Throwable t) {
             // If something went wrong, assume we don't have the
             // necessary classes.
-            supportsXPath = false;
+            return false;
         }
-
-        return supportsXPath;
     }
 
     private static boolean checkJAXPImplementation() {

Modified: db/derby/code/trunk/tools/ant/properties/extrapath.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/ant/properties/extrapath.properties?rev=1604758&r1=1604757&r2=1604758&view=diff
==============================================================================
--- db/derby/code/trunk/tools/ant/properties/extrapath.properties (original)
+++ db/derby/code/trunk/tools/ant/properties/extrapath.properties Mon Jun 23 11:44:08 2014
@@ -25,7 +25,6 @@
 oro=${javatools.dir}/jakarta-oro-2.0.8.jar
 servlet24=${javatools.dir}/geronimo-spec-servlet-2.4-rc4.jar
 osgi=${out.felix.dir}
-xmlApis=${javatools.dir}/xml-apis.jar
 javacc=${javatools.dir}/javacc.jar
 junit=${javatools.dir}/junit.jar
 emma=${javatools.dir}/emma.jar
@@ -37,4 +36,4 @@ lucene_qp=${javatools.dir}/lucene-queryp
 #
 # Base JavaDoc collection, used for both product and test JavaDocs.
 #
-jars.javadoc=${xmlApis};${osgi};${oro};${servlet24}:${lucene_core}:${lucene_a_co}:${lucene_qp}
+jars.javadoc=${osgi};${oro};${servlet24}:${lucene_core}:${lucene_a_co}:${lucene_qp}

Modified: db/derby/code/trunk/tools/ide/netbeans/nbproject/project.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/ide/netbeans/nbproject/project.xml?rev=1604758&r1=1604757&r2=1604758&view=diff
==============================================================================
--- db/derby/code/trunk/tools/ide/netbeans/nbproject/project.xml (original)
+++ db/derby/code/trunk/tools/ide/netbeans/nbproject/project.xml Mon Jun 23 11:44:08 2014
@@ -262,7 +262,7 @@
                 <package-root>${project.dir}/java/tools</package-root>
                 <package-root>${project.dir}/generated/java</package-root>
                 <package-root>${project.dir}/java/optional</package-root>
-                <classpath mode="compile">${project.dir}/tools/java/geronimo-spec-servlet-2.4-rc4.jar:${project.dir}/tools/java/jakarta-oro-2.0.8.jar:${project.dir}/tools/java/javacc.jar:${project.dir}/tools/java/junit.jar:${ant.core.lib}:${project.dir}/classes/stubs/felix:${project.dir}/tools/java/xml-apis.jar:${project.dir}/tools/java/lucene-analyzers-common.jar:${project.dir}/tools/java/lucene-core.jar:${project.dir}/tools/java/lucene-queryparser.jar</classpath>
+                <classpath mode="compile">${project.dir}/tools/java/geronimo-spec-servlet-2.4-rc4.jar:${project.dir}/tools/java/jakarta-oro-2.0.8.jar:${project.dir}/tools/java/javacc.jar:${project.dir}/tools/java/junit.jar:${ant.core.lib}:${project.dir}/classes/stubs/felix:${project.dir}/tools/java/lucene-analyzers-common.jar:${project.dir}/tools/java/lucene-core.jar:${project.dir}/tools/java/lucene-queryparser.jar</classpath>
                 <built-to>${project.dir}/jars/sane/derby.jar</built-to>
                 <built-to>${project.dir}/jars/sane/derbyTesting.jar</built-to>
                 <built-to>${project.dir}/jars/sane/derbyclient.jar</built-to>



Mime
View raw message