cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject svn commit: r477097 - /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
Date Mon, 20 Nov 2006 08:09:29 GMT
Author: giacomo
Date: Mon Nov 20 00:09:26 2006
New Revision: 477097

URL: http://svn.apache.org/viewvc?view=rev&rev=477097
Log:
prevent SIOOB-Exception

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java?view=diff&rev=477097&r1=477096&r2=477097
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
Mon Nov 20 00:09:26 2006
@@ -87,11 +87,13 @@
                 // if this is a file url generated by the Maven,
                 // it has this form "file:{url}/{block name}/target/classes/COB-INF
                 int pos = url.indexOf("/target/classes/COB-INF");
-                // extract block name
-                String blockName = url.substring(0, pos);
-                blockName = blockName.substring(blockName.lastIndexOf('/') + 1);
-                // register the root URL for the block resources
-                DeploymentUtil.blockContexts.put(blockName, url);
+                // extract block name (if any)
+                if (pos >= 0) {
+                    String blockName = url.substring(0, pos);
+                    blockName = blockName.substring(blockName.lastIndexOf('/') + 1);
+                    // register the root URL for the block resources
+                    DeploymentUtil.blockContexts.put(blockName, url);
+                }
             } else if ( "jar".equals(resourceUrl.getProtocol()) ) {
                 // if this is a jar url, it has this form "jar:{url-to-jar}!/{resource-path}
                 // to open the jar, we can simply remove everything after "!/"



Mime
View raw message