aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Bowditch <cbowditch@apache.org>2009-05-07 15:08:30 +0000
committerChris Bowditch <cbowditch@apache.org>2009-05-07 15:08:30 +0000
commita19fc7534d33c24a92ae88bbf172fc99327cf792 (patch)
treec1eaf9c2545aa249cadb4ecc0287dbf01172b65e
parent7133e60492f3d25502c478980de64c64ebcc6df4 (diff)
downloadxmlgraphics-fop-a19fc7534d33c24a92ae88bbf172fc99327cf792.tar.gz
xmlgraphics-fop-a19fc7534d33c24a92ae88bbf172fc99327cf792.zip
bug fix: allow back slashes for file URLs as they are commonly used in Windows
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@772672 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/apps/FOURIResolver.java2
-rw-r--r--test/java/org/apache/fop/config/FOURIResolverTestCase.java1
-rw-r--r--test/java/org/apache/fop/config/UserConfigTestSuite.java1
3 files changed, 4 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/apps/FOURIResolver.java b/src/java/org/apache/fop/apps/FOURIResolver.java
index f96711d31..c7d564ea3 100644
--- a/src/java/org/apache/fop/apps/FOURIResolver.java
+++ b/src/java/org/apache/fop/apps/FOURIResolver.java
@@ -68,6 +68,8 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {
* @throws MalformedURLException if there's a problem with a file URL
*/
public String checkBaseURL(String base) throws MalformedURLException {
+ // replace back slash with forward slash to ensure windows file:/// URLS are supported
+ base = base.replace('\\', '/');
if (!base.endsWith("/")) {
// The behavior described by RFC 3986 regarding resolution of relative
// references may be misleading for normal users:
diff --git a/test/java/org/apache/fop/config/FOURIResolverTestCase.java b/test/java/org/apache/fop/config/FOURIResolverTestCase.java
index e6f8db712..e0f6d7f81 100644
--- a/test/java/org/apache/fop/config/FOURIResolverTestCase.java
+++ b/test/java/org/apache/fop/config/FOURIResolverTestCase.java
@@ -39,6 +39,7 @@ public class FOURIResolverTestCase extends TestCase {
System.out.println(resolver.checkBaseURL("./test/config"));
System.out.println(resolver.checkBaseURL("file:test/config"));
System.out.println(resolver.checkBaseURL("fantasy:myconfig"));
+ System.out.println(resolver.checkBaseURL("file:test\\config\\"));
try {
resolver.checkBaseURL("./doesnotexist");
fail("Expected an exception for a inexistent base directory");
diff --git a/test/java/org/apache/fop/config/UserConfigTestSuite.java b/test/java/org/apache/fop/config/UserConfigTestSuite.java
index f933a0342..168d87d51 100644
--- a/test/java/org/apache/fop/config/UserConfigTestSuite.java
+++ b/test/java/org/apache/fop/config/UserConfigTestSuite.java
@@ -45,6 +45,7 @@ public class UserConfigTestSuite {
suite.addTest(new TestSuite(FontsDirectoryRecursiveTestCase.class));
suite.addTest(new TestSuite(FontsAutoDetectTestCase.class));
suite.addTest(new TestSuite(FontsSubstitutionTestCase.class));
+ suite.addTest(new TestSuite(FOURIResolverTestCase.class));
//$JUnit-END$
return suite;
}