[libbluray-devel] FontIndex: Fix parsing dvb.fontidex files with unreachable dtd file definition.

ace20022 git at videolan.org
Fri Nov 7 11:51:10 CET 2014


libbluray | branch: master | ace20022 <ace20022 at ymail.com> | Thu Nov  6 23:17:56 2014 +0100| [4e8935a5598c30d476a30c6a19af0386605fd143] | committer: hpi1

FontIndex: Fix parsing dvb.fontidex files with unreachable dtd file definition.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=4e8935a5598c30d476a30c6a19af0386605fd143
---

 src/libbluray/bdj/java/org/videolan/FontIndex.java |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdj/java/org/videolan/FontIndex.java b/src/libbluray/bdj/java/org/videolan/FontIndex.java
index 9eb856f..ca92d44 100644
--- a/src/libbluray/bdj/java/org/videolan/FontIndex.java
+++ b/src/libbluray/bdj/java/org/videolan/FontIndex.java
@@ -22,15 +22,19 @@ package org.videolan;
 import java.awt.Font;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.StringReader;
 import java.util.ArrayList;
 
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
-public class FontIndex extends DefaultHandler {
+public class FontIndex extends DefaultHandler implements EntityResolver{
     public static FontIndexData[] parseIndex(String path) {
         return new FontIndex(path).getFontIndexData();
     }
@@ -60,6 +64,15 @@ public class FontIndex extends DefaultHandler {
         return (FontIndexData[])fontDatas.toArray(new FontIndexData[fontDatas.size()]);
     }
 
+    public InputSource resolveEntity(String publicId, String systemId)
+            throws SAXException, IOException {
+        if (systemId.contains("http://www.dvb.org/mhp/dtd/fontdirectory-1-0.dtd")) {
+            return new InputSource(new StringReader(""));
+        } else {
+            return null;
+        }
+    }
+
     public void startElement (String uri, String localName, String qName, Attributes attributes)
         throws SAXException {
         if (qName.equalsIgnoreCase("fontdirectory")) {



More information about the libbluray-devel mailing list