[jboss-svn-commits] JBL Code SVN: r35368 - labs/jbossesb/branches/JBESB_4_9_CP/product/tools/jonplugin/as5/src/main/java/org/jbosson/plugins/jbossesb.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 30 14:36:01 EDT 2010
Author: tcunning
Date: 2010-09-30 14:36:00 -0400 (Thu, 30 Sep 2010)
New Revision: 35368
Modified:
labs/jbossesb/branches/JBESB_4_9_CP/product/tools/jonplugin/as5/src/main/java/org/jbosson/plugins/jbossesb/ESB5DeploymentComponent.java
Log:
JBESB-3492
Make sure we return even if we see a NoSuchDeployment exception.
Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/tools/jonplugin/as5/src/main/java/org/jbosson/plugins/jbossesb/ESB5DeploymentComponent.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/tools/jonplugin/as5/src/main/java/org/jbosson/plugins/jbossesb/ESB5DeploymentComponent.java 2010-09-30 16:08:26 UTC (rev 35367)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/tools/jonplugin/as5/src/main/java/org/jbosson/plugins/jbossesb/ESB5DeploymentComponent.java 2010-09-30 18:36:00 UTC (rev 35368)
@@ -13,6 +13,7 @@
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
import java.io.File;
import java.io.FileInputStream;
@@ -74,32 +75,53 @@
}
if (repositoryName != null) {
- DeploymentProgress stop = deployMgr.stop(repositoryName);
- if (stop != null) {
- stop.run();
- DeploymentStatus stopStatus = stop.getDeploymentStatus();
- if (stopStatus.isFailed()) {
- if ((stopStatus.getFailure() != null) && (stopStatus.getFailure().getCause() != null)
- && (stopStatus.getFailure().getCause() instanceof java.lang.NullPointerException)) {
- // If we get a NPE here, it means that the .esb deployment has already been deleted
- // Return here because otherwise JON will not update and remove the deployment
- log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
-
- return;
- }
-
- log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
- throw new Exception("Failed to stop deployment '" + repositoryName + "' - cause: "
- + stopStatus.getFailure());
- }
- }
+ DeploymentProgress stop = null;
+ try {
+ stop = deployMgr.stop(repositoryName);
+ if (stop != null)
+ stop.run();
+ } catch (Throwable t) {
+ log.error("Could not find deployment to delete. " + t.getMessage());
+ return;
+ } finally {
+ jbossASComponent.disconnectFromProfileService();
+ }
+
+ DeploymentStatus stopStatus = stop.getDeploymentStatus();
+ if (stopStatus.isFailed()) {
+
+ if ((stopStatus.getFailure() != null) && (stopStatus.getFailure().getCause() != null)
+ && (stopStatus.getFailure().getCause() instanceof java.lang.NullPointerException)) {
+ // jon 2.3 case
+ // If we get a NPE here, it means that the .esb deployment has already been deleted
+ // Return here because otherwise JON will not update and remove the deployment
+ log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
+ jbossASComponent.disconnectFromProfileService();
+
+ return;
+ } else if ((stopStatus.getFailure().getCause() != null)
+ && (stopStatus.getFailure().getCause() instanceof org.jboss.profileservice.spi.NoSuchDeploymentException)) {
+ // jon 2.4 case
+ // If we get a NPE here, it means that the .esb deployment has already been deleted
+ // Return here because otherwise JON will not update and remove the deployment
+ log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
+ jbossASComponent.disconnectFromProfileService();
+
+ return;
+ }
+ log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
+ throw new Exception("Failed to stop deployment '" + repositoryName + "' - cause: "
+ + stopStatus.getFailure());
+ }
DeploymentProgress remove = deployMgr.remove(repositoryName);
if (remove != null) {
remove.run();
DeploymentStatus status = remove.getDeploymentStatus();
if (status.isFailed()) {
log.error("Failed to remove deployment '" + repositoryName + "'.", status.getFailure());
- throw new Exception("Failed to remove deployment '" + repositoryName + "' - cause: "
+ throw new Exception("Failed to remove deployment '" + repositoryName + ". "
+ + "If the deployment has already been removed through other means and you want to "
+ + "remove it from JON, uninventory it from the Resources section. Cause: "
+ status.getFailure());
}
} else {
More information about the jboss-svn-commits
mailing list