Author: alessio.soldano(a)jboss.com
Date: 2012-01-18 05:57:41 -0500 (Wed, 18 Jan 2012)
New Revision: 15490
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/Message.properties
Log:
[JBWS-3414] DeploymentAspectManagerImpl does not properly deal with deployment failures
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java 2012-01-17
13:49:33 UTC (rev 15489)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java 2012-01-18
10:57:41 UTC (rev 15490)
@@ -28,6 +28,7 @@
import java.util.Set;
import org.jboss.logging.Logger;
+import org.jboss.ws.api.util.BundleUtils;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentState;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
@@ -99,9 +100,10 @@
{
// create the deployment
Set<String> providedConditions = new HashSet<String>();
- for (int i = 0; i < getDeploymentAspects().size(); i++)
+ final List<DeploymentAspect> deploymentAspects = getDeploymentAspects();
+ for (int i = 0; i < deploymentAspects.size(); i++)
{
- DeploymentAspect aspect = getDeploymentAspects().get(i);
+ DeploymentAspect aspect = deploymentAspects.get(i);
// Check that all required aspects are met
/*
@@ -118,9 +120,9 @@
}
// start the deployment
- for (int i = 0; i < getDeploymentAspects().size(); i++)
+ for (int i = 0; i < deploymentAspects.size(); i++)
{
- DeploymentAspect aspect = getDeploymentAspects().get(i);
+ DeploymentAspect aspect = deploymentAspects.get(i);
try
{
if (aspect.canHandle(dep)) {
@@ -139,10 +141,19 @@
}
catch (RuntimeException rte)
{
- while (i-- >= 0)
+ while (--i >= 0)
{
// destroy the deployment
- failsafeStop(aspect, dep);
+ try
+ {
+ failsafeStop(deploymentAspects.get(i), dep);
+ }
+ catch (RuntimeException destroyRte)
+ {
+ //log previous exception in the exotic case in which also stopping
already started aspects fails
+
log.error(BundleUtils.getMessage(BundleUtils.getBundle(DeploymentAspectManagerImpl.class),"ERROR_DESTROYING_DEPLOYMENT"),
rte);
+ throw destroyRte;
+ }
}
throw rte;
}
@@ -153,9 +164,10 @@
public void undeploy(Deployment dep)
{
- for (int i = getDeploymentAspects().size(); 0 < i; i--)
+ final List<DeploymentAspect> deploymentAspects = getDeploymentAspects();
+ for (int i = deploymentAspects.size(); 0 < i; i--)
{
- DeploymentAspect aspect = getDeploymentAspects().get(i - 1);
+ DeploymentAspect aspect = deploymentAspects.get(i - 1);
failsafeStop(aspect, dep);
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/Message.properties
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/Message.properties 2012-01-17
13:49:33 UTC (rev 15489)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/Message.properties 2012-01-18
10:57:41 UTC (rev 15490)
@@ -21,3 +21,4 @@
CANNOT_FIND_URL_PATTERN=Cannot find <url-pattern> for servlet-name: {0}
USING_INITAL_CLASS_LAODER_AS_RUNTIME_LAODER=Using inital class laoder as runtime laoder.
Hack?
ERROR_CLOSING_JAXB_INTRODUCTIONS=[{0}] Error closing JAXB Introductions Configurations
stream
+ERROR_DESTROYING_DEPLOYMENT=Error while destroying deployment due to previous exception
Show replies by date