From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 644 invoked by alias); 22 Jun 2009 11:51:04 -0000 Received: (qmail 624 invoked by uid 22791); 22 Jun 2009 11:51:02 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Jun 2009 11:50:56 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5MBosCe028645; Mon, 22 Jun 2009 07:50:54 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5MBorbw003027; Mon, 22 Jun 2009 07:50:53 -0400 Received: from zebedee.pink (vpn-12-162.rdu.redhat.com [10.11.12.162]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5MBoppf015901; Mon, 22 Jun 2009 07:50:52 -0400 Message-ID: <4A3F701B.2000007@redhat.com> Date: Mon, 22 Jun 2009 11:51:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.17 (X11/20081009) MIME-Version: 1.0 To: Sam Ruby CC: Mark Wielaard , java@gcc.gnu.org Subject: Re: NPE in parser->getDOMImplementation() with CNI References: <4A3D95F1.6040803@intertwingly.net> <4A3E55E1.6010705@redhat.com> <1245616012.4936.22.camel@hermans.wildebeest.org> <4A3F6625.9030803@redhat.com> <4A3F6BF7.6070909@intertwingly.net> In-Reply-To: <4A3F6BF7.6070909@intertwingly.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00054.txt.bz2 Sam Ruby wrote: > Andrew Haley wrote: >> Mark Wielaard wrote: >>> On Sun, 2009-06-21 at 16:46 +0100, Andrew Haley wrote: >>>> Sam Ruby wrote: >>>>> I'm trying to develop a JAXP implementation using CNI, but I get a >>>>> NullPointerException when I try to get a DOMImplementation. I've >>>>> attached a small script (tested on Ubuntu 9.04) which demonstrates the >>>>> problem. >>>>> >>>>> Any help would be appreciated. >>>> Congratulations on this excellent test case. Next time I want to tell >>>> people how to do it right, I'll point them at your posting. >>>> >>>> However, I get >>>> >>>> $ sh ~/testdomimpl.sh >>>> gnu.xml.dom.DomDocumentBuilderFactory@160ecdad >>>> gnu.xml.dom.DomDocumentBuilder@15ffbc45 >>>> gnu.xml.dom.DomImpl@15ef0ee5 >>>> >>>> gnu.xml.dom.DomDocumentBuilderFactory@2df0bea7 >>>> gnu.xml.dom.DomDocumentBuilder@2de03d5f >>>> gnu.xml.dom.DomImpl@2dd0bfdf >>>> $ gcj --version >>>> gcj (GCC) 4.4.0 20090307 (Red Hat 4.4.0-0.23) >>> I get the same with that version of gcj. >>> But on an older gcj installation: >>> gcj (Debian 4.3.2-2) 4.3.2 >>> >>> gnu.xml.dom.DomDocumentBuilderFactory@6992f029 >>> gnu.xml.dom.DomDocumentBuilder@647a3539 >>> gnu.xml.dom.DomImpl@64826fa9 >>> >>> gnu.xml.dom.DomDocumentBuilderFactory@17d5dffb >>> gnu.xml.dom.DomDocumentBuilder@12bcf52b >>> java.lang.NullPointerException >>> at java.io.PrintStream.println(PrintStream.java:473) >> >> I found the problem. >> >> There is an implementation of jaxp in /usr/share/java/jaxp-1.3.jar and >> another in /usr/lib/libgcj.so.90. They are not the same version, and >> they are not compatible. >> >> If you link against /usr/lib/libgcj.so.90 then you must compile against >> the version of jaxp in that library. >> >> Do this: >> >> gcjh -cp /usr/share/java/libgcj.jar -d headers \ >> org.w3c.dom.DOMImplementation \ >> javax.xml.parsers.DocumentBuilder \ >> javax.xml.parsers.DocumentBuilderFactory > > I still see the problem. Even after I apt-get remove libjaxp1.3-java-gcj. The problem is not libjaxp1.3-java-gcj, it's libjaxp1.3-java >> I don't think it's possible to override the version of jaxp that's in >> /usr/lib/libgcj.so.90. > > I'd be fine using that version... if only it would work. The key is javax/xml/parsers/DocumentBuilder.h. Here's the difference between the bad and the good versiona: aph@classpath:/tmp$ diff -u headers/javax/xml/parsers/DocumentBuilder.h bad/javax/xml/parsers/DocumentBuilder.h --- headers/javax/xml/parsers/DocumentBuilder.h 2009-06-22 11:47:28.000000000 +0000 +++ bad/javax/xml/parsers/DocumentBuilder.h 2009-06-22 11:46:37.000000000 +0000 @@ -51,6 +51,7 @@ public: // actually protected DocumentBuilder(); public: + virtual void reset(); virtual ::org::w3c::dom::Document * parse(::java::io::InputStream *); virtual ::org::w3c::dom::Document * parse(::java::io::InputStream *, ::java::lang::String *); virtual ::org::w3c::dom::Document * parse(::java::lang::String *); @@ -62,9 +63,11 @@ virtual void setErrorHandler(::org::xml::sax::ErrorHandler *) = 0; virtual ::org::w3c::dom::Document * newDocument() = 0; virtual ::org::w3c::dom::DOMImplementation * getDOMImplementation() = 0; - virtual void reset(); virtual ::javax::xml::validation::Schema * getSchema(); virtual jboolean isXIncludeAware(); +private: + static const jboolean DEBUG = 0; +public: static ::java::lang::Class class$; }; ************************************************************************ Please make sure you delete *everything* from the old build. Especially the contents of the headers directory. ************************************************************************ If all that still fails, please send the failing script so we can try it. Andrew.