[jboss-cvs] JBossAS SVN: r60683 - branches/Branch_4_2/server/src/main/org/jboss/deployment.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 19 18:02:04 EST 2007


Author: scott.stark at jboss.org
Date: 2007-02-19 18:02:04 -0500 (Mon, 19 Feb 2007)
New Revision: 60683

Modified:
   branches/Branch_4_2/server/src/main/org/jboss/deployment/EARDeployer.java
Log:
JBAS-4037, Correct the handling of unpacked and packed ear libs

Modified: branches/Branch_4_2/server/src/main/org/jboss/deployment/EARDeployer.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/deployment/EARDeployer.java	2007-02-19 22:03:08 UTC (rev 60682)
+++ branches/Branch_4_2/server/src/main/org/jboss/deployment/EARDeployer.java	2007-02-19 23:02:04 UTC (rev 60683)
@@ -176,24 +176,6 @@
          // Allow for the default lib unless disabled at the ear deployer level
          if( libraryDirectory == null && isEnablelibDirectoryByDefault() )
             libraryDirectory = "lib";
-         if( libraryDirectory != null && libraryDirectory.length() > 0 )
-         {
-            // This only resolves against the local url
-            URL docURL = di.localUrl;
-            if( docURL == null || docURL.getProtocol().equals("file") == false)
-               log.warn("Skipping ear library-directory since the deployment has no local file url");
-            else
-            {
-               File lib = new File(docURL.getPath());
-               String[] jars = lib.list(new JarFilter());
-               for(int n = 0; jars != null && n < jars.length; n ++)
-               {
-                  String jar = jars[n];
-                  URL libJar = new URL(docURL, jar);
-                  di.addLibraryJar(libJar);
-               }
-            }
-         }
 
          // resolve the watch
          if (di.url.getProtocol().equals("file"))
@@ -224,7 +206,19 @@
          if (di.isDirectory) 
          {
             parentDir = new File(di.localUrl.getFile());
-         } 
+            if( libraryDirectory != null && libraryDirectory.length() > 0 )
+            {
+               File lib = new File(parentDir, libraryDirectory);
+               URL libURL = lib.toURL();
+               String[] jars = lib.list(new JarFilter());
+               for(int n = 0; jars != null && n < jars.length; n ++)
+               {
+                  String jar = jars[n];
+                  URL libJar = new URL(libURL, jar);
+                  di.addLibraryJar(libJar);
+               }
+            }
+         }
          else
          {
             /* Extract each entry so that deployment modules can be processed
@@ -233,6 +227,7 @@
             */
             String urlPrefix = "jar:" + di.localUrl + "!/";
             JarFile jarFile = new JarFile(di.localUrl.getFile());
+
             // For each entry, test if deployable, if so
             // extract it and store the related URL in map
             for (Enumeration e = jarFile.entries(); e.hasMoreElements();)
@@ -252,8 +247,14 @@
                   }
                   else if( entry.isDirectory() == false )
                   {
-                     JarUtils.extractNestedJar(url, this.tempDeployDir);
+                     URL nestedURL = JarUtils.extractNestedJar(url, this.tempDeployDir);
                      log.debug("Extracted non-deployable content: "+name);
+                     // Extract the library-directory
+                     if( libraryDirectory != null && libraryDirectory.length() > 0 
+                           && name.startsWith(libraryDirectory) )
+                     {
+                        di.addLibraryJar(nestedURL);
+                     }
                   }
                }
                catch (MalformedURLException mue)




More information about the jboss-cvs-commits mailing list