[jboss-cvs] JBossAS SVN: r81301 - projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Nov 19 11:56:20 EST 2008
Author: alesj
Date: 2008-11-19 11:56:20 -0500 (Wed, 19 Nov 2008)
New Revision: 81301
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java
Log:
Minimize try/catch block.
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java 2008-11-19 16:43:01 UTC (rev 81300)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/webbeans/support/WebBeanDiscoveryDeployer.java 2008-11-19 16:56:20 UTC (rev 81301)
@@ -59,13 +59,13 @@
topUnit.addAttachment(WebBeanDiscovery.class.getName(), wbdi);
}
+ List<URL> urls = new ArrayList<URL>();
+
try
{
if (deployment != null) // do some more stuff ...
wbdi.addWebBeansXmlURL(deployment.getURL());
- List<URL> urls = new ArrayList<URL>();
-
Iterable<VirtualFile> classpaths = getClassPaths(unit);
for (VirtualFile cp : classpaths)
{
@@ -87,30 +87,30 @@
if (classes != null)
urls.add(classes.toURL());
}
+ }
+ catch (Exception e)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Cannot deploy WBD.", e);
+ }
- if (urls.isEmpty() == false)
+ if (urls.isEmpty() == false)
+ {
+ Module module = unit.getAttachment(Module.class);
+ if (module == null)
{
- Module module = unit.getAttachment(Module.class);
- if (module == null)
+ VFSDeploymentUnit parent = unit.getParent();
+ while (parent != null && module == null)
{
- VFSDeploymentUnit parent = unit.getParent();
- while(parent != null && module == null)
- {
- module = parent.getAttachment(Module.class);
- parent = parent.getParent();
- }
- if (module == null)
- throw new DeploymentException("No module in deployment unit's hierarchy: " + unit.getName());
+ module = parent.getAttachment(Module.class);
+ parent = parent.getParent();
}
+ if (module == null)
+ throw new DeploymentException("No module in deployment unit's hierarchy: " + unit.getName());
+ }
- WBDiscoveryVisitor visitor = new WBDiscoveryVisitor(wbdi, unit.getClassLoader());
- module.visit(visitor, ClassFilter.INSTANCE, null, urls.toArray(new URL[urls.size()]));
- }
+ WBDiscoveryVisitor visitor = new WBDiscoveryVisitor(wbdi, unit.getClassLoader());
+ module.visit(visitor, ClassFilter.INSTANCE, null, urls.toArray(new URL[urls.size()]));
}
- catch (Exception e)
- {
- throw DeploymentException.rethrowAsDeploymentException("Cannot deploy WBD.", e);
- }
}
/**
@@ -127,10 +127,10 @@
{
List<VirtualFile> matching = new ArrayList<VirtualFile>();
VirtualFile root = unit.getRoot();
- for (VirtualFile cp : classpath)
+ for (VirtualFile cp : classpath)
{
VirtualFile check = cp;
- while(check != null && check.equals(root) == false)
+ while (check != null && check.equals(root) == false)
check = check.getParent();
if (check != null)
More information about the jboss-cvs-commits
mailing list