[jboss-cvs] JBossAS SVN: r74968 - trunk/server/src/main/org/jboss/web/deployers.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 24 06:04:12 EDT 2008


Author: dimitris at jboss.org
Date: 2008-06-24 06:04:12 -0400 (Tue, 24 Jun 2008)
New Revision: 74968

Modified:
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
Log:
JBAS-5508, avoid the java.lang.StringIndexOutOfBoundsException


Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2008-06-24 10:03:41 UTC (rev 74967)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2008-06-24 10:04:12 UTC (rev 74968)
@@ -60,27 +60,27 @@
 import org.jboss.web.WebApplication;
 
 /** A template pattern class for web container integration into JBoss. This class
- should be subclassed by web container providers wishing to integrate their
- container into a JBoss server. The sole method to implement is: 
- {@link #getDeployment(DeploymentUnit, WebMetaData)}. This is called from
- within {@linkplain #deploy(DeploymentUnit, WebMetaData)} to translate the
- WebMetaData into a AbstractWarDeployment bean that will be passed to the
- {@link org.jboss.system.deployers.ServiceDeployer} by creating ServiceMetaData
- for the AbstractWarDeployment in
- {@link #deployWebModule(DeploymentUnit, WebMetaData, AbstractWarDeployment)}
- 
- The output of this deployer is a ServiceMetaData attachment. When this is
- translated into a service instance by the ServiceDeployer, the
- AbstractWarDeployment start/stop trigger the actual deployment/undeployment of
- the web application.
-
- @see org.jboss.web.deployers.AbstractWarDeployment
-
- @author  Scott.Stark at jboss.org
- @author  Christoph.Jung at infor.de
- @author  Thomas.Diesler at arcor.de
- @author  adrian at jboss.org
- @version $Revision: 55985 $
+ * should be subclassed by web container providers wishing to integrate their
+ * container into a JBoss server. The sole method to implement is: 
+ * {@link #getDeployment(DeploymentUnit, WebMetaData)}. This is called from
+ * within {@linkplain #deploy(DeploymentUnit, WebMetaData)} to translate the
+ * WebMetaData into a AbstractWarDeployment bean that will be passed to the
+ * {@link org.jboss.system.deployers.ServiceDeployer} by creating ServiceMetaData
+ * for the AbstractWarDeployment in
+ * {@link #deployWebModule(DeploymentUnit, WebMetaData, AbstractWarDeployment)}
+ *
+ * The output of this deployer is a ServiceMetaData attachment. When this is
+ * translated into a service instance by the ServiceDeployer, the
+ * AbstractWarDeployment start/stop trigger the actual deployment/undeployment of
+ * the web application.
+ *
+ * @see org.jboss.web.deployers.AbstractWarDeployment
+ *
+ * @author  Scott.Stark at jboss.org
+ * @author  Christoph.Jung at infor.de
+ * @author  Thomas.Diesler at arcor.de
+ * @author  adrian at jboss.org
+ * @version $Revision: 55985 $
  */
 public abstract class AbstractWarDeployer extends AbstractSimpleVFSRealDeployer<JBossWebMetaData>
 {
@@ -337,14 +337,14 @@
 
          URL expWarUrl = unit.getRoot().toURL();
          if (warName.endsWith("/") == false
-         // Hack for jar urls being exposed
-               || warName.endsWith("!/") == true)
+               || warName.endsWith("!/") == true) // Hack for jar urls being exposed
          {
             if (warName.startsWith("jar:"))
             {
                if (warName.endsWith("!/"))
                   warName = warName.substring(4, warName.length() - 2);
-               else warName = warName.substring(4, warName.length());
+               else
+                  warName = warName.substring(4, warName.length());
             }
             URL warURL = new URL(warName);
             ServerConfig config = ServerConfigLocator.locate();
@@ -387,9 +387,16 @@
                   try
                   {
                      String path = vf.getPathName();
-                     path = path.substring(warPathName.length());
-                     URL pathURL = new URL(expWarUrl, path);
-                     classpath.add(pathURL);
+                     if (path.startsWith(warPathName))
+                     {
+                        path = path.substring(warPathName.length());
+                        URL pathURL = new URL(expWarUrl, path);
+                        classpath.add(pathURL);
+                     }
+                     else
+                     {
+                        log.debug("Ignoring path element: " + vf);
+                     }
                   }
                   catch (Exception e)
                   {




More information about the jboss-cvs-commits mailing list