You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/06/22 08:56:43 UTC

[1/5] struts git commit: Reverts dropping name pre-evaluation

Repository: struts
Updated Branches:
  refs/heads/support-2-3 730441b7a -> 00c47b7ce


Reverts dropping name pre-evaluation


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

Branch: refs/heads/support-2-3
Commit: e4ce3ce839e606dd801fb71ac2f8072d7238981c
Parents: 730441b
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Jun 22 08:55:42 2016 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Jun 22 08:55:42 2016 +0200

----------------------------------------------------------------------
 core/src/main/java/org/apache/struts2/components/UIBean.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/e4ce3ce8/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 9c973b3..5fd99a9 100644
--- a/core/src/main/java/org/apache/struts2/components/UIBean.java
+++ b/core/src/main/java/org/apache/struts2/components/UIBean.java
@@ -649,6 +649,7 @@ public abstract class UIBean extends Component {
         addParameter("themeExpansionToken", uiThemeExpansionToken);
         addParameter("expandTheme", uiThemeExpansionToken + theme);
 
+        String name = null;
         String providedLabel = null;
 
         if (this.key != null) {
@@ -665,7 +666,8 @@ public abstract class UIBean extends Component {
         }
 
         if (this.name != null) {
-            addParameter("name", findString(this.name));
+            name = findString(this.name);
+            addParameter("name", name);
         }
 
         if (label != null) {


[5/5] struts git commit: WW-4648 Upgrades commons-fileupload to the latest version

Posted by lu...@apache.org.
WW-4648 Upgrades commons-fileupload to the latest version


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

Branch: refs/heads/support-2-3
Commit: 00c47b7ce633706f51f91a8ff6ac04a270712473
Parents: c84810f
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Jun 22 10:56:31 2016 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Jun 22 10:56:31 2016 +0200

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/00c47b7c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 38c1197..edc8008 100644
--- a/pom.xml
+++ b/pom.xml
@@ -764,7 +764,7 @@
             <dependency>
                 <groupId>commons-fileupload</groupId>
                 <artifactId>commons-fileupload</artifactId>
-                <version>1.3.1</version>
+                <version>1.3.2</version>
             </dependency>
             <dependency>
                 <groupId>commons-io</groupId>


[4/5] struts git commit: Adds test to guard pre-evaulation of name attribute

Posted by lu...@apache.org.
Adds test to guard pre-evaulation of name attribute


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

Branch: refs/heads/support-2-3
Commit: c84810ff8233c953146d52731e92090eb07746f5
Parents: 2ea59b3
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Jun 22 10:46:09 2016 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Jun 22 10:46:09 2016 +0200

----------------------------------------------------------------------
 .../apache/struts2/views/jsp/ui/TextfieldTest.java  | 16 ++++++++++++++++
 .../apache/struts2/views/jsp/ui/Textfield-12.txt    |  4 ++++
 2 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/c84810ff/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java
index e1a81c4..5ccfe32 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java
@@ -281,4 +281,20 @@ public class TextfieldTest extends AbstractUITagTest {
         verify(TextFieldTag.class.getResource("Textfield-11.txt"));
     }
 
+    public void testNameEvaluation() throws Exception {
+        TestAction testAction = (TestAction) action;
+        testAction.setArray(new String[]{"test", "bar"});
+        testAction.setFooInt(1);
+
+        TextFieldTag tag = new TextFieldTag();
+        tag.setPageContext(pageContext);
+        tag.setName("array[%{fooInt}]");
+
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(TextFieldTag.class.getResource("Textfield-12.txt"));
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/c84810ff/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-12.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-12.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-12.txt
new file mode 100644
index 0000000..44e9eb3
--- /dev/null
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-12.txt
@@ -0,0 +1,4 @@
+<tr>
+  <td class="tdLabel"></td>
+  <td><input type="text" name="array[1]" value="bar" id="array_1_"/></td>
+</tr>
\ No newline at end of file


[2/5] struts git commit: Uses LocaleProvider and default TextProvider instead of evaluating expression

Posted by lu...@apache.org.
Uses LocaleProvider and default TextProvider instead of evaluating expression


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

Branch: refs/heads/support-2-3
Commit: fae1e0e7993fff80ff24c320dc38b1d8ad510137
Parents: e4ce3ce
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Jun 22 10:38:12 2016 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Jun 22 10:38:12 2016 +0200

----------------------------------------------------------------------
 .../org/apache/struts2/components/I18n.java     | 25 ++++++++++++--------
 1 file changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/fae1e0e7/core/src/main/java/org/apache/struts2/components/I18n.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/I18n.java b/core/src/main/java/org/apache/struts2/components/I18n.java
index 82d991e..4492fa1 100644
--- a/core/src/main/java/org/apache/struts2/components/I18n.java
+++ b/core/src/main/java/org/apache/struts2/components/I18n.java
@@ -22,14 +22,12 @@
 package org.apache.struts2.components;
 
 import java.io.Writer;
-import java.util.Locale;
 import java.util.ResourceBundle;
 
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 import org.apache.struts2.StrutsException;
 
-import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.LocaleProvider;
 import com.opensymphony.xwork2.TextProviderFactory;
 import com.opensymphony.xwork2.TextProvider;
@@ -95,6 +93,8 @@ public class I18n extends Component {
     protected String name;
     protected Container container;
     private TextProvider textProvider;
+    private TextProvider defaultTextProvider;
+    private LocaleProvider localeProvider;
 
     public I18n(ValueStack stack) {
         super(stack);
@@ -105,26 +105,31 @@ public class I18n extends Component {
         this.container = container;
     }
 
+    @Inject
+    public void setTextProvider(TextProvider textProvider) {
+        this.defaultTextProvider = textProvider;
+    }
+
+    @Inject
+    public void setLocaleProvider(LocaleProvider localeProvider) {
+        this.localeProvider = localeProvider;
+    }
+
     public boolean start(Writer writer) {
         boolean result = super.start(writer);
 
         try {
             String name = this.findString(this.name, "name", "Resource bundle name is required. Example: foo or foo_en");
-            ResourceBundle bundle = (ResourceBundle) findValue("getTexts('" + name + "')");
+            ResourceBundle bundle = defaultTextProvider.getTexts(name);
 
             if (bundle == null) {
-                bundle = LocalizedTextUtil.findResourceBundle(name, (Locale) getStack().getContext().get(ActionContext.LOCALE));
+                bundle = LocalizedTextUtil.findResourceBundle(name, localeProvider.getLocale());
             }
 
             if (bundle != null) {
-                final Locale locale = (Locale) getStack().getContext().get(ActionContext.LOCALE);
                 TextProviderFactory tpf = new TextProviderFactory();
                 container.inject(tpf);
-                textProvider = tpf.createInstance(bundle, new LocaleProvider() {
-                    public Locale getLocale() {
-                        return locale;
-                    }
-                });
+                textProvider = tpf.createInstance(bundle, localeProvider);
                 getStack().push(textProvider);
                 pushed = true;
             }


[3/5] struts git commit: Drops commented out test

Posted by lu...@apache.org.
Drops commented out test


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

Branch: refs/heads/support-2-3
Commit: 2ea59b31b4adcd6b7b6fc0dc67ae2218791d63b8
Parents: fae1e0e
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Jun 22 10:38:39 2016 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Jun 22 10:38:39 2016 +0200

----------------------------------------------------------------------
 .../org/apache/struts2/components/UIBeanTest.java  | 17 -----------------
 1 file changed, 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/2ea59b31/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
index 470cc91..b2fc843 100644
--- a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
+++ b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
@@ -164,21 +164,4 @@ public class UIBeanTest extends StrutsInternalTestCase {
         assertEquals("12", txtFld.getTheme());
     }
 
-//    I couldn't figure out how to make this test work. Bailing for now.
-//    public void testEscapeLabel() throws Exception {
-//        ValueStack stack = ActionContext.getContext().getValueStack();
-//        MockHttpServletRequest req = new MockHttpServletRequest();
-//        MockHttpServletResponse res = new MockHttpServletResponse();
-//        stack.push(this);
-//
-//        TextField txtFld = new TextField(stack, req, res);
-//        txtFld.setKey("test['foo']");
-//        txtFld.evaluateParams();
-//        assertEquals("test_label", txtFld.getParameters().get("label"));
-//    }
-//
-//    public String getText(String key) {
-//        assertEquals("test[\\'foo\\']", key);
-//        return "test_label";
-//    }
 }