Skip to content

Commit 5c7a6bc

Browse files
committed
WW-5352 Refactor ParametersInterceptor
1 parent 19cc151 commit 5c7a6bc

File tree

5 files changed

+147
-141
lines changed

5 files changed

+147
-141
lines changed

core/src/main/java/com/opensymphony/xwork2/security/AcceptedPatternsChecker.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,37 @@ public interface AcceptedPatternsChecker {
3232
* @param value to check
3333
* @return object containing result of matched pattern and pattern itself
3434
*/
35-
public IsAccepted isAccepted(String value);
35+
IsAccepted isAccepted(String value);
3636

3737
/**
3838
* Sets excluded patterns during runtime
3939
*
4040
* @param commaDelimitedPatterns comma delimited string with patterns
4141
*/
42-
public void setAcceptedPatterns(String commaDelimitedPatterns);
42+
void setAcceptedPatterns(String commaDelimitedPatterns);
4343

4444
/**
4545
* Set excluded patterns during runtime
4646
*
4747
* @param patterns array of additional excluded patterns
4848
*/
49-
public void setAcceptedPatterns(String[] patterns);
49+
void setAcceptedPatterns(String[] patterns);
5050

5151
/**
5252
* Sets excluded patterns during runtime
5353
*
5454
* @param patterns set of additional patterns
5555
*/
56-
public void setAcceptedPatterns(Set<String> patterns);
56+
void setAcceptedPatterns(Set<String> patterns);
5757

5858
/**
5959
* Allow access list of all defined excluded patterns
6060
*
6161
* @return set of excluded patterns
6262
*/
63-
public Set<Pattern> getAcceptedPatterns();
63+
Set<Pattern> getAcceptedPatterns();
6464

65-
public final static class IsAccepted {
65+
final class IsAccepted {
6666

6767
private final boolean accepted;
6868
private final String acceptedPattern;

core/src/main/java/com/opensymphony/xwork2/security/ExcludedPatternsChecker.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,37 @@ public interface ExcludedPatternsChecker {
3232
* @param value to check
3333
* @return object containing result of matched pattern and pattern itself
3434
*/
35-
public IsExcluded isExcluded(String value);
35+
IsExcluded isExcluded(String value);
3636

3737
/**
3838
* Sets excluded patterns during runtime
3939
*
4040
* @param commaDelimitedPatterns comma delimited string with patterns
4141
*/
42-
public void setExcludedPatterns(String commaDelimitedPatterns);
42+
void setExcludedPatterns(String commaDelimitedPatterns);
4343

4444
/**
4545
* Sets excluded patterns during runtime
4646
*
4747
* @param patterns array of additional excluded patterns
4848
*/
49-
public void setExcludedPatterns(String[] patterns);
49+
void setExcludedPatterns(String[] patterns);
5050

5151
/**
5252
* Sets excluded patterns during runtime
5353
*
5454
* @param patterns set of additional patterns
5555
*/
56-
public void setExcludedPatterns(Set<String> patterns);
56+
void setExcludedPatterns(Set<String> patterns);
5757

5858
/**
5959
* Allow access list of all defined excluded patterns
6060
*
6161
* @return set of excluded patterns
6262
*/
63-
public Set<Pattern> getExcludedPatterns();
63+
Set<Pattern> getExcludedPatterns();
6464

65-
public final static class IsExcluded {
65+
final class IsExcluded {
6666

6767
private final boolean excluded;
6868
private final String excludedPattern;

core/src/main/java/org/apache/struts2/dispatcher/Parameter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
*/
1919
package org.apache.struts2.dispatcher;
2020

21-
import java.util.Objects;
22-
2321
import org.apache.commons.text.StringEscapeUtils;
2422
import org.apache.logging.log4j.LogManager;
2523
import org.apache.logging.log4j.Logger;
2624

25+
import java.util.Objects;
26+
2727
public interface Parameter {
2828

2929
String getName();
@@ -58,7 +58,7 @@ public String getName() {
5858
@Override
5959
public String getValue() {
6060
String[] values = toStringArray();
61-
return (values != null && values.length > 0) ? values[0] : null;
61+
return values.length > 0 ? values[0] : null;
6262
}
6363

6464
private String[] toStringArray() {
@@ -124,7 +124,7 @@ public String toString() {
124124

125125
class Empty implements Parameter {
126126

127-
private String name;
127+
private final String name;
128128

129129
public Empty(String name) {
130130
this.name = name;

core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInterceptor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ public class ActionMappingParametersInterceptor extends ParametersInterceptor {
7676
/**
7777
* Get the parameter map from ActionMapping associated with the provided ActionContext.
7878
*
79-
* @param ac The action context
79+
* @param actionContext The action context
8080
* @return the parameters from the action mapping in the context. If none found, returns an empty map.
8181
*/
8282
@Override
83-
protected HttpParameters retrieveParameters(ActionContext ac) {
84-
ActionMapping mapping = ac.getActionMapping();
83+
protected HttpParameters retrieveParameters(ActionContext actionContext) {
84+
ActionMapping mapping = actionContext.getActionMapping();
8585
if (mapping != null) {
8686
return HttpParameters.create(mapping.getParams()).buildNoNestedWrapping();
8787
} else {

0 commit comments

Comments
 (0)