[jboss-cvs] JBossAS SVN: r78487 - trunk/server/src/main/org/jboss/deployment.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 12 05:55:50 EDT 2008


Author: alesj
Date: 2008-09-12 05:55:50 -0400 (Fri, 12 Sep 2008)
New Revision: 78487

Modified:
   trunk/server/src/main/org/jboss/deployment/EARStructure.java
Log:
[JBAS-5457]; ignore empty library-directory.

Modified: trunk/server/src/main/org/jboss/deployment/EARStructure.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/EARStructure.java	2008-09-12 08:04:55 UTC (rev 78486)
+++ trunk/server/src/main/org/jboss/deployment/EARStructure.java	2008-09-12 09:55:50 UTC (rev 78487)
@@ -181,52 +181,62 @@
          // Create the merged view
          appMetaData.merge(appMetaData, specMetaData);
 
-         // Add the ear lib contents to the classpath
-         String libDir = appMetaData.getLibraryDirectory() == null ? "lib" : appMetaData.getLibraryDirectory();
-         if(trace)
-            log.trace("Checking for ear lib directory: "+libDir);
-         try
+         String libDir = appMetaData.getLibraryDirectory();
+         if (libDir == null || libDir.length() > 0)
          {
-            lib = file.getChild(libDir);
-            if (lib != null)
+            if (libDir == null)
+               libDir = "lib";
+            
+            // Add the ear lib contents to the classpath
+            if(trace)
+               log.trace("Checking for ear lib directory: "+libDir);
+            try
             {
-               if(trace)
-                  log.trace("Found ear lib directory: "+lib);
-               List<VirtualFile> archives = lib.getChildren(earLibFilter);
-               for (VirtualFile archive : archives)
+               lib = file.getChild(libDir);
+               if (lib != null)
                {
-                  addClassPath(structureContext, archive, true, true, context);
-                  try
+                  if(trace)
+                     log.trace("Found ear lib directory: "+lib);
+                  List<VirtualFile> archives = lib.getChildren(earLibFilter);
+                  for (VirtualFile archive : archives)
                   {
-                     // add any jars with persistence.xml as a deployment
-                     if (archive.getChild("META-INF/persistence.xml") != null)
+                     addClassPath(structureContext, archive, true, true, context);
+                     try
                      {
-                        log.trace(archive.getName() + " in ear lib directory has persistence units");
-                        if (structureContext.determineChildStructure(archive) == false)
+                        // add any jars with persistence.xml as a deployment
+                        if (archive.getChild("META-INF/persistence.xml") != null)
                         {
-                           throw new RuntimeException(archive.getName()
-                                 + " in lib directory has persistence.xml but is not a recognized deployment, .ear: "
-                                 + file.getName());
+                           log.trace(archive.getName() + " in ear lib directory has persistence units");
+                           if (structureContext.determineChildStructure(archive) == false)
+                           {
+                              throw new RuntimeException(archive.getName()
+                                    + " in lib directory has persistence.xml but is not a recognized deployment, .ear: "
+                                    + file.getName());
+                           }
                         }
+                        else if (trace)
+                           log.trace(archive.getPathName() + " does not contain META-INF/persistence.xml");
+
                      }
-                     else if (trace)
-                        log.trace(archive.getPathName() + " does not contain META-INF/persistence.xml");
-
+                     catch(IOException e)
+                     {
+                        // TODO - should we throw this fwd?
+                        log.warn("Exception searching for META-INF/persistence.xml in " + archive.getPathName() + ", " + e);
+                     }
                   }
-                  catch(IOException e)
-                  {
-                     // TODO - should we throw this fwd?
-                     log.warn("Exception searching for META-INF/persistence.xml in " + archive.getPathName() + ", " + e);
-                  }
                }
+               else if (trace)
+                  log.trace("No lib directory in ear archive.");
             }
-            else if (trace)
-               log.trace("No lib directory in ear archive.");
+            catch (IOException e)
+            {
+               // TODO - should we throw this fwd?
+               log.warn("Exception while searching for lib dir: " + e);
+            }
          }
-         catch (IOException e)
+         else if (trace)
          {
-            // TODO - should we throw this fwd?
-            log.warn("Exception while searching for lib dir: " + e);
+            log.trace("Ignoring library directory, got empty library-directory element.");
          }
 
          // Add the ear manifest locations?




More information about the jboss-cvs-commits mailing list