struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [2/2] git commit: WW-4165 Checks if dynamic attributes don't overlap tag attributes This can be done only in a component as when dynamic attributes are set by a container on the tag, the component wasn't instantiated yet - it will be created in doStartTa
Date Mon, 22 Sep 2014 07:01:28 GMT
WW-4165 Checks if dynamic attributes don't overlap tag attributes
This can be done only in a component as when dynamic attributes are set
by a container on the tag, the component wasn't instantiated yet - it
will be created in doStartTag method which is called after all
attributes were set


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/4f4f5260
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/4f4f5260
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/4f4f5260

Branch: refs/heads/develop
Commit: 4f4f5260029f2074de6c925ae97c5cd6a6bc2a55
Parents: bc78860
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Mon Sep 22 09:01:11 2014 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Mon Sep 22 09:01:11 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/struts2/components/UIBean.java    | 14 ++++++--------
 .../apache/struts2/views/jsp/ui/AbstractUITag.java    |  4 ----
 .../org/apache/struts2/views/jsp/ui/AnchorTest.java   |  2 +-
 .../apache/struts2/views/jsp/ui/ComponentTest.java    |  3 ++-
 .../org/apache/struts2/views/jsp/ui/RadioTest.java    |  1 -
 5 files changed, 9 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/4f4f5260/core/src/main/java/org/apache/struts2/components/UIBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java
index 49d7063..5fd99a9 100644
--- a/core/src/main/java/org/apache/struts2/components/UIBean.java
+++ b/core/src/main/java/org/apache/struts2/components/UIBean.java
@@ -39,16 +39,10 @@ import org.apache.struts2.views.util.ContextUtil;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.Writer;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 
 /**
  * UIBean is the standard superclass of all Struts UI components.
@@ -1260,8 +1254,12 @@ public abstract class UIBean extends Component {
         this.tooltipIconPath = tooltipIconPath;
     }
 
-	public void setDynamicAttributes(Map<String, Object> dynamicAttributes) {
-		this.dynamicAttributes.putAll(dynamicAttributes);
+	public void setDynamicAttributes(Map<String, Object> tagDynamicAttributes) {
+        for (String key : tagDynamicAttributes.keySet()) {
+            if (!isValidTagAttribute(key)) {
+                dynamicAttributes.put(key, tagDynamicAttributes.get(key));
+            }
+        }
     }
 
 	@Override

http://git-wip-us.apache.org/repos/asf/struts/blob/4f4f5260/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java
index d12b3a1..e57932a 100644
--- a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java
+++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java
@@ -305,10 +305,6 @@ public abstract class AbstractUITag extends ComponentTagSupport implements
Dynam
     }
 
     public void setDynamicAttribute(String uri, String localName, Object value) throws JspException
{
-        if (component.isValidTagAttribute(localName)) {
-            return;
-        }
-
         if (ComponentUtils.altSyntax(getStack()) && ComponentUtils.isExpression(value))
{
             dynamicAttributes.put(localName, String.valueOf(ObjectUtils.defaultIfNull(findValue(value.toString()),
value)));
         } else {

http://git-wip-us.apache.org/repos/asf/struts/blob/4f4f5260/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java
index 6511944..bd007e9 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java
@@ -89,9 +89,9 @@ public class AnchorTest extends AbstractUITagTest {
     private AnchorTag createTag() throws JspException {
         AnchorTag tag = new AnchorTag();
         tag.setPageContext(pageContext);
-        tag.doStartTag();
 
         tag.setId("mylink");
         return tag;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/4f4f5260/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java
index 58a348a..124829b 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java
@@ -120,9 +120,10 @@ public class ComponentTest extends AbstractUITagTest {
         FormTag tag = new FormTag();
         tag.setPageContext(pageContext);
 
-        tag.doStartTag();
         tag.setDynamicAttribute("uri://some.uri", "includeContext", false);
 
+        tag.doStartTag();
+
         assertTrue(tag.includeContext);
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/4f4f5260/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java
index a3d01fa..d3a9488 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java
@@ -185,7 +185,6 @@ public class RadioTest extends AbstractUITagTest {
 
         RadioTag tag = new RadioTag();
         tag.setPageContext(pageContext);
-        tag.doStartTag();
         tag.setLabel("mylabel");
         tag.setName("myname");
         tag.setValue("");


Mime
View raw message