You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2007/12/21 13:27:54 UTC

svn commit: r606174 - /cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java

Author: vgritsenko
Date: Fri Dec 21 04:27:53 2007
New Revision: 606174

URL: http://svn.apache.org/viewvc?rev=606174&view=rev
Log:
"Remove the protocol and the first '/'" - do as comment says

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

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java?rev=606174&r1=606173&r2=606174&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java Fri Dec 21 04:27:53 2007
@@ -92,10 +92,10 @@
             // Remove the protocol and the first '/'
             final int pos = location.indexOf(":/");
             final String scheme = location.substring(0, pos);
-            final String path = location.substring(pos+1);
+            final String path = location.substring(pos + 2);
 
             // fix for #24093, we don't give access to files outside the context:
-            if ( path.indexOf("../") != -1 ) {
+            if (path.indexOf("../") != -1) {
                 throw new MalformedURLException("Invalid path ('../' is not allowed) : " + path);
             }
 
@@ -121,28 +121,30 @@
                     }
                 }
                 return source;                
-            } 
+            }
+
             final String message = location + " could not be found. (possible context problem)";
-            this.getLogger().info(message);
+            getLogger().info(message);
             throw new MalformedURLException(message);
         } catch (ServiceException se) {
             throw new SourceException("Unable to lookup source resolver.", se);
         } finally {
-            this.manager.release( resolver );
+            this.manager.release(resolver);
         }
     }
 
     /**
      * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
      */
-    public void release( Source source ) {
+    public void release(Source source) {
         // In fact, this method should never be called as this factory
         // returns a source object from a different factory. So that
         // factory should release the source
-        if (null != source) {
+        if (source != null) {
             if (getLogger().isDebugEnabled()) {
                 getLogger().debug("Releasing source " + source.getURI());
             }
+
             SourceResolver resolver = null;
             try {
                 resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);