diff options
author | Jeremias Maerki <jeremias@apache.org> | 2011-01-17 15:08:39 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2011-01-17 15:08:39 +0000 |
commit | 5a367c3b12e19af7a66fc923d7149bf22cdfb596 (patch) | |
tree | 052e3c699db21fbea11fd8e391f3e82f5c87a540 | |
parent | dab44c5bc75cd8a7217b6cc8811c126284fa5723 (diff) | |
download | xmlgraphics-fop-5a367c3b12e19af7a66fc923d7149bf22cdfb596.tar.gz xmlgraphics-fop-5a367c3b12e19af7a66fc923d7149bf22cdfb596.zip |
Bugfix: Extracting the base directory through Configuration.getLocation() didn't work for Windows, since Windows paths can contain drive letters that are separated by colons. This lead to FOP scanning the whole drive for fonts starting from the drive root in the auto-detect case.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1059945 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/apps/FopFactoryConfigurator.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/apps/FopFactoryConfigurator.java b/src/java/org/apache/fop/apps/FopFactoryConfigurator.java index 6c1986cb2..9de00cd85 100644 --- a/src/java/org/apache/fop/apps/FopFactoryConfigurator.java +++ b/src/java/org/apache/fop/apps/FopFactoryConfigurator.java @@ -377,11 +377,17 @@ public class FopFactoryConfigurator { } private void setBaseURI() throws FOPException { - String[] locationParts = cfg.getLocation().split(":"); + String loc = cfg.getLocation(); + String[] locationParts = (loc != null ? cfg.getLocation().split(":") : null); try { if (locationParts != null && locationParts.length >= 2 && "file".equals(locationParts[0])) { - baseURI = new URI(locationParts[0], locationParts[1], null); + StringBuilder sb = new StringBuilder(locationParts[1]); + for (int idx = 2; idx < locationParts.length; idx++) { + sb.append(":").append(locationParts[idx]); + } + baseURI = new URI(locationParts[0], sb.toString(), null); + baseURI = baseURI.resolve(".").normalize(); } if (baseURI == null) { baseURI = new File(System.getProperty("user.dir")).toURI(); |