Revision: 1412
          http://stripes.svn.sourceforge.net/stripes/?rev=1412&view=rev
Author:   bengunter
Date:     2011-03-03 19:46:22 +0000 (Thu, 03 Mar 2011)

Log Message:
-----------
Applied fix for STS-797 from 1.5.x branch.

Modified Paths:
--------------
    
trunk/stripes/src/net/sourceforge/stripes/controller/AnnotatedClassActionResolver.java
    
trunk/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java
    
trunk/stripes/src/net/sourceforge/stripes/controller/StripesRequestWrapper.java
    trunk/stripes/src/net/sourceforge/stripes/controller/UrlBinding.java
    trunk/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/AnnotatedClassActionResolver.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/controller/AnnotatedClassActionResolver.java
      2011-03-03 19:45:42 UTC (rev 1411)
+++ 
trunk/stripes/src/net/sourceforge/stripes/controller/AnnotatedClassActionResolver.java
      2011-03-03 19:46:22 UTC (rev 1412)
@@ -135,25 +135,22 @@
             getUrlBindingFactory().addBinding(clazz, new UrlBinding(clazz, 
binding));
         }
 
-        // Only process the class if it's properly annotated
-        if (binding != null) {
-            // Construct the mapping of event->method for the class
-            Map<String, Method> classMappings = new HashMap<String, Method>();
-            processMethods(clazz, classMappings);
+        // Construct the mapping of event->method for the class
+        Map<String, Method> classMappings = new HashMap<String, Method>();
+        processMethods(clazz, classMappings);
 
-            // Put the event->method mapping for the class into the set of 
mappings
-            this.eventMappings.put(clazz, classMappings);
+        // Put the event->method mapping for the class into the set of mappings
+        this.eventMappings.put(clazz, classMappings);
 
-            if (log.getRealLog().isDebugEnabled()) {
-                // Print out the event mappings nicely
-                for (Map.Entry<String, Method> entry : 
classMappings.entrySet()) {
-                    String event = entry.getKey();
-                    Method handler = entry.getValue();
-                    boolean isDefault = DEFAULT_HANDLER_KEY.equals(event);
+        if (log.getRealLog().isDebugEnabled()) {
+            // Print out the event mappings nicely
+            for (Map.Entry<String, Method> entry : classMappings.entrySet()) {
+                String event = entry.getKey();
+                Method handler = entry.getValue();
+                boolean isDefault = DEFAULT_HANDLER_KEY.equals(event);
 
-                    log.debug("Bound: ", clazz.getSimpleName(), ".", 
handler.getName(), "() ==> ",
-                            binding, isDefault ? "" : "?" + event);
-                }
+                log.debug("Bound: ", clazz.getSimpleName(), ".", 
handler.getName(), "() ==> ",
+                        binding, isDefault ? "" : "?" + event);
             }
         }
     }

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java  
    2011-03-03 19:45:42 UTC (rev 1411)
+++ 
trunk/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java  
    2011-03-03 19:46:22 UTC (rev 1412)
@@ -473,7 +473,7 @@
                     + StripesFilter.class.getName() + "']/..", document, 
XPathConstants.NODESET);
             if (filterNodes == null || filterNodes.getLength() != 1) {
                 String msg;
-                if (filterNodes.getLength() < 1) {
+                if (filterNodes == null || filterNodes.getLength() < 1) {
                     msg = "StripesFilter is not declared in web.xml. ";
                 }
                 else {

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/StripesRequestWrapper.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/controller/StripesRequestWrapper.java 
    2011-03-03 19:45:42 UTC (rev 1411)
+++ 
trunk/stripes/src/net/sourceforge/stripes/controller/StripesRequestWrapper.java 
    2011-03-03 19:46:22 UTC (rev 1412)
@@ -501,7 +501,7 @@
                     if (value == null && request.getParameterValues(name) == 
null) {
                         value = p.getDefaultValue();
                     }
-                    if (name != null && value != null) {
+                    if (value != null) {
                         if (params == null) {
                             params = new LinkedHashMap<String, String[]>();
                         }

Modified: trunk/stripes/src/net/sourceforge/stripes/controller/UrlBinding.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/UrlBinding.java        
2011-03-03 19:45:42 UTC (rev 1411)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/UrlBinding.java        
2011-03-03 19:46:22 UTC (rev 1412)
@@ -43,22 +43,28 @@
     public UrlBinding(Class<? extends ActionBean> beanType, String path, 
List<Object> components) {
         this.beanType = beanType;
         this.path = path;
-        if (components != null)
+
+        if (components != null && !components.isEmpty()) {
             this.components = Collections.unmodifiableList(components);
+            this.parameters = new 
ArrayList<UrlBindingParameter>(components.size());
 
-        this.parameters = new 
ArrayList<UrlBindingParameter>(this.components.size());
-        for (Object component : components) {
-            if (component instanceof UrlBindingParameter) {
-                this.parameters.add((UrlBindingParameter) component);
+            for (Object component : components) {
+                if (component instanceof UrlBindingParameter) {
+                    this.parameters.add((UrlBindingParameter) component);
+                }
             }
-        }
 
-        if (this.parameters.size() > 0) {
-            Object last = this.components.get(this.components.size() - 1);
-            if (last instanceof String) {
-                this.suffix = (String) last;
+            if (!this.parameters.isEmpty()) {
+                Object last = components.get(components.size() - 1);
+                if (last instanceof String) {
+                    this.suffix = (String) last;
+                }
             }
         }
+        else {
+            this.components = Collections.emptyList();
+            this.parameters = Collections.emptyList();
+        }
     }
 
     /**

Modified: trunk/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java      
2011-03-03 19:45:42 UTC (rev 1411)
+++ trunk/stripes/src/net/sourceforge/stripes/util/UrlBuilder.java      
2011-03-03 19:46:22 UTC (rev 1412)
@@ -534,12 +534,10 @@
             
StripesFilter.getConfiguration().getActionResolver().getActionBeanType(url);
         }
         catch (UrlBindingConflictException e) {
-            if (binding != null) {
-                UrlBindingConflictException tmp = new 
UrlBindingConflictException(binding
-                        .getBeanType(), e.getPath(), e.getMatches());
-                tmp.setStackTrace(e.getStackTrace());
-                e = tmp;
-            }
+            UrlBindingConflictException tmp = new UrlBindingConflictException(
+                    binding.getBeanType(), e.getPath(), e.getMatches());
+            tmp.setStackTrace(e.getStackTrace());
+            e = tmp;
             throw e;
         }
         return url;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to