[jboss-cvs] JBossAS SVN: r69089 - in projects/microcontainer/trunk: deployers-impl/src/main/org/jboss/deployers/plugins/classloading and 10 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 17 16:12:30 EST 2008
Author: alesj
Date: 2008-01-17 16:12:29 -0500 (Thu, 17 Jan 2008)
New Revision: 69089
Added:
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDescribeDeployer.java
Removed:
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDesribeDeployer.java
Modified:
projects/microcontainer/trunk/build/pom.xml
projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoDeployerSorter.java
projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/classloading/test/MockClassLoaderDependenciesUnitTestCase.java
projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSClassLoaderPolicy.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/DeclaredStructure.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java
projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/classloader/test/ExportAllUnitTestCase.java
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
Log:
VFS Beta7 usage.
Changing to getChild and handling null return values.
Modified: projects/microcontainer/trunk/build/pom.xml
===================================================================
--- projects/microcontainer/trunk/build/pom.xml 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/build/pom.xml 2008-01-17 21:12:29 UTC (rev 69089)
@@ -35,7 +35,7 @@
<version.jboss.common.core>2.2.3.GA</version.jboss.common.core>
<version.jbossxb>2.0.0.CR5</version.jbossxb>
<version.osgi.r4.core>1.0</version.osgi.r4.core>
- <version.jboss.vfs>2.0.0.Beta6</version.jboss.vfs>
+ <version.jboss.vfs>2.0.0.Beta7</version.jboss.vfs>
<version.javassist>3.6.0.GA</version.javassist>
<version.jaxb.api>2.0</version.jaxb.api>
<version.jboss.aop>2.0.0.CR1</version.jboss.aop>
Added: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDescribeDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDescribeDeployer.java (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDescribeDeployer.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -0,0 +1,90 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployers.plugins.classloading;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractOptionalRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.classloading.ClassLoaderMetaData;
+
+/**
+ * AbstractClassLoaderDescribeDeployer.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractClassLoaderDescribeDeployer extends AbstractOptionalRealDeployer<ClassLoaderMetaData>
+{
+ /** The classloading */
+ private ClassLoading classLoading;
+
+ /**
+ * Create a new AbstractClassLoaderDescribeDeployer.
+ */
+ public AbstractClassLoaderDescribeDeployer()
+ {
+ super(ClassLoaderMetaData.class);
+ setStage(DeploymentStages.DESCRIBE);
+ }
+
+ /**
+ * Get the classLoading.
+ *
+ * @return the classLoading.
+ */
+ public ClassLoading getClassLoading()
+ {
+ return classLoading;
+ }
+
+ /**
+ * Set the classLoading.
+ *
+ * @param classLoading the classLoading.
+ */
+ public void setClassLoading(ClassLoading classLoading)
+ {
+ this.classLoading = classLoading;
+ }
+
+ /**
+ * Check the configuration
+ *
+ * @throws Exception for any error
+ */
+ public void create() throws Exception
+ {
+ if (classLoading == null)
+ throw new DeploymentException("Classloading has not been configured");
+ }
+
+ public void deploy(DeploymentUnit unit, ClassLoaderMetaData deployment) throws DeploymentException
+ {
+ classLoading.addDeploymentUnit(unit);
+ }
+
+ public void undeploy(DeploymentUnit unit, ClassLoaderMetaData deployment)
+ {
+ classLoading.removeDeploymentUnit(unit);
+ }
+}
Deleted: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDesribeDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDesribeDeployer.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/classloading/AbstractClassLoaderDesribeDeployer.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -1,91 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.deployers.plugins.classloading;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractOptionalRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.classloading.ClassLoaderMetaData;
-
-/**
- * AbstractClassLoaderDesribeDeployer.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class AbstractClassLoaderDesribeDeployer extends AbstractOptionalRealDeployer<ClassLoaderMetaData>
-{
- /** The classloading */
- private ClassLoading classLoading;
-
- /**
- * Create a new AbstractClassLoaderDesribeDeployer.
- */
- public AbstractClassLoaderDesribeDeployer()
- {
- super(ClassLoaderMetaData.class);
- setStage(DeploymentStages.DESCRIBE);
- }
-
- /**
- * Get the classLoading.
- *
- * @return the classLoading.
- */
- public ClassLoading getClassLoading()
- {
- return classLoading;
- }
-
- /**
- * Set the classLoading.
- *
- * @param classLoading the classLoading.
- */
- public void setClassLoading(ClassLoading classLoading)
- {
- this.classLoading = classLoading;
- }
-
- /**
- * Check the configuration
- *
- * @throws Exception for any error
- */
- public void create() throws Exception
- {
- if (classLoading == null)
- throw new DeploymentException("Classloading has not been configured");
- }
-
- public void deploy(DeploymentUnit unit, ClassLoaderMetaData deployment) throws DeploymentException
- {
- classLoading.addDeploymentUnit(unit);
- }
-
- public void undeploy(DeploymentUnit unit, ClassLoaderMetaData deployment)
- {
- classLoading.removeDeploymentUnit(unit);
- }
-
-}
Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoDeployerSorter.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoDeployerSorter.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/sort/DominoDeployerSorter.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -21,13 +21,14 @@
*/
package org.jboss.deployers.plugins.sort;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
import org.jboss.deployers.spi.deployer.Deployer;
/**
* Deployer sorter using domino sorting.
+ *
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
public class DominoDeployerSorter implements DeployerSorter
Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/classloading/test/MockClassLoaderDependenciesUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/classloading/test/MockClassLoaderDependenciesUnitTestCase.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/classloading/test/MockClassLoaderDependenciesUnitTestCase.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -27,13 +27,12 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-
import org.jboss.classloader.plugins.system.DefaultClassLoaderSystem;
import org.jboss.classloader.spi.ClassLoaderSystem;
import org.jboss.classloader.spi.ParentPolicy;
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.plugins.classloading.AbstractClassLoaderDesribeDeployer;
+import org.jboss.deployers.plugins.classloading.AbstractClassLoaderDescribeDeployer;
import org.jboss.deployers.plugins.classloading.ClassLoading;
import org.jboss.deployers.spi.attachments.MutableAttachments;
import org.jboss.deployers.spi.attachments.PredeterminedManagedObjectAttachments;
@@ -79,7 +78,7 @@
return result;
}
- private AbstractClassLoaderDesribeDeployer deployer1;
+ private AbstractClassLoaderDescribeDeployer deployer1;
private MockTopLevelClassLoaderSystemDeployer deployer2;
public static Test suite()
@@ -384,7 +383,7 @@
ClassLoaderSystem system = new DefaultClassLoaderSystem();
system.getDefaultDomain().setParentPolicy(ParentPolicy.BEFORE_BUT_JAVA_ONLY);
- deployer1 = new AbstractClassLoaderDesribeDeployer();
+ deployer1 = new AbstractClassLoaderDescribeDeployer();
deployer1.setClassLoading(classLoading);
deployer2 = new MockTopLevelClassLoaderSystemDeployer();
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSClassLoaderPolicy.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSClassLoaderPolicy.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/classloader/VFSClassLoaderPolicy.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -240,7 +240,8 @@
}
catch (Exception ignored)
{
- log.trace("Error determining URL for " + child, ignored);
+ if (log.isTraceEnabled())
+ log.trace("Error determining URL for " + child, ignored);
return null;
}
}
@@ -259,7 +260,8 @@
}
catch (Exception ignored)
{
- log.trace("Error opening stream for " + child, ignored);
+ if (log.isTraceEnabled())
+ log.trace("Error opening stream for " + child, ignored);
return null;
}
}
@@ -273,12 +275,14 @@
{
try
{
- VirtualFile child = root.findChild(name);
- urls.add(child.toURL());
+ VirtualFile child = root.getChild(name);
+ if (child != null)
+ urls.add(child.toURL());
}
- catch (Exception ignored)
+ catch (Exception e)
{
- log.trace("Error getting resources for " + root, ignored);
+ if (log.isTraceEnabled())
+ log.trace("Error getting resources for " + root, e);
}
}
}
@@ -295,7 +299,9 @@
{
try
{
- return root.findChild(path);
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ return child;
}
catch (Exception ignored)
{
@@ -317,7 +323,7 @@
{
try
{
- if (root.findChild(path) != null)
+ if (root.getChild(path) != null)
return root;
}
catch (Exception ignored)
@@ -355,7 +361,8 @@
}
catch (Exception ignored)
{
- log.trace("Unable to retrieve manifest for " + path + " url=" + rootURL + " error=" + ignored.getMessage());
+ if (log.isTraceEnabled())
+ log.trace("Unable to retrieve manifest for " + path + " url=" + rootURL + " error=" + ignored.getMessage());
}
}
return new PackageInformation(packageName, manifest);
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -24,9 +24,9 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.ArrayList;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
@@ -122,13 +122,17 @@
if (path == null)
throw new IllegalArgumentException("Null path in paths: " + paths);
- locations.add(root.findChild(path));
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ locations.add(child);
+ else
+ log.debug("Meta data path does not exist: root=" + root.getPathName() + " path=" + path);
}
setMetaDataLocations(locations);
}
catch (IOException e)
{
- log.debug("Meta data path does not exist: root=" + root.getPathName() + " paths=" + paths);
+ log.warn("Exception while applying paths: root=" + root.getPathName() + " paths=" + paths);
}
}
@@ -190,7 +194,7 @@
{
try
{
- result = location.findChild(name);
+ result = location.getChild(name);
if (result != null)
{
if (log.isTraceEnabled())
@@ -199,10 +203,9 @@
break;
}
}
- catch (IOException ignored)
+ catch (IOException e)
{
- if (log.isTraceEnabled())
- log.trace("Ignoring search exception invocation for metafile " + name + " in " + location.getName() + ", reason: " + ignored);
+ log.warn("Search exception invocation for metafile " + name + " in " + location.getName() + ", reason: " + e);
}
}
return result;
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSDeploymentResourceLoaderImpl.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -59,7 +59,7 @@
{
try
{
- return root.findChild(path);
+ return root.getChild(path);
}
catch (IOException e)
{
@@ -71,8 +71,8 @@
{
try
{
- VirtualFile child = root.findChild(name);
- return child.toURL();
+ VirtualFile child = root.getChild(name);
+ return child != null ? child.toURL() : null;
}
catch (URISyntaxException e)
{
@@ -92,10 +92,15 @@
{
try
{
- VirtualFile child = root.findChild(name);
- Vector<URL> vector = new Vector<URL>();
- vector.add(child.toURL());
- return vector.elements();
+ VirtualFile child = root.getChild(name);
+ if (child != null)
+ {
+ Vector<URL> vector = new Vector<URL>();
+ vector.add(child.toURL());
+ return vector.elements();
+ }
+ else
+ return null;
}
catch (URISyntaxException e)
{
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -69,7 +69,7 @@
try
{
VirtualFile parentFile = vfsParent.getRoot();
- VirtualFile file = parentFile.findChild(path);
+ VirtualFile file = parentFile.findChild(path); // leaving the findChild usage
return new AbstractVFSDeploymentContext(file, path);
}
catch (Throwable t)
@@ -115,7 +115,7 @@
{
try
{
- child = root.findChild(entry.getPath());
+ child = root.findChild(entry.getPath()); // leaving the findChild
}
catch (Throwable t)
{
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/DeclaredStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/DeclaredStructure.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/DeclaredStructure.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -24,8 +24,8 @@
import java.io.IOException;
import java.net.URL;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.structure.StructureMetaData;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
import org.jboss.virtual.VirtualFile;
@@ -61,19 +61,21 @@
log.trace(file + " is not a leaf");
try
{
- VirtualFile jbossStructure = file.findChild("META-INF/jboss-structure.xml");
- log.trace("... context has a META-INF/jboss-structure.xml");
- URL url = jbossStructure.toURL();
- UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
- Unmarshaller unmarshaller = factory.newUnmarshaller();
- StructureMetaDataObjectFactory ofactory = new StructureMetaDataObjectFactory();
- unmarshaller.unmarshal(url.toString(), ofactory, metaData);
- isJBossStructure = true;
+ VirtualFile jbossStructure = file.getChild("META-INF/jboss-structure.xml");
+ if (jbossStructure != null)
+ {
+ log.trace("... context has a META-INF/jboss-structure.xml");
+ URL url = jbossStructure.toURL();
+ UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
+ Unmarshaller unmarshaller = factory.newUnmarshaller();
+ StructureMetaDataObjectFactory ofactory = new StructureMetaDataObjectFactory();
+ unmarshaller.unmarshal(url.toString(), ofactory, metaData);
+ isJBossStructure = true;
+ }
}
catch (IOException e)
{
- if (trace)
- log.trace("... no META-INF/jboss-structure.xml.");
+ log.warn("Exception while looking for META-INF/jboss-structure.xml: " + e);
}
if (trace)
log.trace(file + " isJBossStructure: " + isJBossStructure);
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/jar/JARStructure.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -24,9 +24,9 @@
import java.io.IOException;
import java.util.Set;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.structure.ContextInfo;
import org.jboss.deployers.spi.structure.StructureMetaData;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
import org.jboss.virtual.VirtualFile;
@@ -84,6 +84,8 @@
ContextInfo context = null;
try
{
+ boolean trace = log.isTraceEnabled();
+
if (isLeaf(file) == false)
{
// For non top level directories that don't look like jars
@@ -94,16 +96,26 @@
{
try
{
- file.findChild("META-INF");
- log.trace("... ok - non top level directory has a META-INF subdirectory");
+ VirtualFile child = file.getChild("META-INF");
+ if (child != null)
+ {
+ if (trace)
+ log.trace("... ok - non top level directory has a META-INF subdirectory");
+ }
+ else
+ {
+ if (trace)
+ log.trace("... no - doesn't look like a jar and no META-INF subdirectory.");
+ return false;
+ }
}
catch (IOException e)
{
- log.trace("... no - doesn't look like a jar and no META-INF subdirectory.");
+ log.warn("Exception while checking if file is a jar: " + e);
return false;
}
}
- else
+ else if (trace)
{
log.trace("... ok - doesn't look like a jar but it is a top level directory.");
}
@@ -111,11 +123,13 @@
}
else if (JarUtils.isArchive(file.getName()))
{
- log.trace("... ok - its an archive or at least pretending to be.");
+ if (trace)
+ log.trace("... ok - its an archive or at least pretending to be.");
}
else
{
- log.trace("... no - not a directory or an archive.");
+ if (trace)
+ log.trace("... no - not a directory or an archive.");
return false;
}
Modified: projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -24,9 +24,9 @@
import java.io.IOException;
import java.util.List;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.structure.ContextInfo;
import org.jboss.deployers.spi.structure.StructureMetaData;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
import org.jboss.virtual.VirtualFile;
@@ -85,6 +85,8 @@
ContextInfo context = null;
try
{
+ boolean trace = log.isTraceEnabled();
+
if (isLeaf(file) == false)
{
// We require either a WEB-INF or the name ends in .war
@@ -92,16 +94,26 @@
{
try
{
- file.findChild("WEB-INF");
- log.trace("... ok - directory has a WEB-INF subdirectory");
+ VirtualFile child = file.getChild("WEB-INF");
+ if (child != null)
+ {
+ if (trace)
+ log.trace("... ok - directory has a WEB-INF subdirectory");
+ }
+ else
+ {
+ if (trace)
+ log.trace("... no - doesn't look like a war and no WEB-INF subdirectory.");
+ return false;
+ }
}
catch (IOException e)
{
- log.trace("... no - doesn't look like a war and no WEB-INF subdirectory.");
+ log.warn("Exception while checking if file is a war: " + e);
return false;
}
}
- else
+ else if (trace)
{
log.trace("... ok - name ends in .war.");
}
@@ -114,25 +126,33 @@
try
{
// The classpath is WEB-INF/classes
- VirtualFile classes = file.findChild("WEB-INF/classes");
+ VirtualFile classes = file.getChild("WEB-INF/classes");
// Add the war manifest classpath entries
- addClassPath(root, classes, true, false, context);
+ if (classes != null)
+ addClassPath(root, classes, true, false, context);
+ else if (trace)
+ log.trace("No WEB-INF/classes for: " + file.getPathName());
}
catch(IOException e)
{
- log.trace("No WEB-INF/classes for: " + file.getPathName());
+ log.warn("Exception while looking for classes, " + file.getPathName() + ", " + e);
}
// and the top level jars in WEB-INF/lib
try
{
- VirtualFile webinfLib = file.findChild("WEB-INF/lib");
- List<VirtualFile> archives = webinfLib.getChildren(webInfLibFilter);
- for (VirtualFile jar : archives)
- addClassPath(root, jar, true, true, context);
+ VirtualFile webinfLib = file.getChild("WEB-INF/lib");
+ if (webinfLib != null)
+ {
+ List<VirtualFile> archives = webinfLib.getChildren(webInfLibFilter);
+ for (VirtualFile jar : archives)
+ addClassPath(root, jar, true, true, context);
+ }
+ else if (trace)
+ log.trace("No WEB-INF/lib for: " + file.getPathName());
}
- catch (IOException ignored)
+ catch (IOException e)
{
- log.trace("No WEB-INF/lib for: " + file.getPathName());
+ log.warn("Exception looking for WEB-INF/lib, " + file.getPathName() + ", " + e);
}
// There are no subdeployments for wars
@@ -140,7 +160,8 @@
}
else
{
- log.trace("... no - not a directory or an archive.");
+ if (trace)
+ log.trace("... no - not a directory or an archive.");
return false;
}
}
Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/classloader/test/ExportAllUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/classloader/test/ExportAllUnitTestCase.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/classloader/test/ExportAllUnitTestCase.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -95,7 +95,7 @@
VirtualFile base = VFS.getRoot(baseURL);
VirtualFile[] files = new VirtualFile[urls.length];
for (int i = 0; i < urls.length; ++i)
- files[i]= base.findChild(urls[i]);
+ files[i] = base.findChild(urls[i]);
testExportAllCommon(exportAll, expected, empty, files);
}
Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -186,7 +186,7 @@
return null;
}
- public VirtualFileHandler findChild(String path) throws IOException
+ public VirtualFileHandler getChild(String path) throws IOException
{
return null;
}
Modified: projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java 2008-01-17 21:01:41 UTC (rev 69088)
+++ projects/microcontainer/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java 2008-01-17 21:12:29 UTC (rev 69089)
@@ -252,12 +252,13 @@
{
try
{
- root.findChild(metaDataPath);
+ VirtualFile child = root.getChild(metaDataPath);
+ if (child == null)
+ metaDataPath = null;
}
- catch (IOException ignored)
+ catch (IOException e)
{
- if (trace)
- log.trace("Not using metadata path " + metaDataPath + " for " + root.getName() + " reason: " + ignored.getMessage());
+ log.warn("Not using metadata path " + metaDataPath + " for " + root.getName() + " reason: " + e.getMessage());
metaDataPath = null;
}
}
More information about the jboss-cvs-commits
mailing list