]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
bug fix: allow back slashes for file URLs as they are commonly used in Windows
authorChris Bowditch <cbowditch@apache.org>
Thu, 7 May 2009 15:08:30 +0000 (15:08 +0000)
committerChris Bowditch <cbowditch@apache.org>
Thu, 7 May 2009 15:08:30 +0000 (15:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@772672 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/apps/FOURIResolver.java
test/java/org/apache/fop/config/FOURIResolverTestCase.java
test/java/org/apache/fop/config/UserConfigTestSuite.java

index f96711d311a3ee6470398daed8f4408dfaa48f0e..c7d564ea3dfb22bff736f4c6da6c271170d79928 100644 (file)
@@ -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:
index e6f8db712f3ef53ece4f237108289b2c0e5896cf..e0f6d7f810335e57407e1bcbbfe877721b7154ee 100644 (file)
@@ -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");
index f933a0342c2d35ee93c77dae4c82f3c1289b0f68..168d87d513d98fd4b434a055817d71de0ffeb372 100644 (file)
@@ -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;
     }