This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository nuiton-web. See https://gitlab.nuiton.org/nuiton/nuiton-web.git commit e47aef9d86e4df1b75cc460bd8112f90b9ed13c3 Author: Eric Chatellier <chatellier@codelutin.com> Date: Mon Jul 17 15:24:35 2017 +0200 fixes #122: Update to struts 2.5.12 --- nuiton-security/pom.xml | 2 +- nuiton-struts2/pom.xml | 2 +- .../org/nuiton/web/struts2/I18nTextProvider.java | 29 ++++++++-------------- .../web/struts2/I18nTextProviderFactory.java | 21 ++++++++++++++++ nuiton-web/pom.xml | 2 +- pom.xml | 6 ++--- 6 files changed, 38 insertions(+), 24 deletions(-) diff --git a/nuiton-security/pom.xml b/nuiton-security/pom.xml index aecf567..7ec2fd6 100644 --- a/nuiton-security/pom.xml +++ b/nuiton-security/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.nuiton.web</groupId> <artifactId>nuiton-web-parent</artifactId> - <version>1.20-SNAPSHOT</version> + <version>1.19-SNAPSHOT</version> </parent> <artifactId>nuiton-security</artifactId> diff --git a/nuiton-struts2/pom.xml b/nuiton-struts2/pom.xml index a9916f5..0679c4d 100644 --- a/nuiton-struts2/pom.xml +++ b/nuiton-struts2/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.nuiton.web</groupId> <artifactId>nuiton-web-parent</artifactId> - <version>1.20-SNAPSHOT</version> + <version>1.19-SNAPSHOT</version> </parent> <artifactId>nuiton-struts2</artifactId> diff --git a/nuiton-struts2/src/main/java/org/nuiton/web/struts2/I18nTextProvider.java b/nuiton-struts2/src/main/java/org/nuiton/web/struts2/I18nTextProvider.java index cf3f455..f7e2001 100644 --- a/nuiton-struts2/src/main/java/org/nuiton/web/struts2/I18nTextProvider.java +++ b/nuiton-struts2/src/main/java/org/nuiton/web/struts2/I18nTextProvider.java @@ -22,7 +22,9 @@ package org.nuiton.web.struts2; import com.opensymphony.xwork2.LocaleProvider; +import com.opensymphony.xwork2.LocalizedTextProvider; import com.opensymphony.xwork2.ResourceBundleTextProvider; +import com.opensymphony.xwork2.TextProviderSupport; import com.opensymphony.xwork2.util.ValueStack; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; @@ -45,13 +47,19 @@ import java.util.ResourceBundle; * @author Arnaud Thimel<thimel@codelutin.com> * @since 1.3 */ -public class I18nTextProvider implements ResourceBundleTextProvider { +public class I18nTextProvider extends TextProviderSupport implements ResourceBundleTextProvider { - private static final Log log = LogFactory.getLog(BaseAction.class); + private static final Log log = LogFactory.getLog(I18nTextProvider.class); public static final String UNTRANSLATED_MARKER = "???"; - protected LocaleProvider localeProvider; + public I18nTextProvider(Class clazz, LocaleProvider provider, LocalizedTextProvider localizedTextProvider) { + super(clazz, provider, localizedTextProvider); + } + + public I18nTextProvider(ResourceBundle bundle, LocaleProvider provider, LocalizedTextProvider localizedTextProvider) { + super(bundle, provider, localizedTextProvider); + } protected String getSafeText(String key, String value) { if (StringUtils.isEmpty(value)) { @@ -64,21 +72,6 @@ public class I18nTextProvider implements ResourceBundleTextProvider { } @Override - public void setBundle(ResourceBundle bundle) { - // Nothing to do - } - - @Override - public void setClazz(Class clazz) { - // Nothing to do - } - - @Override - public void setLocaleProvider(LocaleProvider localeProvider) { - this.localeProvider = localeProvider; - } - - @Override public boolean hasKey(String key) { Locale locale = localeProvider.getLocale(); boolean result = I18n.hasKey(locale, key); diff --git a/nuiton-struts2/src/main/java/org/nuiton/web/struts2/I18nTextProviderFactory.java b/nuiton-struts2/src/main/java/org/nuiton/web/struts2/I18nTextProviderFactory.java new file mode 100644 index 0000000..3ab3a3e --- /dev/null +++ b/nuiton-struts2/src/main/java/org/nuiton/web/struts2/I18nTextProviderFactory.java @@ -0,0 +1,21 @@ +package org.nuiton.web.struts2; + +import com.opensymphony.xwork2.StrutsTextProviderFactory; +import com.opensymphony.xwork2.TextProvider; + +import java.util.ResourceBundle; + +/** + * @since 1.20 + */ +public class I18nTextProviderFactory extends StrutsTextProviderFactory { + @Override + protected TextProvider getTextProvider(Class clazz) { + return new I18nTextProvider(clazz, localeProviderFactory.createLocaleProvider(), localizedTextProvider); + } + + @Override + protected TextProvider getTextProvider(ResourceBundle bundle) { + return new I18nTextProvider(bundle, localeProviderFactory.createLocaleProvider(), localizedTextProvider); + } +} diff --git a/nuiton-web/pom.xml b/nuiton-web/pom.xml index ba986f8..1b35fd7 100644 --- a/nuiton-web/pom.xml +++ b/nuiton-web/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.nuiton.web</groupId> <artifactId>nuiton-web-parent</artifactId> - <version>1.20-SNAPSHOT</version> + <version>1.19-SNAPSHOT</version> </parent> <artifactId>nuiton-web</artifactId> diff --git a/pom.xml b/pom.xml index 53280db..a0103a5 100644 --- a/pom.xml +++ b/pom.xml @@ -26,12 +26,12 @@ License along with this program. If not, see <parent> <groupId>org.nuiton</groupId> <artifactId>nuitonpom</artifactId> - <version>10.4</version> + <version>10.5</version> </parent> <groupId>org.nuiton.web</groupId> <artifactId>nuiton-web-parent</artifactId> - <version>1.20-SNAPSHOT</version> + <version>1.19-SNAPSHOT</version> <packaging>pom</packaging> @@ -133,7 +133,7 @@ License along with this program. If not, see <gwtPluginVersion>2.2.0</gwtPluginVersion> <!-- Strust 2 --> - <struts2Version>2.5.5</struts2Version> + <struts2Version>2.5.12</struts2Version> <shiroVersion>1.3.2</shiroVersion> <servletApiVersion>3.0.1</servletApiVersion> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.