Discussion:
[jira] [Created] (COCOON-2351) ContextSourceFactory calculates the path incorrectly when removing the protocol part
Johan Sjöberg (JIRA)
2016-08-18 14:57:22 UTC
Permalink
Johan Sjöberg created COCOON-2351:
-------------------------------------

Summary: ContextSourceFactory calculates the path incorrectly when removing the protocol part
Key: COCOON-2351
URL: https://issues.apache.org/jira/browse/COCOON-2351
Project: Cocoon
Issue Type: Bug
Components: * Cocoon Core
Affects Versions: 2.1.12
Reporter: Johan Sjöberg
Priority: Minor
Fix For: 2.1.13


On line 96 in org.apache.cocoon.components.source.impl.ContextSourceFactory the removal of protocol and the first '/' leaves two slashes in the path. It should be:
final String path = location.substring(pos+2);

This probably worked on older servlet engines but fails at least on Jetty newer than 8.1.11 and 9.0.6 when indexing into paths like context://foo.bar which results in a call to ServletContext.getRealPath("//foo.bar")



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Johan Sjöberg (JIRA)
2016-08-18 15:01:20 UTC
Permalink
[ https://issues.apache.org/jira/browse/COCOON-2351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Sjöberg updated COCOON-2351:
----------------------------------
Attachment: cocoon-2351.patch

Attached diff
Post by Johan Sjöberg (JIRA)
ContextSourceFactory calculates the path incorrectly when removing the protocol part
------------------------------------------------------------------------------------
Key: COCOON-2351
URL: https://issues.apache.org/jira/browse/COCOON-2351
Project: Cocoon
Issue Type: Bug
Components: * Cocoon Core
Affects Versions: 2.1.12
Reporter: Johan Sjöberg
Priority: Minor
Fix For: 2.1.13
Attachments: cocoon-2351.patch
final String path = location.substring(pos+2);
This probably worked on older servlet engines but fails at least on Jetty newer than 8.1.11 and 9.0.6 when indexing into paths like context://foo.bar which results in a call to ServletContext.getRealPath("//foo.bar")
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Francesco Chicchiriccò (JIRA)
2016-08-18 15:03:20 UTC
Permalink
[ https://issues.apache.org/jira/browse/COCOON-2351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Francesco Chicchiriccò reassigned COCOON-2351:
----------------------------------------------

Assignee: Francesco Chicchiriccò
Post by Johan Sjöberg (JIRA)
ContextSourceFactory calculates the path incorrectly when removing the protocol part
------------------------------------------------------------------------------------
Key: COCOON-2351
URL: https://issues.apache.org/jira/browse/COCOON-2351
Project: Cocoon
Issue Type: Bug
Components: * Cocoon Core
Affects Versions: 2.1.12
Reporter: Johan Sjöberg
Assignee: Francesco Chicchiriccò
Priority: Minor
Fix For: 2.1.13
Attachments: cocoon-2351.patch
final String path = location.substring(pos+2);
This probably worked on older servlet engines but fails at least on Jetty newer than 8.1.11 and 9.0.6 when indexing into paths like context://foo.bar which results in a call to ServletContext.getRealPath("//foo.bar")
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Francesco Chicchiriccò (JIRA)
2016-08-18 15:04:20 UTC
Permalink
[ https://issues.apache.org/jira/browse/COCOON-2351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Francesco Chicchiriccò closed COCOON-2351.
------------------------------------------
Resolution: Fixed

Patch applied, thanks for reporting!

http://svn.apache.org/viewvc?rev=1756805&view=rev
Post by Johan Sjöberg (JIRA)
ContextSourceFactory calculates the path incorrectly when removing the protocol part
------------------------------------------------------------------------------------
Key: COCOON-2351
URL: https://issues.apache.org/jira/browse/COCOON-2351
Project: Cocoon
Issue Type: Bug
Components: * Cocoon Core
Affects Versions: 2.1.12
Reporter: Johan Sjöberg
Assignee: Francesco Chicchiriccò
Priority: Minor
Fix For: 2.1.13
Attachments: cocoon-2351.patch
final String path = location.substring(pos+2);
This probably worked on older servlet engines but fails at least on Jetty newer than 8.1.11 and 9.0.6 when indexing into paths like context://foo.bar which results in a call to ServletContext.getRealPath("//foo.bar")
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Hudson (JIRA)
2016-08-18 15:20:21 UTC
Permalink
[ https://issues.apache.org/jira/browse/COCOON-2351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15426627#comment-15426627 ]

Hudson commented on COCOON-2351:
--------------------------------

SUCCESS: Integrated in Jenkins build Cocoon 2.1.X #105 (See [https://builds.apache.org/job/Cocoon%202.1.X/105/])
[COCOON-2351] Applying provided patch (ilgrosso: [http://svn.apache.org/viewvc/?view=rev&rev=1756805])
* (edit) BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
Post by Johan Sjöberg (JIRA)
ContextSourceFactory calculates the path incorrectly when removing the protocol part
------------------------------------------------------------------------------------
Key: COCOON-2351
URL: https://issues.apache.org/jira/browse/COCOON-2351
Project: Cocoon
Issue Type: Bug
Components: * Cocoon Core
Affects Versions: 2.1.12
Reporter: Johan Sjöberg
Assignee: Francesco Chicchiriccò
Priority: Minor
Fix For: 2.1.13
Attachments: cocoon-2351.patch
final String path = location.substring(pos+2);
This probably worked on older servlet engines but fails at least on Jetty newer than 8.1.11 and 9.0.6 when indexing into paths like context://foo.bar which results in a call to ServletContext.getRealPath("//foo.bar")
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Loading...