Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 36895 invoked from network); 31 May 2007 21:06:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 May 2007 21:06:13 -0000 Received: (qmail 37914 invoked by uid 500); 31 May 2007 21:06:17 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 37698 invoked by uid 500); 31 May 2007 21:06:16 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 37689 invoked by uid 99); 31 May 2007 21:06:16 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 May 2007 14:06:16 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [192.18.1.36] (HELO gmp-ea-fw-1.sun.com) (192.18.1.36) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 May 2007 14:06:11 -0700 Received: from d1-emea-10.sun.com (d1-emea-10.sun.com [192.18.2.120]) by gmp-ea-fw-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l4VL5ktw022877 for ; Thu, 31 May 2007 21:05:49 GMT Received: from conversion-daemon.d1-emea-10.sun.com by d1-emea-10.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) id <0JIX00A01BVUN100@d1-emea-10.sun.com> (original mail from Knut.Hatlen@Sun.COM) for derby-dev@db.apache.org; Thu, 31 May 2007 22:05:46 +0100 (BST) Received: from localhost ([193.71.105.147]) by d1-emea-10.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPSA id <0JIX00IPXBXMSQFG@d1-emea-10.sun.com> for derby-dev@db.apache.org; Thu, 31 May 2007 22:05:46 +0100 (BST) Date: Thu, 31 May 2007 23:05:39 +0200 From: Knut Anders Hatlen Subject: Re: svn commit: r543183 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java Sender: Knut.Hatlen@Sun.COM To: derby-dev@db.apache.org Message-id: Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT References: <20070531170005.56A0B1A981A@eris.apache.org> <465F015C.9070404@gmail.com> <465F1510.8090303@gmail.com> User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (usg-unix-v) X-Virus-Checked: Checked by ClamAV on apache.org Army writes: > Knut Anders Hatlen wrote: >> You're right that it fails with Sun jdk15 and jdk16 when Xalan is not in >> classpath. However, this simple change in XML.checkXMLRequirements() >> made CollationTest run just fine: >> >> Index: java/engine/org/apache/derby/iapi/types/XML.java >> =================================================================== >> --- java/engine/org/apache/derby/iapi/types/XML.java (revision 543186) >> +++ java/engine/org/apache/derby/iapi/types/XML.java (working copy) >> @@ -910,7 +910,9 @@ >> * point in checking for Xalan unless we've already confirmed >> * that we have the JAXP interfaces. >> */ >> - else if (!ClassInspector.classIsLoadable("org.apache.xpath.XPath")) >> + else if (!ClassInspector.classIsLoadable("org.apache.xpath.XPath") >> + && >> + !ClassInspector.classIsLoadable("javax.xml.xpath.XPath")) >> xmlReqCheck = "Xalan"; >> } >> >> Does this mean that the XML functionality works in Sun's JVMs too >> without external Xalan jars, if we only check different package names, >> or is there something else missing? > > Hmm, great question. Do lang/XMLTypesAndOpsTest and > lang/XMLBindingTest pass, as well? No, they fail with: java.sql.SQLException: Java exception: 'org/apache/xml/utils/PrefixResolver: java.lang.NoClassDefFoundError'. But both jdk15 and jdk16 have the PrefixResolver class in rt.jar. It's just hidden in the com.sun.org.apache.xml.internal.utils package. According to http://java.sun.com/j2se/1.5.0/docs/guide/xml/jaxp/JAXP-Compatibility_150.html it was placed there in order to make it easier to use a newer version than the one bundled. The release notes for Java SE 1.5.0 say that it contains "Xerces version 2.6.2 +". > When the XML type was added to Derby it was with jdk 1.4 in mind, and > javax.xml.xpath.XPath doesn't exist for 1.4. So that's probably why > it wasn't included. > > If the above change works for 1.5 and 1.6, I assume this means those > JVMs embedd Xalan internally, is that correct? The reason I assume > this is because the iapi/types/SqlXmlUtil class imports xalan classes > ("org.apache.xalan..."), so I think things should have failed unless > Xalan is embedded within the jvm. OK, so if we did some kind of reflection trick in SqlXmlUtil to use the com.sun.org.apache.xalan package if org.apache.xalan wasn't there, that would probably work. > In any event, the existing code makes an assumption here (which is > also mentioned in the code comments): if "org.apache.xpath.XPath" > exists, then we assume it exists as part of Xalan. Is it safe to make > that same assumption with "javax.xml.xpath.XPath"? My guess is that > the latter is a much more risky assumption, as any 1.5/1.6 JVM could > have "javax.xml.xpath.XPath" without actually relying on Xalan. The > "org.apache.xpath.XPath" check is only marginally better: at least we > know it comes from Apache, which we could argue "suggests" Xalan. But > in truth, even that seems a tad risky. Hmm, there is also a com.sun.org.apache.xerces.internal.impl.xpath.XPath class that we could check for. Its existence would at least give us the same guarantee as org.apache.xpath.XPath, I think. > I think a bigger question is: should we be explicitly checking for a > *Xalan* class instead of checking for some indirect class (currently > "org.apache.xpath.XPath")? Ultimately Xalan is what Derby wants, so > shouldn't be we looking for that directly? That seems like a more > correct approach; I'm not sure why the code doesn't explicitly look > for Xalan today. If there was a reason, I don't recall it... If we require Xalan specific classes/methods and cannot only rely on generic interfaces, then I agree, Xalan is what we should check for. > Note that junit/XML.java relies on the same class > ("org.apache.xpath.XPath") to assume Xalan exists, as well. Hmm. At least, it also checks that Xalan is there and meets the minimum version requirements. I'll log a JIRA issue for this, since it seems like a great usability improvement not to require separate downloads when the JVM has what's needed. Thanks, Army! -- Knut Anders