<div dir="ltr"><div>This fixes/prevents an exception while parsing dvb.fontidex files with an unresolvable dtd file.<br></div>For example:<br><div><br><?xml version="1.0"?><br><!DOCTYPE fontdirectory PUBLIC "-//DVB//DTD Font Directory 1.0//EN" "<a href="http://www.dvb.org/mhp/dtd/fontdirectory-1-0.dtd">http://www.dvb.org/mhp/dtd/fontdirectory-1-0.dtd</a>"><br><fontdirectory><br>    <font><br>        <name>Miramonte</name><br>        <fontformat>OTF</fontformat><br>        <filename>00000.otf</filename><br>        <style>BOLD</style><br>    </font><br>    <font><br>        <name>MS Gothic</name><br>        <fontformat>OTF</fontformat><br>        <filename>00001.otf</filename><br>        <style>PLAIN</style><br>    </font><br></fontdirectory><br><div><br><br>Reference:<br><a href="https://stackoverflow.com/questions/1185519/how-to-read-well-formed-xml-in-java-but-skip-the-schema">https://stackoverflow.com/questions/1185519/how-to-read-well-formed-xml-in-java-but-skip-the-schema</a><br><br></div><div>I'm not sure if a "blacklist" approach is good, so comments welcome...<br></div><div><br><br>From a248a991aebfed760ab06ebddf9e2ed5d6501819 Mon Sep 17 00:00:00 2001<br>From: ace20022 <<a href="mailto:ace20022@ymail.com">ace20022@ymail.com</a>><br>Date: Thu, 6 Nov 2014 23:17:56 +0100<br>Subject: [PATCH 1/1] FontIndex: Fix parsing dvb.fontidex files with<br> unreachable dtd file definition.<br><br>---<br> src/libbluray/bdj/java/org/videolan/FontIndex.java | 15 ++++++++++++++-<br> 1 file changed, 14 insertions(+), 1 deletion(-)<br><br>diff --git a/src/libbluray/bdj/java/org/videolan/FontIndex.java b/src/libbluray/bdj/java/org/videolan/FontIndex.java<br>index 9eb856f..fcdca35 100644<br>--- a/src/libbluray/bdj/java/org/videolan/FontIndex.java<br>+++ b/src/libbluray/bdj/java/org/videolan/FontIndex.java<br>@@ -22,15 +22,19 @@ package org.videolan;<br> import java.awt.Font;<br> import java.io.FileInputStream;<br> import java.io.FileNotFoundException;<br>+import java.io.IOException;<br>+import java.io.StringReader;<br> import java.util.ArrayList;<br> <br> import javax.xml.parsers.SAXParser;<br> import javax.xml.parsers.SAXParserFactory;<br> import org.xml.sax.Attributes;<br>+import org.xml.sax.EntityResolver;<br>+import org.xml.sax.InputSource;<br> import org.xml.sax.SAXException;<br> import org.xml.sax.helpers.DefaultHandler;<br> <br>-public class FontIndex extends DefaultHandler {<br>+public class FontIndex extends DefaultHandler implements EntityResolver{<br>     public static FontIndexData[] parseIndex(String path) {<br>         return new FontIndex(path).getFontIndexData();<br>     }<br>@@ -60,6 +64,15 @@ public class FontIndex extends DefaultHandler {<br>         return (FontIndexData[])fontDatas.toArray(new FontIndexData[fontDatas.size()]);<br>     }<br> <br>+    public InputSource resolveEntity(String publicId, String systemId)<br>+            throws SAXException, IOException {<br>+        if (systemId.contains("<a href="http://www.dvb.org/mhp/dtd/fontdirectory-1-0.dtd">http://www.dvb.org/mhp/dtd/fontdirectory-1-0.dtd</a>")) {<br>+            return new InputSource(new StringReader(""));<br>+        } else {<br>+            return null;<br>+        }<br>+    }<br>+    <br>     public void startElement (String uri, String localName, String qName, Attributes attributes)<br>         throws SAXException {<br>         if (qName.equalsIgnoreCase("fontdirectory")) {<br>-- <br>1.9.2.msysgit.0<br><br><br><br></div></div></div>