You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2011/10/20 13:34:09 UTC
svn commit: r1186746 -
/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
Author: ffang
Date: Thu Oct 20 11:34:09 2011
New Revision: 1186746
URL: http://svn.apache.org/viewvc?rev=1186746&view=rev
Log:
[SM-2129]fix NPE of DeploymentService
Modified:
servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java?rev=1186746&r1=1186745&r2=1186746&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java Thu Oct 20 11:34:09 2011
@@ -92,7 +92,7 @@ public class DeploymentService extends B
return DeploymentServiceMBean.class;
}
- public void start() throws javax.jbi.JBIException {
+ public void start() throws JBIException {
super.start();
String[] sas = registry.getDeployedServiceAssemblies();
// This loop will initialize all SAs
@@ -264,7 +264,7 @@ public class DeploymentService extends B
return result;
} catch (Exception e) {
- LOGGER.info("Unable to undeploy assembly", e);
+ LOGGER.error("Unable to undeploy assembly", e);
throw e;
}
}
@@ -387,10 +387,19 @@ public class DeploymentService extends B
*/
public String start(String serviceAssemblyName) throws Exception {
try {
- ServiceAssemblyLifeCycle sa = registry.getServiceAssembly(serviceAssemblyName);
+ if (serviceAssemblyName == null) {
+ throw ManagementSupport.failure("start",
+ "SA name must not be null");
+ }
+ ServiceAssemblyLifeCycle sa = registry.getServiceAssembly(
+ serviceAssemblyName);
+ if (sa == null) {
+ throw ManagementSupport.failure("start", "SA has not been deployed: "
+ + serviceAssemblyName);
+ }
return sa.start(true);
} catch (Exception e) {
- LOGGER.info("Error in start", e);
+ LOGGER.error("Error in start", e);
throw e;
}
}
@@ -406,10 +415,19 @@ public class DeploymentService extends B
*/
public String stop(String serviceAssemblyName) throws Exception {
try {
+ if (serviceAssemblyName == null) {
+ throw ManagementSupport.failure("stop",
+ "SA name must not be null");
+ }
ServiceAssemblyLifeCycle sa = registry.getServiceAssembly(serviceAssemblyName);
+ if (sa == null) {
+ throw ManagementSupport.failure("stop", "SA has not been deployed: "
+ + serviceAssemblyName);
+ }
+
return sa.stop(true, false);
} catch (Exception e) {
- LOGGER.info("Error in stop", e);
+ LOGGER.error("Error in stop", e);
throw e;
}
}
@@ -423,10 +441,18 @@ public class DeploymentService extends B
*/
public String shutDown(String serviceAssemblyName) throws Exception {
try {
+ if (serviceAssemblyName == null) {
+ throw ManagementSupport.failure("shutdown",
+ "SA name must not be null");
+ }
ServiceAssemblyLifeCycle sa = registry.getServiceAssembly(serviceAssemblyName);
+ if (sa == null) {
+ throw ManagementSupport.failure("shutdown", "SA has not been deployed: "
+ + serviceAssemblyName);
+ }
return sa.shutDown(true);
} catch (Exception e) {
- LOGGER.info("Error in shutDown", e);
+ LOGGER.error("Error in shutDown", e);
throw e;
}
}