]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugzilla #43542:
authorJeremias Maerki <jeremias@apache.org>
Thu, 4 Oct 2007 09:04:43 +0000 (09:04 +0000)
committerJeremias Maerki <jeremias@apache.org>
Thu, 4 Oct 2007 09:04:43 +0000 (09:04 +0000)
Removed dependency on Xalan's XML utilities. Used a method from Commons IO instead.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@581806 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fonts/CachedFontInfo.java

index fc7afd3da2df574e403e45995c81d2f01cade929..35fec529c5054c7d18ba70b3fb9a6d6c84bc4e01 100644 (file)
 package org.apache.fop.fonts;
 
 import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.List;
 
-import org.apache.xml.utils.URI;
-import org.apache.xml.utils.URI.MalformedURIException;
+import org.apache.commons.io.FileUtils;
 
 /**
  * Font info stored in the cache 
@@ -45,16 +46,18 @@ public class CachedFontInfo extends EmbedFontInfo {
         for (int i = 0; i < urls.length; i++) {
             String urlStr = urls[i]; 
             if (urlStr != null) {
+                File fontFile = null;
                 if (urlStr.startsWith("file:")) {
-                    URI uri;
                     try {
-                        uri = new URI(urlStr);
-                        urlStr = uri.getPath();
-                    } catch (MalformedURIException e) {
+                        URL url = new URL(urlStr);
+                        fontFile = FileUtils.toFile(url);
+                    } catch (MalformedURLException mfue) {
                         // do nothing
                     }
                 }
-                File fontFile = new File(urlStr);
+                if (fontFile == null) {
+                    fontFile = new File(urlStr);
+                }
                 if (fontFile.exists() && fontFile.canRead()) {
                     return fontFile;
                 }