cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jorg Heymans (JIRA)" <>
Subject [jira] Commented: (COCOON-2022) broken URI handling in ZipSource
Date Wed, 14 Mar 2007 22:05:09 GMT


Jorg Heymans commented on COCOON-2022:

You can look at the maven test report in cocoon-core/target/surefire-reports/TEST-org.apache.cocoon.components.source.impl.ZipSourceTestCase.xml

  <testcase time="0.12" name="testURIHandling">    <failure type="junit.framework.ComparisonFailure"
message="Uri is wrong. expected:&amp;lt;zip:file:/[/]!/test.xml&amp;gt; but
Uri is wrong. expected:&amp;zip:file:/[/]!/test.xml&amp; but was:&amp;zip:file:/[]!/test.xml&amp;
       at junit.framework.Assert.assertEquals(        at org.apache.cocoon.components.source.impl.ZipSourceTestCase.testURIHandling(</failure>
   <system-out>[DEBUG] SourceResolver: Using base URL: file:/Users/jheymans/src/cocoon-trunk/core/cocoon-core/[DEBUG]
Resolving &apos;zip:file://!/test.xml&apos; with base &apos;null&apos;
in context &apos;file:/Users/jheymans/src/cocoon-trunk/core/cocoon-core/&apos;[DEBUG]
Resolved to systemID : zip:file://!/test.xml
[DEBUG] Resolving &apos;file://; with base &apos;null&apos; in
context &apos;file:/Users/jheymans/src/cocoon-trunk/core/cocoon-core/&apos;
[DEBUG] Resolved to systemID : file://
[DEBUG] Creating source object for file://

> broken URI handling in ZipSource
> --------------------------------
>                 Key: COCOON-2022
>                 URL:
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.1.10
>            Reporter: Jörg Heinicke
>         Assigned To: Jörg Heinicke
>            Priority: Minor
> On behalf of Leonid Geller:
> 1. Bug in org.apache.cocoon.components.source.impl.ZipSourceFactory, on this line:
>         // Get protocol. Protocol is configurable via cocoon.xconf
>         final String protocol = location.substring(0, protocolEnd - 1);
> Obviously it should be location.substring(0, protocolEnd). This is what causes zip to
be truncated to "zi".
> 2. When using a SYSTEM identifier with relative DTD path, the XML parser will look for
the file relative to the URI of the zipped source,!/source.xml which is obviously
going to fail.
> Here, the solution is to have the source implementation class (in this case org.apache.cocoon.components.source.impl.ZipSource)
to change getURI method to return source.xml based on location, w/o the zip protocol.
Current implementation:
> 	return this.protocol + this.archive.getURI() + "!/" + this.filePath;
> is not going to work. Something like this will:
>     	int iZipIdx = this.archive.getURI().lastIndexOf("/");
> 	if (iZipIdx < 0) iZipIdx = 0;
>     	return this.archive.getURI().substring(0,iZipIdx)+"/"+ this.filePath;

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message