struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpontare...@apache.org
Subject svn commit: r635378 - in /struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention: AbstractClassLoaderResolver.java PackageBasedActionConfigBuilder.java
Date Sun, 09 Mar 2008 22:15:14 GMT
Author: bpontarelli
Date: Sun Mar  9 15:15:07 2008
New Revision: 635378

URL: http://svn.apache.org/viewvc?rev=635378&view=rev
Log:
Fixed bug reported by user and added check for non-usable actions (interfaces, enums, annotations,
abstract)

Modified:
    struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java
    struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java

Modified: struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java?rev=635378&r1=635377&r2=635378&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java
(original)
+++ struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java
Sun Mar  9 15:15:07 2008
@@ -251,12 +251,12 @@
      *
      * @param   test An instance of {@link AbstractClassLoaderResolver.Test} that will be
used to filter resources.
      * @param   recursive If true, this will recurse into sub-directories. If false, this
will only
-*              look in the directories given.
+     *              look in the directories given.
      * @param   dirName The name of the directory from which to start scanning for resources.
      */
     protected void findInDirectory(Test<T> test, boolean recursive, String dirName)
{
         // Normalize the name just in case they passed in a package name
-        dirName = dirName.replace('.', '/');
+        dirName = dirName.replace('.', '/').replace('\\', '/');
 
         List<URL> urls = getURLs(dirName);
         if (urls == null) {

Modified: struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java?rev=635378&r1=635377&r2=635378&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
(original)
+++ struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
Sun Mar  9 15:15:07 2008
@@ -21,6 +21,7 @@
 package org.apache.struts2.convention;
 
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -201,6 +202,12 @@
         Map<String, PackageConfig.Builder> packageConfigs = new HashMap<String,
PackageConfig.Builder>();
 
         for (Class<?> actionClass : classes) {
+            // Skip all interfaces, enums, annotations, and abstract classes
+            if (actionClass.isAnnotation() || actionClass.isInterface() || actionClass.isEnum()
||
+                    (actionClass.getModifiers() & Modifier.ABSTRACT) != 0) {
+                continue;
+            }
+
             // Tell the ObjectFactory about this class
             try {
                 objectFactory.getClassInstance(actionClass.getName());



Mime
View raw message