lukaszlenart commented on code in PR #912:
URL: https://github.com/apache/struts/pull/912#discussion_r1559703694
##########
core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java:
##########
@@ -583,11 +590,10 @@ public ActionConfig getActionConfig(String namespace,
String name) {
}
// fail over to empty namespace
- if (config == null && StringUtils.isNotBlank(namespace)) {
+ if (config == null && StringUtils.isNotBlank(namespace) &&
("/".equals(namespace) || fallbackToEmptyNamespace)) {
Review Comment:
I would extract this logic into a private method to name it, something like
```java
if (config == null && shouldFallbackToEmptyNamespaces(namespace)) {
...
```
##########
core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java:
##########
@@ -459,9 +460,12 @@ protected synchronized RuntimeConfiguration
buildRuntimeConfiguration() throws C
boolean appendNamedParameters = Boolean.parseBoolean(
container.getInstance(String.class,
StrutsConstants.STRUTS_MATCHER_APPEND_NAMED_PARAMETERS)
);
+ boolean fallbackToEmptyNamespace = Boolean.parseBoolean(
+ Optional.ofNullable(container.getInstance(String.class,
StrutsConstants.STRUTS_ACTION_CONFIG_FALLBACK_TO_EMPTY_NAMESPACE)).orElse("true")
Review Comment:
Instead of this fallback I would create a new entry into
[default.properties](https://github.com/apache/struts/blob/master/core/src/main/resources/org/apache/struts2/default.properties)
with value set to `true` and document it - this will help others understand
the change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]