(struts) branch dependabot/maven/org.apache.felix-org.apache.felix.framework-7.0.5 deleted (was 1ab49d3a0)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch dependabot/maven/org.apache.felix-org.apache.felix.framework-7.0.5 in repository https://gitbox.apache.org/repos/asf/struts.git was 1ab49d3a0 Bump org.apache.felix:org.apache.felix.framework from 6.0.3 to 7.0.5 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(struts) branch master updated (49b8eedf1 -> 649760d8b)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts.git from 49b8eedf1 Merge pull request #920 from apache/fix/WW-5419-tiles add 758174c52 WW-5400 Extend default configuration options for the CSP interceptor. Previously, it was impossible to set global options for the CSP interceptor. The only options was to have every action individually implement CspSettingsAware. add 0151bdeb9 WW-5400 Better toString formatting add 6ac8b04ad WW-5400 Added @since Struts 6.5.0 to new properties as requested new 649760d8b Merge pull request #913 from eschulma/master The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../struts2/interceptor/csp/CspInterceptor.java| 52 +- .../struts2/interceptor/csp/CspSettings.java | 8 +++ .../interceptor/csp/DefaultCspSettings.java| 34 +++-- .../struts2/interceptor/CspInterceptorTest.java| 83 +++--- 4 files changed, 159 insertions(+), 18 deletions(-)
(struts) 01/01: Merge pull request #913 from eschulma/master
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts.git commit 649760d8b0d2c481784ba93f7be66ce843b11493 Merge: 49b8eedf1 6ac8b04ad Author: Lukasz Lenart AuthorDate: Sat May 11 06:36:33 2024 +0200 Merge pull request #913 from eschulma/master WW-5400 Extend default configuration options for the CSP interceptor. .../struts2/interceptor/csp/CspInterceptor.java| 52 +- .../struts2/interceptor/csp/CspSettings.java | 8 +++ .../interceptor/csp/DefaultCspSettings.java| 34 +++-- .../struts2/interceptor/CspInterceptorTest.java| 83 +++--- 4 files changed, 159 insertions(+), 18 deletions(-)
(struts) branch dependabot/maven/org.eclipse.jetty-jetty-maven-plugin-11.0.20 deleted (was 4f8867c00)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch dependabot/maven/org.eclipse.jetty-jetty-maven-plugin-11.0.20 in repository https://gitbox.apache.org/repos/asf/struts.git was 4f8867c00 Bump org.eclipse.jetty:jetty-maven-plugin The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(struts) branch dependabot/maven/org.testng-testng-7.10.2 deleted (was 672f039a2)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch dependabot/maven/org.testng-testng-7.10.2 in repository https://gitbox.apache.org/repos/asf/struts.git was 672f039a2 Bump org.testng:testng from 7.5.1 to 7.10.2 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(struts) branch dependabot/maven/org.apache.tomcat-tomcat-juli-10.1.23 deleted (was 9de2ef812)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch dependabot/maven/org.apache.tomcat-tomcat-juli-10.1.23 in repository https://gitbox.apache.org/repos/asf/struts.git was 9de2ef812 Bump org.apache.tomcat:tomcat-juli from 8.5.53 to 10.1.23 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(struts) branch dependabot/maven/javax.portlet-portlet-api-3.0.1 deleted (was aab9a3d43)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch dependabot/maven/javax.portlet-portlet-api-3.0.1 in repository https://gitbox.apache.org/repos/asf/struts.git was aab9a3d43 Bump javax.portlet:portlet-api from 2.0 to 3.0.1 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(struts) 01/01: WW-5422 Fixes support for trimable locale string in request
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch fix/WW-5422-trimable in repository https://gitbox.apache.org/repos/asf/struts.git commit 627f27a040e3689c39a474a85332fb7b9eb05579 Author: Lukasz Lenart AuthorDate: Sat May 11 07:23:22 2024 +0200 WW-5422 Fixes support for trimable locale string in request --- .../com/opensymphony/xwork2/ActionSupport.java | 5 + .../opensymphony/xwork2/DefaultLocaleProvider.java | 13 ++- .../com/opensymphony/xwork2/LocaleProvider.java| 16 ++ .../validator/DelegatingValidatorContext.java | 12 ++- .../struts2/interceptor/I18nInterceptor.java | 25 -- .../struts2/interceptor/I18nInterceptorTest.java | 10 + 6 files changed, 63 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java index 8c7e15e60..ab1a18099 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java +++ b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java @@ -90,6 +90,11 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex return getLocaleProvider().isValidLocale(locale); } +@Override +public Locale toLocale(String localeStr) { +return getLocaleProvider().toLocale(localeStr); +} + @Override public boolean hasKey(String key) { return getTextProvider().hasKey(key); diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java b/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java index da89306c0..18dd119dc 100644 --- a/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java +++ b/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java @@ -48,7 +48,7 @@ public class DefaultLocaleProvider implements LocaleProvider { public boolean isValidLocaleString(String localeStr) { Locale locale = null; try { -locale = LocaleUtils.toLocale(StringUtils.trimToNull(localeStr)); +locale = LocaleUtils.toLocale(localeStr); } catch (IllegalArgumentException e) { LOG.warn(new ParameterizedMessage("Cannot convert [{}] to proper locale", localeStr), e); } @@ -59,4 +59,15 @@ public class DefaultLocaleProvider implements LocaleProvider { public boolean isValidLocale(Locale locale) { return LocaleUtils.isAvailableLocale(locale); } + +@Override +public Locale toLocale(String localeStr) { +Locale locale = null; +try { +locale = LocaleUtils.toLocale(StringUtils.trimToNull(localeStr)); +} catch (IllegalArgumentException e) { +LOG.warn(new ParameterizedMessage("Cannot convert [{}] to proper locale", localeStr), e); +} +return locale; +} } diff --git a/core/src/main/java/com/opensymphony/xwork2/LocaleProvider.java b/core/src/main/java/com/opensymphony/xwork2/LocaleProvider.java index 67972af34..00a41a25b 100644 --- a/core/src/main/java/com/opensymphony/xwork2/LocaleProvider.java +++ b/core/src/main/java/com/opensymphony/xwork2/LocaleProvider.java @@ -18,6 +18,9 @@ */ package com.opensymphony.xwork2; +import org.apache.commons.lang3.LocaleUtils; +import org.apache.commons.lang3.StringUtils; + import java.util.Locale; @@ -58,4 +61,17 @@ public interface LocaleProvider { */ boolean isValidLocale(Locale locale); +/** + * Tries to convert provided locale string into {@link Locale} or returns null + * @param localeStr a String representing locale, e.g.: en_EN + * @return instance of {@link Locale} or null + * @since Struts 6.5.0 + */ +default Locale toLocale(String localeStr) { +try { +return LocaleUtils.toLocale(StringUtils.trimToNull(localeStr)); +} catch (IllegalArgumentException e) { +return null; +} +} } diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java index 5c7f2c136..bc8c88875 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java @@ -122,10 +122,15 @@ public class DelegatingValidatorContext implements ValidatorContext { return localeProvider.isValidLocale(locale); } +@Override +public Locale toLocale(String localeStr) { +return localeProvider.toLocale(localeStr); +} + public boolean hasKey(String key) { return textProvider.hasKey(key); } - + public String getText(String aTextName) { return textProvider.getText(aTextName); } @@ -280,6 +285,11 @@ public class DelegatingValidatorCon
(struts) branch fix/WW-5422-trimable created (now 627f27a04)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch fix/WW-5422-trimable in repository https://gitbox.apache.org/repos/asf/struts.git at 627f27a04 WW-5422 Fixes support for trimable locale string in request This branch includes the following new commits: new 627f27a04 WW-5422 Fixes support for trimable locale string in request The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
(struts) 01/01: WW-5422 Fixes support for trimable locale string in request
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch fix/WW-5422-trimable in repository https://gitbox.apache.org/repos/asf/struts.git commit 3e3111c746205ecf2754d07141ae209f479c4790 Author: Lukasz Lenart AuthorDate: Sat May 11 07:23:22 2024 +0200 WW-5422 Fixes support for trimable locale string in request --- .../com/opensymphony/xwork2/ActionSupport.java | 5 + .../opensymphony/xwork2/DefaultLocaleProvider.java | 13 ++- .../com/opensymphony/xwork2/LocaleProvider.java| 16 ++ .../validator/DelegatingValidatorContext.java | 12 ++- .../struts2/interceptor/I18nInterceptor.java | 25 -- .../struts2/interceptor/I18nInterceptorTest.java | 20 + 6 files changed, 73 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java index 8c7e15e60..ab1a18099 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java +++ b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java @@ -90,6 +90,11 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex return getLocaleProvider().isValidLocale(locale); } +@Override +public Locale toLocale(String localeStr) { +return getLocaleProvider().toLocale(localeStr); +} + @Override public boolean hasKey(String key) { return getTextProvider().hasKey(key); diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java b/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java index da89306c0..18dd119dc 100644 --- a/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java +++ b/core/src/main/java/com/opensymphony/xwork2/DefaultLocaleProvider.java @@ -48,7 +48,7 @@ public class DefaultLocaleProvider implements LocaleProvider { public boolean isValidLocaleString(String localeStr) { Locale locale = null; try { -locale = LocaleUtils.toLocale(StringUtils.trimToNull(localeStr)); +locale = LocaleUtils.toLocale(localeStr); } catch (IllegalArgumentException e) { LOG.warn(new ParameterizedMessage("Cannot convert [{}] to proper locale", localeStr), e); } @@ -59,4 +59,15 @@ public class DefaultLocaleProvider implements LocaleProvider { public boolean isValidLocale(Locale locale) { return LocaleUtils.isAvailableLocale(locale); } + +@Override +public Locale toLocale(String localeStr) { +Locale locale = null; +try { +locale = LocaleUtils.toLocale(StringUtils.trimToNull(localeStr)); +} catch (IllegalArgumentException e) { +LOG.warn(new ParameterizedMessage("Cannot convert [{}] to proper locale", localeStr), e); +} +return locale; +} } diff --git a/core/src/main/java/com/opensymphony/xwork2/LocaleProvider.java b/core/src/main/java/com/opensymphony/xwork2/LocaleProvider.java index 67972af34..00a41a25b 100644 --- a/core/src/main/java/com/opensymphony/xwork2/LocaleProvider.java +++ b/core/src/main/java/com/opensymphony/xwork2/LocaleProvider.java @@ -18,6 +18,9 @@ */ package com.opensymphony.xwork2; +import org.apache.commons.lang3.LocaleUtils; +import org.apache.commons.lang3.StringUtils; + import java.util.Locale; @@ -58,4 +61,17 @@ public interface LocaleProvider { */ boolean isValidLocale(Locale locale); +/** + * Tries to convert provided locale string into {@link Locale} or returns null + * @param localeStr a String representing locale, e.g.: en_EN + * @return instance of {@link Locale} or null + * @since Struts 6.5.0 + */ +default Locale toLocale(String localeStr) { +try { +return LocaleUtils.toLocale(StringUtils.trimToNull(localeStr)); +} catch (IllegalArgumentException e) { +return null; +} +} } diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java index 5c7f2c136..bc8c88875 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/DelegatingValidatorContext.java @@ -122,10 +122,15 @@ public class DelegatingValidatorContext implements ValidatorContext { return localeProvider.isValidLocale(locale); } +@Override +public Locale toLocale(String localeStr) { +return localeProvider.toLocale(localeStr); +} + public boolean hasKey(String key) { return textProvider.hasKey(key); } - + public String getText(String aTextName) { return textProvider.getText(aTextName); } @@ -280,6 +285,11 @@ public class DelegatingVali
(struts) branch fix/WW-5422-trimable updated (627f27a04 -> 3e3111c74)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch fix/WW-5422-trimable in repository https://gitbox.apache.org/repos/asf/struts.git discard 627f27a04 WW-5422 Fixes support for trimable locale string in request new 3e3111c74 WW-5422 Fixes support for trimable locale string in request This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (627f27a04) \ N -- N -- N refs/heads/fix/WW-5422-trimable (3e3111c74) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../org/apache/struts2/interceptor/I18nInterceptorTest.java | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-)
(struts) branch feature/WW-5414-after created (now 0141068ff)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch feature/WW-5414-after in repository https://gitbox.apache.org/repos/asf/struts.git at 0141068ff WW-5414 Always call afterInvocation even in case of exception This branch includes the following new commits: new 0141068ff WW-5414 Always call afterInvocation even in case of exception The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
(struts) 01/01: WW-5414 Always call afterInvocation even in case of exception
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch feature/WW-5414-after in repository https://gitbox.apache.org/repos/asf/struts.git commit 0141068ff4a5e0c32441fe9895717e88fbf2521b Author: Lukasz Lenart AuthorDate: Sat May 11 08:23:56 2024 +0200 WW-5414 Always call afterInvocation even in case of exception --- .../interceptor/exec/StrutsBackgroundProcess.java | 16 --- .../exec/StrutsBackgroundProcessTest.java | 32 ++ 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcess.java b/core/src/main/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcess.java index 42237262f..dce78730c 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcess.java +++ b/core/src/main/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcess.java @@ -20,6 +20,8 @@ package org.apache.struts2.interceptor.exec; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionInvocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.io.Serializable; @@ -30,6 +32,8 @@ public class StrutsBackgroundProcess implements BackgroundProcess, Serializable private static final long serialVersionUID = 3884464776311686443L; +private static final Logger LOG = LogManager.getLogger(StrutsBackgroundProcess.class); + private final String threadName; private final int threadPriority; @@ -44,8 +48,8 @@ public class StrutsBackgroundProcess implements BackgroundProcess, Serializable /** * Constructs a background process * - * @param invocation The action invocation - * @param threadName The name of background thread + * @param invocation The action invocation + * @param threadName The name of background thread * @param threadPriority The priority of background thread */ public StrutsBackgroundProcess(ActionInvocation invocation, String threadName, int threadPriority) { @@ -61,11 +65,15 @@ public class StrutsBackgroundProcess implements BackgroundProcess, Serializable try { beforeInvocation(); result = invocation.invokeActionOnly(); -afterInvocation(); } catch (Exception e) { +try { +afterInvocation(); +} catch (Exception ex) { +LOG.warn("Exception during afterInvocation() execution", ex); +} exception = e; } finally { - done = true; +done = true; } }); processThread.setName(threadName); diff --git a/core/src/test/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcessTest.java b/core/src/test/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcessTest.java index 5906c995a..1e0166951 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcessTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/exec/StrutsBackgroundProcessTest.java @@ -120,6 +120,19 @@ public class StrutsBackgroundProcessTest extends StrutsInternalTestCase { assertEquals(100, mutableState.get()); } +public void testErrorableProcesses() throws InterruptedException { +MockActionInvocationWithActionInvoker invocation = new MockActionInvocationWithActionInvoker(() -> { +throw new IllegalStateException("boom"); +}); + +BackgroundProcess bp = new ErrorableBackgroundProcess(invocation, "error").prepare(); +executor.execute(bp); + +Thread.sleep(100); + +assertTrue("afterInvocation not called in case of exception", ((ErrorableBackgroundProcess) bp).isDoneAfter()); +} + public void testUnpreparedProcess() throws ExecutionException, InterruptedException, TimeoutException { // given MockActionInvocationWithActionInvoker invocation = new MockActionInvocationWithActionInvoker(() -> "done"); @@ -177,3 +190,22 @@ class LockBackgroundProcess extends StrutsBackgroundProcess { lock.notify(); } } + +class ErrorableBackgroundProcess extends StrutsBackgroundProcess { + +private boolean doneAfter; + +public ErrorableBackgroundProcess(ActionInvocation invocation, String name) { +super(invocation, name, Thread.NORM_PRIORITY); +} + +@Override +protected void afterInvocation() throws Exception { +super.afterInvocation(); +doneAfter = true; +} + +public boolean isDoneAfter() { +return doneAfter; +} +}