You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by cb...@apache.org on 2009/05/07 17:08:30 UTC

svn commit: r772672 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/apps/FOURIResolver.java test/java/org/apache/fop/config/FOURIResolverTestCase.java test/java/org/apache/fop/config/UserConfigTestSuite.java

Author: cbowditch
Date: Thu May  7 15:08:30 2009
New Revision: 772672

URL: http://svn.apache.org/viewvc?rev=772672&view=rev
Log:
bug fix: allow back slashes for file URLs as they are commonly used in Windows

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/config/FOURIResolverTestCase.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/config/UserConfigTestSuite.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java?rev=772672&r1=772671&r2=772672&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java Thu May  7 15:08:30 2009
@@ -68,6 +68,8 @@
      * @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:

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/config/FOURIResolverTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/config/FOURIResolverTestCase.java?rev=772672&r1=772671&r2=772672&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/config/FOURIResolverTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/config/FOURIResolverTestCase.java Thu May  7 15:08:30 2009
@@ -39,6 +39,7 @@
         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");

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/config/UserConfigTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/config/UserConfigTestSuite.java?rev=772672&r1=772671&r2=772672&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/config/UserConfigTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/config/UserConfigTestSuite.java Thu May  7 15:08:30 2009
@@ -45,6 +45,7 @@
         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;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Re: svn commit: r772672 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/apps/FOURIResolver.java

Posted by Chris Bowditch <bo...@hotmail.com>.
Andreas Delmelle wrote:

Hi Simon and Andreas,

> On 07 May 2009, at 21:15, Simon Pepping wrote:
> 
>> On Thu, May 07, 2009 at 03:08:30PM -0000, cbowditch@apache.org wrote:
>>
>>> Author: cbowditch
>>> Date: Thu May  7 15:08:30 2009
>>> New Revision: 772672
>>>
>>> URL: http://svn.apache.org/viewvc?rev=772672&view=rev
>>> Log:
>>> bug fix: allow back slashes for file URLs as they are commonly used  
>>> in Windows
>>
>>
>> I would not like to call file:///C:\mydirectory\myfile a correct
>> URL. URLs are one format where Windows and Unix users use the same
>> forward slashes. URL is a standard for all OSes alike.
> 
> 
> I very much agree with that assessment. Browsing through the related  
> RFCs, one notices that the forward slash is a 'reserved' character,  
> while a backslash is considered 'unwise'. The reason is that "gateways  
> and other transport agents are known to sometimes modify such  
> characters, or they are
> used as delimiters".
> Following RFC 2396, the URL 'file:///c:\mydirectory\myfile' is not  
> equivalent to 'file:///c:/mydirectory/myfile' from the point of view  of 
> URI syntax.

Whilst you are both technically correct, I made the change because 
backslashes in file URLs used to work until revision 752153 when 
Jeremias inadvertantly removed support for this. Whilst this may be 
against the URL spec this is a feature that improves usability of the 
product. A lot of users out there aren't aware of the details of RFC 
2396 and are used to being able to use backslashes in file URLs 
(especially on Windows systems). So if we remove support for this we may 
get a few more questions on fop-user.

I personally prefer flexibility over rigid conformance to a 
specification and stand by my change. There are a few parts of the 
XSL-FO specification that I disagree with as well as I think they make 
it harder for the user to achieve what they need. Look at indent 
inheritance; that often confuses users, and makes it harder for users to 
achieve the affect they seek. So blindly following a spec isn't always 
the right thing to do IMO.

> 
> Therefore, it is wrong to expect them to yield the same behavior. One  
> could argue that we then also need to allow a colon as separator for  
> the hierarchical parts, to satisfy legacy Mac OS users... :-)

Thanks,

Chris

> 
> 
> Regards
> 
> Andreas
> 
> 




Re: discussion of project expectation on private@.

Posted by jc...@gmail.com.
Ok. That is private.

Regards, Jan
----- Original Message ----- 
From: "Jeremias Maerki" <de...@jeremias-maerki.ch>
To: <fo...@xmlgraphics.apache.org>
Sent: Monday, May 11, 2009 10:23 AM
Subject: Re: discussion of project expectation on private@.


Jan,
there was no technical discussion there, don't worry. This was about
Vincent and me disagreeing on expectations on the lengths we should go
to for code beautification. It was also about how we talk to each other.
I took this to private@ because I didn't want to pollute this list with
yet another fight (see fop-dev archives, too). There was also no real
resolution of the conflict, only a privately negotiated cease-fire that
didn't really work out for me. Thus my timeout from FOP [1].

[1] http://markmail.org/message/fonqe4txsf3w72eg

Technical discussions on FOP will always remain in the open on fop-dev.
Period. You can count on that.

On 11.05.2009 10:05:52 jcumps wrote:
> Team,
> Can the discussion of project expectation be held on fop-dev@ in stead of 
> on
> private@ , if this is related to the future development of FOP?
>
> Regards,
> Jan Cumps




Jeremias Maerki


Re: discussion of project expectation on private@.

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Jan,
there was no technical discussion there, don't worry. This was about
Vincent and me disagreeing on expectations on the lengths we should go
to for code beautification. It was also about how we talk to each other.
I took this to private@ because I didn't want to pollute this list with
yet another fight (see fop-dev archives, too). There was also no real
resolution of the conflict, only a privately negotiated cease-fire that
didn't really work out for me. Thus my timeout from FOP [1].

[1] http://markmail.org/message/fonqe4txsf3w72eg

Technical discussions on FOP will always remain in the open on fop-dev.
Period. You can count on that.

On 11.05.2009 10:05:52 jcumps wrote:
> Team,
> Can the discussion of project expectation be held on fop-dev@ in stead of on 
> private@ , if this is related to the future development of FOP?
> 
> Regards,
> Jan Cumps 




Jeremias Maerki


discussion of project expectation on private@.

Posted by jc...@gmail.com.
Team,
Can the discussion of project expectation be held on fop-dev@ in stead of on 
private@ , if this is related to the future development of FOP?

Regards,
Jan Cumps 


Re: svn commit: r772672 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/apps/FOURIResolver.java

Posted by Max Berger <ma...@berger.name>.
Hi *,

Andreas Delmelle schrieb:
>>> <snip />
>>> Whilst you are both technically correct, I made the change because
>>> backslashes in file URLs used to work until revision 752153 when
>>> Jeremias inadvertantly removed support for this. Whilst this may be
>>> against the URL spec this is a feature that improves usability of the
>>> product. A lot of users out there aren't aware of the details of RFC
>>> 2396 and are used to being able to use backslashes in file URLs
>>> (especially on Windows systems). So if we remove support for this we may
>>> get a few more questions on fop-user.

For a windows user \ is a valid path separator, and should be kept
working as path separator.

If this function is the right place may be debatable.

> Performing the substitution as part of basic URI resolution, for any
> protocol or on another platform introduces a genuine bug, while not
> resolving paths as URIs on one platform seems just an inconvenience.

Here is another idea: Just substitute File.separator with /

Pro: Would satisfy windows users
Pro: The "misbehavior" only exists on windows.
Con: URI Resolver would work differently on different plattforms.

> Cheers
> Andreas

Max

-- 
http://max.berger.name/
OpenPGP ID: C93C5700 Fpr: AB6638CE472A499B3959 ADA2F989A2E5C93C5700


Re: svn commit: r772672 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/apps/FOURIResolver.java

Posted by Andreas Delmelle <an...@telenet.be>.
On 08 May 2009, at 10:07, Simon Pepping wrote:

    [Chris: ]
>> <snip />
>> Whilst you are both technically correct, I made the change because
>> backslashes in file URLs used to work until revision 752153 when
>> Jeremias inadvertantly removed support for this. Whilst this may be
>> against the URL spec this is a feature that improves usability of the
>> product. A lot of users out there aren't aware of the details of RFC
>> 2396 and are used to being able to use backslashes in file URLs
>> (especially on Windows systems). So if we remove support for this  
>> we may
>> get a few more questions on fop-user.
>
> If it used to work until recently, it should be kept
> working. Otherwise, I would very much like to tell users that URIs are
> a different thing than path names, and that backward slashes are out.

I'm still not sure I'm comfortable with the change as-is, due to the  
fact that:
a) it is located in FOURIResolver and
b) it is not limited to file URLs,

which basically means that it would also affect other URIs.

Performing the substitution as part of basic URI resolution, for any  
protocol or on another platform introduces a genuine bug, while not  
resolving paths as URIs on one platform seems just an inconvenience.

The base URL can be specified either as a platform-dependent filespec  
(no 'file:' prefix, native separators allowed) or as a genuine URI  
(forward slashes as separators).
In the first case, FOP should gladly take care of externalizing the  
identifier and prepending the scheme. Using a mixture of both should  
definitely be discouraged, IMO.


Cheers

Andreas

Re: svn commit: r772672 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/apps/FOURIResolver.java

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Fri, May 08, 2009 at 08:33:11AM +0100, Chris Bowditch wrote:
> Andreas Delmelle wrote:
>
> Hi Simon and Andreas,
>
>> On 07 May 2009, at 21:15, Simon Pepping wrote:
>>
>>> On Thu, May 07, 2009 at 03:08:30PM -0000, cbowditch@apache.org wrote:
>>>
>>>> Author: cbowditch
>>>> Date: Thu May  7 15:08:30 2009
>>>> New Revision: 772672
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=772672&view=rev
>>>> Log:
>>>> bug fix: allow back slashes for file URLs as they are commonly used 
>>>>  in Windows
>>>
>>>
>>> I would not like to call file:///C:\mydirectory\myfile a correct
>>> URL. URLs are one format where Windows and Unix users use the same
>>> forward slashes. URL is a standard for all OSes alike.
>>
>>
>> I very much agree with that assessment. Browsing through the related   
>> RFCs, one notices that the forward slash is a 'reserved' character,   
>> while a backslash is considered 'unwise'. The reason is that "gateways  
>> and other transport agents are known to sometimes modify such   
>> characters, or they are
>> used as delimiters".
>> Following RFC 2396, the URL 'file:///c:\mydirectory\myfile' is not   
>> equivalent to 'file:///c:/mydirectory/myfile' from the point of view  
>> of URI syntax.
>
> Whilst you are both technically correct, I made the change because  
> backslashes in file URLs used to work until revision 752153 when  
> Jeremias inadvertantly removed support for this. Whilst this may be  
> against the URL spec this is a feature that improves usability of the  
> product. A lot of users out there aren't aware of the details of RFC  
> 2396 and are used to being able to use backslashes in file URLs  
> (especially on Windows systems). So if we remove support for this we may  
> get a few more questions on fop-user.

If it used to work until recently, it should be kept
working. Otherwise, I would very much like to tell users that URIs are
a different thing than path names, and that backward slashes are out.

Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu

Re: svn commit: r772672 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/apps/FOURIResolver.java

Posted by Andreas Delmelle <an...@telenet.be>.
On 07 May 2009, at 21:15, Simon Pepping wrote:

> On Thu, May 07, 2009 at 03:08:30PM -0000, cbowditch@apache.org wrote:
>> Author: cbowditch
>> Date: Thu May  7 15:08:30 2009
>> New Revision: 772672
>>
>> URL: http://svn.apache.org/viewvc?rev=772672&view=rev
>> Log:
>> bug fix: allow back slashes for file URLs as they are commonly used  
>> in Windows
>
> I would not like to call file:///C:\mydirectory\myfile a correct
> URL. URLs are one format where Windows and Unix users use the same
> forward slashes. URL is a standard for all OSes alike.

I very much agree with that assessment. Browsing through the related  
RFCs, one notices that the forward slash is a 'reserved' character,  
while a backslash is considered 'unwise'. The reason is that "gateways  
and other transport agents are known to sometimes modify such  
characters, or they are
used as delimiters".
Following RFC 2396, the URL 'file:///c:\mydirectory\myfile' is not  
equivalent to 'file:///c:/mydirectory/myfile' from the point of view  
of URI syntax.

Therefore, it is wrong to expect them to yield the same behavior. One  
could argue that we then also need to allow a colon as separator for  
the hierarchical parts, to satisfy legacy Mac OS users... :-)


Regards

Andreas

Re: svn commit: r772672 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/apps/FOURIResolver.java

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Thu, May 07, 2009 at 03:08:30PM -0000, cbowditch@apache.org wrote:
> Author: cbowditch
> Date: Thu May  7 15:08:30 2009
> New Revision: 772672
> 
> URL: http://svn.apache.org/viewvc?rev=772672&view=rev
> Log:
> bug fix: allow back slashes for file URLs as they are commonly used in Windows

I would not like to call file:///C:\mydirectory\myfile a correct
URL. URLs are one format where Windows and Unix users use the same
forward slashes. URL is a standard for all OSes alike.

Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu