[jboss-cvs] JBossAS SVN: r68435 - trunk/system-jmx/src/main/org/jboss/deployment.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 19 17:03:36 EST 2007


Author: alesj
Date: 2007-12-19 17:03:36 -0500 (Wed, 19 Dec 2007)
New Revision: 68435

Modified:
   trunk/system-jmx/src/main/org/jboss/deployment/MainDeployer.java
Log:
Applying legacy usage with getDeployment(Context|Unit) on returning null if not found instead of exception.
Hacking isDeployed with VFS awareness.

Modified: trunk/system-jmx/src/main/org/jboss/deployment/MainDeployer.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/deployment/MainDeployer.java	2007-12-19 20:32:36 UTC (rev 68434)
+++ trunk/system-jmx/src/main/org/jboss/deployment/MainDeployer.java	2007-12-19 22:03:36 UTC (rev 68435)
@@ -1327,10 +1327,32 @@
    {
       String name = contextMap.get(url);
       if (name == null)
-         throw new IllegalArgumentException("No such context: " + url);
+      {
+         if (log.isTraceEnabled())
+            log.trace("No such context: " + url);
+         if (url == null)
+            throw new IllegalArgumentException("Null url");
+         String urlString = url.toString();
+         // remove this once the JBoss-test is updated with VFS usage
+         if (urlString.startsWith("vfs") == false)
+            return checkDeployed("vfs" + urlString);
+         else
+            return checkDeployed(urlString);
+      }
 
+      return checkDeployed(name);
+   }
+
+   /**
+    * Is deployed.
+    *
+    * @param name the name of the deployment
+    * @return true if deployed, false otherwise 
+    */
+   protected boolean checkDeployed(String name)
+   {
       org.jboss.deployers.spi.DeploymentState deploymentState = delegate.getDeploymentState(name);
-      log.debug("isDeployed, url="+url+", state="+deploymentState);
+      log.debug("isDeployed, url="+name+", state="+deploymentState);
       return deploymentState == org.jboss.deployers.spi.DeploymentState.DEPLOYED;
    }
 
@@ -1346,7 +1368,7 @@
    {
       String name = contextMap.get(url);
       if (name == null)
-         throw new IllegalArgumentException("No such context: " + url);
+         return null;
 
       Deployment dc = delegate.getDeployment(name);
       log.debug("getDeployment, url="+url+", dc="+dc);
@@ -1366,7 +1388,7 @@
    {
       String name = contextMap.get(url);
       if (name == null)
-         throw new IllegalArgumentException("No such context: " + url);
+         return null;
 
       MainDeployerStructure structure = (MainDeployerStructure) delegate;
       DeploymentContext dc = structure.getDeploymentContext(name);
@@ -1386,7 +1408,7 @@
    {
       String name = contextMap.get(url);
       if (name == null)
-         throw new IllegalArgumentException("No such context: " + url);
+         return null;
 
       MainDeployerStructure structure = (MainDeployerStructure) delegate;
       DeploymentUnit du = structure.getDeploymentUnit(name);




More information about the jboss-cvs-commits mailing list