Looks good from the build side.

/Erik

On 2013-05-14 14:16, Alan Bateman wrote:

The bootcycle-images target is currently broken in jdk8/tl.

Jon has taken 8014461 to fix genstubs but once you get past that then the CLDRConverter fails parsing LDML due to DTD references that aren't allowed by the default policy in jdk8 (since the update to JAXP 1.5). This policy is due to be re-visited later in jdk8 and I expect it will need to allow at least access to the DTDs on the file system. For now, and to get the boot cycle builds going again, I propose to update the CLDRConverter to set the accessExternalDTD property.

Attached is the proposed patch. It uses a hard-coded string rather than XMLConstants.ACCESS_EXTERNAL_DTD because the boot JDK will likely have an older version of JAXP where this constant isn't defined.

Thanks,
Alan.



diff --git a/make/tools/src/build/tools/cldrconverter/CLDRConverter.java b/make/tools/src/build/tools/cldrconverter/CLDRConverter.java
--- a/make/tools/src/build/tools/cldrconverter/CLDRConverter.java
+++ b/make/tools/src/build/tools/cldrconverter/CLDRConverter.java
@@ -34,6 +34,8 @@
 import java.util.*;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;


 /**
@@ -234,6 +236,17 @@
         }
     }

+    /**
+     * Configure the parser to allow access to DTDs on the file system.
+     */
+ private static void enableFileAccess(SAXParser parser) throws SAXNotSupportedException {
+        try {
+ parser.setProperty("http://javax.xml.XMLConstants/property/accessExternalDTD";, "file");
+        } catch (SAXNotRecognizedException ignore) {
+            // property requires >= JAXP 1.5
+        }
+    }
+
     private static List<Bundle> readBundleList() throws Exception {
ResourceBundle.Control defCon = ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
         List<Bundle> retList = new ArrayList<>();
@@ -279,6 +292,7 @@
         SAXParserFactory factory = SAXParserFactory.newInstance();
         factory.setValidating(true);
         SAXParser parser = factory.newSAXParser();
+        enableFileAccess(parser);
         LDMLParseHandler handler = new LDMLParseHandler(id);
File file = new File(SOURCE_FILE_DIR + File.separator + id + ".xml");
         if (!file.exists()) {
@@ -314,6 +328,7 @@
         SAXParserFactory factorySuppl = SAXParserFactory.newInstance();
         factorySuppl.setValidating(true);
         SAXParser parserSuppl = factorySuppl.newSAXParser();
+        enableFileAccess(parserSuppl);
         handlerSuppl = new SupplementDataParseHandler();
         File fileSupply = new File(SPPL_SOURCE_FILE);
         parserSuppl.parse(fileSupply, handlerSuppl);
@@ -322,6 +337,7 @@
SAXParserFactory numberingParser = SAXParserFactory.newInstance();
         numberingParser.setValidating(true);
         SAXParser parserNumbering = numberingParser.newSAXParser();
+        enableFileAccess(parserNumbering);
         handlerNumbering = new NumberingSystemsParseHandler();
         File fileNumbering = new File(NUMBERING_SOURCE_FILE);
         parserNumbering.parse(fileNumbering, handlerNumbering);
@@ -330,6 +346,7 @@
SAXParserFactory metazonesParser = SAXParserFactory.newInstance();
         metazonesParser.setValidating(true);
         SAXParser parserMetaZones = metazonesParser.newSAXParser();
+        enableFileAccess(parserMetaZones);
         handlerMetaZones = new MetaZonesParseHandler();
         File fileMetaZones = new File(METAZONES_SOURCE_FILE);
         parserNumbering.parse(fileMetaZones, handlerMetaZones);

Reply via email to