From f37cd976d6f626a13798e409d8fe0cc6d3b04efb Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 4 Oct 2007 09:04:43 +0000 Subject: [PATCH] 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 --- .../org/apache/fop/fonts/CachedFontInfo.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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; } -- 2.39.5