geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r931770 - /geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
Date Thu, 08 Apr 2010 03:53:52 GMT
Author: xuhaihong
Date: Thu Apr  8 03:53:52 2010
New Revision: 931770

URL: http://svn.apache.org/viewvc?rev=931770&view=rev
Log:
GERONIMO-5037 Make sure annotations in the web-inf/classes folder could be scanned

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java?rev=931770&r1=931769&r2=931770&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
Thu Apr  8 03:53:52 2010
@@ -183,12 +183,13 @@ public class MergeHelper {
 
     @SuppressWarnings("unchecked")
     public static void mergeAnnotations(Bundle bundle, WebAppType webApp, MergeContext mergeContext,
final String prefix) throws DeploymentException {
+        final boolean isJarFile = prefix.endsWith(".jar");
         try {
             BundleAnnotationFinder bundleAnnotationFinder = new BundleAnnotationFinder(null,
bundle, new DiscoveryFilter() {
 
                 @Override
                 public boolean directoryDiscoveryRequired(String url) {
-                    return false;
+                    return !isJarFile;
                 }
 
                 @Override
@@ -198,7 +199,7 @@ public class MergeHelper {
 
                 @Override
                 public boolean zipFileDiscoveryRequired(String url) {
-                    return url.equals(prefix);
+                    return isJarFile ? url.equals(prefix) : false;
                 }
             });
             List<Class> webServlets = bundleAnnotationFinder.findAnnotatedClasses(WebServlet.class);
@@ -236,8 +237,8 @@ public class MergeHelper {
             return true;
         }
         if (mergeItem.isFromWebFragment() && !mergeItem.getValue().equals(value))
{
-            throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateKeyValueMessage(parentElementName,
KeyElementName, keyName, valueElementName, (String) mergeItem.getValue(), mergeItem
-                    .getBelongedURL(), value, mergeContext.getCurrentJarUrl()));
+            throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateKeyValueMessage(parentElementName,
KeyElementName, keyName, valueElementName, (String) mergeItem.getValue(),
+                    mergeItem.getBelongedURL(), value, mergeContext.getCurrentJarUrl()));
         }
         return false;
     }
@@ -326,7 +327,7 @@ public class MergeHelper {
         WEB_FILTER_ANNOTATION_MERGE_HANDLER.postProcessWebXmlElement(webApp, mergeContext);
         WEB_LISTENER_ANNOTATION_MERGE_HANDLER.postProcessWebXmlElement(webApp, mergeContext);
         //Merge the annotations found in WEB-INF/classes folder
-        mergeAnnotations(bundle, webApp, mergeContext, "./WEB-INF/classes");
+        mergeAnnotations(bundle, webApp, mergeContext, "/WEB-INF/classes");
         mergeContext.clearup();
     }
 



Mime
View raw message