From: Jeremias Maerki Date: Thu, 4 Oct 2007 09:04:43 +0000 (+0000) Subject: Bugzilla #43542: X-Git-Tag: fop-0_95beta~386 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f37cd976d6f626a13798e409d8fe0cc6d3b04efb;p=xmlgraphics-fop.git Bugzilla #43542: 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 --- diff --git a/src/java/org/apache/fop/fonts/CachedFontInfo.java b/src/java/org/apache/fop/fonts/CachedFontInfo.java index fc7afd3da..35fec529c 100644 --- a/src/java/org/apache/fop/fonts/CachedFontInfo.java +++ b/src/java/org/apache/fop/fonts/CachedFontInfo.java @@ -20,10 +20,11 @@ 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; }