This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: disable XML service files
- From: Tom Tromey <tromey at redhat dot com>
- To: GCJ-patches <java-patches at gcc dot gnu dot org>
- Date: 09 Mar 2007 14:55:53 -0700
- Subject: Patch: FYI: disable XML service files
- Reply-to: tromey at redhat dot com
I'm checking this in on the trunk and the RH 4.1 branch.
This removes the XML service files from libgcj.so. This lets us
override things properly again.
Andrew, I tried your test case from ifoox, but I can only see the
failure if I back out some of the latest XML bug fixes. However a
simpler test case shows which thing we're actually loading:
import javax.xml.parsers.*;
public class q {
public static void main(String[] args) throws Throwable{
DocumentBuilderFactory tf = DocumentBuilderFactory.newInstance();
System.out.println(tf.getClass());
}
}
Eg, here's the bug in action:
opsy. gij -Djava.class.path=/usr/share/java/xerces-j2.jar:. q
class gnu.xml.dom.DomDocumentBuilderFactory
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* sources.am, Makefile.in: Rebuilt.
* scripts/makemake.tcl (scan_directory): Allow service files to be
omitted.
Omit all XML-related service files.
Index: scripts/makemake.tcl
===================================================================
--- scripts/makemake.tcl (revision 122761)
+++ scripts/makemake.tcl (working copy)
@@ -123,6 +123,14 @@
# We haven't merged locale resources yet.
set properties_map(gnu/java/locale) _
+# We want to be able to load xerces if it is on the class path. So,
+# we have to avoid compiling in the XML-related service files.
+set properties_map(META-INF/services/javax.xml.parsers.DocumentBuilderFactory) _
+set properties_map(META-INF/services/javax.xml.parsers.SAXParserFactory) _
+set properties_map(META-INF/services/javax.xml.parsers.TransformerFactory) _
+set properties_map(META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory) _
+set properties_map(META-INF/services/org.w3c.dom.DOMImplementationSourceList) _
+set properties_map(META-INF/services/org.xml.sax.driver) _
# List of all properties files.
set properties_files {}
@@ -223,8 +231,10 @@
} elseif {[file isdirectory $file]} {
lappend subdirs $subdir/$file
} elseif {$subdir == "META-INF/services"} {
- # All service files are included as properties.
- lappend properties_files $basedir/$subdir/$file
+ # Service files are generally included as properties.
+ if {! [info exists properties_map($subdir/$file)]} {
+ lappend properties_files $basedir/$subdir/$file
+ }
}
}
cd $here