svn commit: r1389814 - in /cocoon/subprojects/cocoon-block-deployment/trunk: ./ src/main/java/org/apache/cocoon/blockdeployment/ src/main/resources/META-INF/cocoon/spring/

[email protected]
Newsgroups gmane.text.xml.cocoon.cvs
Message-ID <[email protected]>
Author: thorsten
Date: Tue Sep 25 11:32:45 2012
New Revision: 1389814

URL: http://svn.apache.org/viewvc?rev=1389814&view=rev
Log:
COCOON3-105

Applying cleaned-up patch from Francesco Chicchiriccò.


Removed:
    cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLStreamHandlerFactory.java
    cocoon/subprojects/cocoon-block-deployment/trunk/src/main/resources/META-INF/cocoon/spring/cocoon-blockdeployment-protocol.xml
Modified:
    cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml
    cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java

Modified: cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml?rev=1389814&r1=1389813&r2=1389814&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml (original)
+++ cocoon/subprojects/cocoon-block-deployment/trunk/pom.xml Tue Sep 25 11:32:45 2012
@@ -77,7 +77,6 @@
       <groupId>org.springframework</groupId>
       <artifactId>spring-web</artifactId>
     </dependency>
-    
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
@@ -96,7 +95,7 @@
     <plugins>
       <plugin>
         <artifactId>maven-release-plugin</artifactId>
-        <version>2.2.2</version>
+        <version>2.3.2</version>
         <configuration>
           <tagBase>https://svn.apache.org/repos/asf/cocoon/subprojects/cocoon-block-deployment/tags/</tagBase>
         </configuration>
@@ -105,7 +104,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
-        <version>3.0</version>
+        <version>3.1</version>
         <configuration>
           <locales>en</locales>
           <reportPlugins>
@@ -131,7 +130,7 @@
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-changes-plugin</artifactId>
-              <version>2.7.1</version>
+              <version>2.8</version>
               <reportSets>
                 <reportSet>
                   <reports>

Modified: cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java?rev=1389814&r1=1389813&r2=1389814&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java (original)
+++ cocoon/subprojects/cocoon-block-deployment/trunk/src/main/java/org/apache/cocoon/blockdeployment/BlockContextURLConnection.java Tue Sep 25 11:32:45 2012
@@ -46,7 +46,6 @@ public class BlockContextURLConnection e
                             + " is configured correctly in the web.xml.");
         }
         this.blockContexts = blockContexts;
-        this.url = url;
     }
 
     @Override
@@ -61,39 +60,34 @@ public class BlockContextURLConnection e
 
     private URLConnection getConnection() {
         if (this.urlConnection == null) {
-            URL resolvedPath = null;
-            String location = this.url.toExternalForm();
+            final String location = this.url.toExternalForm();
 
             // Remove the protocol and the first '/'
             int pos = location.indexOf(":/");
             String path = location.substring(pos + 2);
 
             pos = path.indexOf('/');
-            if (pos != -1) {
-                // extract the block name and get the block context path
-                String blockName = path.substring(0, pos);
-                path = path.substring(pos + 1);
-                String blockContext = this.blockContexts.get(blockName);
-
-                if (blockContext == null) {
-                    throw new RuntimeException("There is no block '"
-                            + blockName
-                            + "' deployed. The available blocks are "
-                            + this.blockContexts + ".");
-                }
-
-                try {
-                    resolvedPath = new URL(new URL(blockContext), path);
-                    this.urlConnection = resolvedPath.openConnection();
-                } catch (IOException e) {
-                    throw new RuntimeException("Can create URL for '"
-                            + blockContext + path + "'.'");
-                }
-            } else {
+            if (pos == -1) {
                 throw new RuntimeException(
                         "The block name part of a block context uri must end with a '/' in "
                                 + location);
             }
+            // extract the block name and get the block context path
+            final String blockName = path.substring(0, pos);
+            path = path.substring(pos + 1);
+            final String blockContext = this.blockContexts.get(blockName);
+
+            if (blockContext == null) {
+                throw new RuntimeException("There is no block '" + blockName
+             +"' deployed. The available blocks are " + this.blockContexts + ".");
+            }
+
+            try {
+                final URL resolvedPath = new URL(new URL(blockContext), path);
+                this.urlConnection = resolvedPath.openConnection();
+            } catch (IOException e) {
+                throw new RuntimeException("Can create URL for '" + blockContext + path + "'.'");
+            }
         }
         return this.urlConnection;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.