[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

probable bug in libgcj6 version 4.0.1-4ubuntu9



To whom it may concern,

as I was trying to get a small Spring-based Java application to run on a fresh
Ubuntu 5.10 system I discovered an apparent problem with DTD parsing in libgcj6. 

Specifically, attributes declared as #IMPLIED are treated as if they had a
default value of "" when they should have no default value at all and should be
treated as absent (i.e. Element.hasAttribute() should return false) unless
they are explicitly specified in the document. I am attaching a small test setup
to demonstrate this. The code to run it is

$JAVA -cp test.jar:$JAXP_LIB
-Dorg.w3c.parsers.DocumentBuilderFactory=$PREFERRED_FACTORY test.XmlTest

where

- $JAVA is a Java interpreter (I tested with gij 4:4.0.1-3 and Sun's JDK 1.4.2_06)

- $JAXP_LIB is a path to a jar file with a JAXP implementation (I tested with
various gnujaxp.jar flavors I had, as well as rt.jar provided in Sun's JRE 1.4.2_06)

- $PREFERRED_FACTORY is the fully qualified class-name of a class implementing
org.w3c.parsers.DocumentBuilderFactory

To see what the test does, please unpack the jar and look at test/XmlTest.java.


My conclusions:

1. gij happily ignores $PREFERRED_FACTORY - it always goes with
gnu.xml.dom.DomDocumentBuilderFactory

2. gij happily ignores $JAXP_LIB - I have some gnujaxp.jar specimens which do
pass the test under Sun's JDK yet when I use them with gij the test fails.
Furthermore, gij --verbose lists the DomDocumentBuilderFactory as BC-compiled
with <no code source> which, I presume, means it is loaded from the .so file

3. The version of DomDocumentBuilderFactory (or one of its supporting classes)
used by gij exhibits the aforementioned bug

The bug means any Spring-based application that reads its bean configuration
from an XML file will fail because Spring checks that <property> elements
contain either the "ref" attribute or the "value" attribute but not both. When
run with libgcj6 in Ubuntu, <property> elements always contain both attributes
(with values of "" if omitted in the XML file). That throws Spring off base,
naturally.

Of course, you must have heard of this a lot since 5.10 came out - I'm writing
"just in case". It was a bit of a downer, though, that a bug manifesting itself
so prominently got through the famous Ubuntu QA process. I am determined to get
my little app working with gij and GNU Classpath so, time permitting,
I will hopefully submit more findings (especially regarding AWT and Swing).

Regards,
jh

P.S. Can you advise me on a way to convince gij that I really want to use a
class from the classpath rather than from libgcj6? That would be a nice
workaround...

Attachment: test.jar
Description: application/jar


Reply to: