On 06/05/2016 12:51, Gary Larsen wrote:


Thanks for the response. I get the space to %20, but have not figured out where to change the code in Cocoon.

Using this from the stack trace

at org.apache.cocoon.components.xslt.TraxProcessor.sourceToSAX(TraxProcessor.java:303)

I modified line 303 from:

            final String systemId = source.getURI();


final String systemId = URLEncoder.encode(source.getURI(), "UTF-8");

This resulted in an exception in Excalibur. Shouldn’t the encode() replace the space with %20?

Sure, but not only.

For example,

URLEncoder.encode("file:/C:/a-test 2/netvisn-server-c1022-72-6043/webapps/netvisn/site/stylesheets/netvisn-error2html.xsl", "UTF-8")



..which I would hardly qualify as a valid URI :-)


*From:*Francesco Chicchiriccò [mailto:ilgro...@apache.org]
*Sent:* Friday, May 06, 2016 2:51 AM
*To:* users@cocoon.apache.org
*Subject:* Re: Cocoon 2.1.9 and Saxon 9.6

On 05/05/2016 18:49, Gary Larsen wrote:


    In order to support JDK 8 it was necessary to update to SaxonHE 9.
     (can’t remember exactly why right now)

    New problem is that when the Cocoon app is installed on a path
    with spaces (say ‘a-test 2’) there’s a new exception:

    net.sf.saxon.trans.XPathException: Invalid URI for stylesheet:
    file:/C:/a-test <file:///C:%5Ca-test>

"file:/C:/a-test 2/netvisn-server-c1022-72-6043/webapps/netvisn/site/stylesheets/netvisn-error2html.xsl" <file:///C:%5Ca-test2%5Cnetvisn-server-c1022-72-6043%5Cwebapps%5Cnetvisn%5Csite%5Cstylesheets%5Cnetvisn-error2html.xsl>

is not a valid URI, while

"file:/C:/a-test%202/netvisn-server-c1022-72-6043/webapps/netvisn/site/stylesheets/netvisn-error2html.xsl" <file:///C:%5Ca-test%202%5Cnetvisn-server-c1022-72-6043%5Cwebapps%5Cnetvisn%5Csite%5Cstylesheets%5Cnetvisn-error2html.xsl>

is valid instead.

The blank space between 'a-test' and '2' is not allowed within URI, you need to percent-encode.

This as [1] says, "The space character, for example, is quoted by replacing it with "%20"


[1] http://docs.oracle.com/javase/8/docs/api/java/net/URI.html

Francesco Chicchiriccò

Tirasa - Open Source Excellence

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC,
Olingo PMC, CXF Committer, OpenJPA Committer

Reply via email to