You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2007/03/12 23:49:43 UTC

svn commit: r517445 - in /cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl: ZipSource.java ZipSourceFactory.java

Author: joerg
Date: Mon Mar 12 15:49:43 2007
New Revision: 517445

URL: http://svn.apache.org/viewvc?view=rev&rev=517445
Log:
COCOON-2022: fix URI handling in ZipSource

Modified:
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java?view=diff&rev=517445&r1=517444&r2=517445
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSource.java Mon Mar 12 15:49:43 2007
@@ -41,7 +41,6 @@
     private Source archive;
     private String filePath;
 
-
     public ZipSource(String protocol, Source archive, String filePath) {
         this.protocol = protocol;
         this.archive = archive;
@@ -89,14 +88,12 @@
         }
     }
 
-    public InputStream getInputStream()
-    throws IOException, SourceNotFoundException {
-
+    public InputStream getInputStream() throws IOException, SourceNotFoundException {
         ZipInputStream zipStream = new ZipInputStream(this.archive.getInputStream());
         try {
             ZipEntry entry = findEntry(zipStream);
             if (entry == null) {
-                throw new SourceNotFoundException("File " + filePath + " is not found in the archive " +
+                throw new SourceNotFoundException("File " + this.filePath + " is not found in the archive " +
                                                   this.archive.getURI());
             }
 
@@ -123,7 +120,7 @@
     }
 
     public String getURI() {
-        return this.protocol + this.archive.getURI() + "!/" + this.filePath;
+        return this.protocol + ":" + this.archive.getURI() + "!/" + this.filePath;
     }
 
     public String getScheme() {
@@ -169,4 +166,5 @@
     public long getLastModified() {
         return this.archive.getLastModified();
     }
+    
 }

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java?view=diff&rev=517445&r1=517444&r2=517445
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ZipSourceFactory.java Mon Mar 12 15:49:43 2007
@@ -52,14 +52,11 @@
 
     private ServiceManager manager;
 
-
     public void service(ServiceManager manager) throws ServiceException {
         this.manager = manager;
     }
 
-
-    public Source getSource(String location, Map parameters)
-    throws IOException, MalformedURLException {
+    public Source getSource(String location, Map parameters) throws IOException, MalformedURLException {
         // Checks URL syntax
         int protocolEnd = location.indexOf(":");
         if (protocolEnd == -1) {
@@ -72,7 +69,7 @@
         }
 
         // Get protocol. Protocol is configurable via cocoon.xconf
-        final String protocol = location.substring(0, protocolEnd - 1);
+        final String protocol = location.substring(0, protocolEnd);
 
         // Get archive URL
         final String archiveURL = location.substring(protocolEnd + 1, archiveEnd);
@@ -107,4 +104,5 @@
             this.manager.release(resolver);
         }
     }
+    
 }