This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/struts.git
The following commit(s) were added to refs/heads/main by this push:
new 83864b1eb WW-3720 test(core): cover comma-delimited interceptor params
split across lines (#2040)
83864b1eb is described below
commit 83864b1ebd8a38e35838b79586ab7e8a073d97fb
Author: Lukasz Lenart <[email protected]>
AuthorDate: Sat Oct 17 15:33:00 2026 +0200
WW-3720 test(core): cover comma-delimited interceptor params split across
lines (#2040)
* WW-3720 test(core): cover comma-delimited interceptor params split across
lines
Pins that a multi-line <param> value such as excludeMethods is parsed
into separate method names, both on the interceptor definition and on
an interceptor-ref override.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* WW-3720 test(core): use struts- fixture prefix and drop unneeded throws
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../XmlConfigurationProviderInterceptorsTest.java | 15 +++++++
.../struts-interceptor-multiline-params.xml | 52 ++++++++++++++++++++++
2 files changed, 67 insertions(+)
diff --git
a/core/src/test/java/org/apache/struts2/config/providers/XmlConfigurationProviderInterceptorsTest.java
b/core/src/test/java/org/apache/struts2/config/providers/XmlConfigurationProviderInterceptorsTest.java
index d67fdfcc4..cc4f5ef2d 100644
---
a/core/src/test/java/org/apache/struts2/config/providers/XmlConfigurationProviderInterceptorsTest.java
+++
b/core/src/test/java/org/apache/struts2/config/providers/XmlConfigurationProviderInterceptorsTest.java
@@ -29,6 +29,7 @@ import org.apache.struts2.config.entities.InterceptorMapping;
import org.apache.struts2.config.entities.InterceptorStackConfig;
import org.apache.struts2.config.entities.PackageConfig;
import org.apache.struts2.interceptor.LoggingInterceptor;
+import org.apache.struts2.interceptor.MethodFilterInterceptor;
import org.apache.struts2.mock.MockInterceptor;
import org.apache.struts2.config.StrutsXmlConfigurationProvider;
import org.apache.struts2.interceptor.NoOpInterceptor;
@@ -36,6 +37,7 @@ import org.apache.struts2.interceptor.NoOpInterceptor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
/**
@@ -231,4 +233,17 @@ public class XmlConfigurationProviderInterceptorsTest
extends ConfigurationTestB
}
+ public void testMultiLineCommaDelimitedParam() {
+
buildConfigurationProvider("org/apache/struts2/config/providers/struts-interceptor-multiline-params.xml");
+
+ PackageConfig pkg = configuration.getPackageConfig("default");
+
+ assertEquals(Set.of("input", "back", "cancel"),
excludeMethodsOf(pkg.getActionConfigs().get("Defined")));
+ assertEquals(Set.of("browse", "list"),
excludeMethodsOf(pkg.getActionConfigs().get("Overridden")));
+ }
+
+ private static Set<String> excludeMethodsOf(ActionConfig actionConfig) {
+ return ((MethodFilterInterceptor)
actionConfig.getInterceptors().get(0).getInterceptor()).getExcludeMethodsSet();
+ }
+
}
diff --git
a/core/src/test/resources/org/apache/struts2/config/providers/struts-interceptor-multiline-params.xml
b/core/src/test/resources/org/apache/struts2/config/providers/struts-interceptor-multiline-params.xml
new file mode 100644
index 000000000..aef7364c6
--- /dev/null
+++
b/core/src/test/resources/org/apache/struts2/config/providers/struts-interceptor-multiline-params.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-->
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
+ "https://struts.apache.org/dtds/struts-6.0.dtd">
+<struts>
+ <include file="xwork-test-beans.xml" />
+ <package name="default">
+ <interceptors>
+ <interceptor name="workflow"
class="org.apache.struts2.interceptor.DefaultWorkflowInterceptor">
+ <param name="excludeMethods">
+ input,
+ back,
+ cancel
+ </param>
+ </interceptor>
+ </interceptors>
+
+ <action name="Defined" class="org.apache.struts2.SimpleAction">
+ <interceptor-ref name="workflow"/>
+ </action>
+
+ <action name="Overridden" class="org.apache.struts2.SimpleAction">
+ <interceptor-ref name="workflow">
+ <param name="excludeMethods">
+ browse,
+ list
+ </param>
+ </interceptor-ref>
+ </action>
+ </package>
+
+</struts>