You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by db...@apache.org on 2011/05/05 08:30:49 UTC

svn commit: r1099700 - /geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java

Author: dblevins
Date: Thu May  5 06:30:49 2011
New Revision: 1099700

URL: http://svn.apache.org/viewvc?rev=1099700&view=rev
Log:
use a backup strategy for finding xml files in the event that xbean-finder getResourceMap is unable to find the descriptors.  This will happen if the jar archive was created without any directory entries.  Rare, but is valid.  In such archives 'WEB-INF/beans.xml' will exist but 'WEB-INF/' will not.

Modified:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?rev=1099700&r1=1099699&r2=1099700&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java Thu May  5 06:30:49 2011
@@ -326,6 +326,26 @@ public class EjbModuleBuilder implements
 
             descriptors = finder.getResourcesMap(ddDir);
 
+            // The ResourceFinder.getResourcesMap() method does not work if the jar in question
+            // does not properly have "directories" and only has file entries.  So we as a backup
+            // measure will explicitly look for specific known descriptor files and add them if
+            // the getResourcesMap() method was unable to find them.  In this "bad jar" scenario
+            // some extra features such as the openejb.altdd.prefix functionality will not work.
+            
+            String[] doubleCheck = {"ejb-jar.xml", "geronimo-openejb.xml", "openejb-jar.xml", "beans.xml", "env-entries.properties", "web.xml"};
+
+            for (String entry : doubleCheck) {
+                try {
+                    final URL url = finder.find(ddDir + entry);
+                    if (url == null) continue;
+                    if (descriptors.containsKey(entry)) continue;
+                    descriptors.put(entry, url);
+                } catch (IOException descriptorNotFound) {
+                    // ignore
+                }
+            }
+
+
             if (!isEjbModule(baseUrl, classLoader, descriptors)) {
                 releaseTempClassLoader(classLoader);
                 return null;