This is an automated email from the ASF dual-hosted git repository.
fpapon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/master by this push:
new bffaa33 [SHIRO-610] Allways create resolver for non-empty
IniWebEnvironment
new 6c4e8f1 Merge pull request #242 from tbrugz/SHIRO-610b
bffaa33 is described below
commit bffaa33c9ec23188526d9078e3d5659ccd553a75
Author: Telmo Brugnara <[email protected]>
AuthorDate: Fri Jun 19 11:20:48 2020 -0300
[SHIRO-610] Allways create resolver for non-empty IniWebEnvironment
---
.../java/org/apache/shiro/env/DefaultEnvironment.java | 2 +-
.../org/apache/shiro/web/env/IniWebEnvironment.java | 19 ++++++-------------
2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/core/src/main/java/org/apache/shiro/env/DefaultEnvironment.java
b/core/src/main/java/org/apache/shiro/env/DefaultEnvironment.java
index 43523a0..160e58f 100644
--- a/core/src/main/java/org/apache/shiro/env/DefaultEnvironment.java
+++ b/core/src/main/java/org/apache/shiro/env/DefaultEnvironment.java
@@ -146,7 +146,7 @@ public class DefaultEnvironment implements
NamedObjectEnvironment, Destroyable {
return null;
}
if (!requiredType.isInstance(o)) {
- String msg = "Object named '" + name + "' is not of required type
[" + requiredType.getName() + "].";
+ String msg = "Object named '" + name + "' (of type [" +
o.getClass().getName() + "]) is not of required type [" +
requiredType.getName() + "].";
throw new RequiredTypeException(msg);
}
return (T)o;
diff --git a/web/src/main/java/org/apache/shiro/web/env/IniWebEnvironment.java
b/web/src/main/java/org/apache/shiro/web/env/IniWebEnvironment.java
index 9d6219e..81e9f11 100644
--- a/web/src/main/java/org/apache/shiro/web/env/IniWebEnvironment.java
+++ b/web/src/main/java/org/apache/shiro/web/env/IniWebEnvironment.java
@@ -263,20 +263,13 @@ public class IniWebEnvironment extends
ResourceBasedWebEnvironment implements In
Ini ini = getIni();
if (!CollectionUtils.isEmpty(ini)) {
- //only create a resolver if the 'filters' or 'urls' sections are
defined:
- Ini.Section urls =
ini.getSection(IniFilterChainResolverFactory.URLS);
- Ini.Section filters =
ini.getSection(IniFilterChainResolverFactory.FILTERS);
- if (!CollectionUtils.isEmpty(urls) ||
!CollectionUtils.isEmpty(filters)) {
- //either the urls section or the filters section was defined.
Go ahead and create the resolver:
-
- Factory<FilterChainResolver> factory =
(Factory<FilterChainResolver>) this.objects.get(FILTER_CHAIN_RESOLVER_NAME);
- if (factory instanceof IniFactorySupport) {
- IniFactorySupport iniFactory = (IniFactorySupport) factory;
- iniFactory.setIni(ini);
- iniFactory.setDefaults(this.objects);
- }
- resolver = factory.getInstance();
+ Factory<FilterChainResolver> factory =
(Factory<FilterChainResolver>) this.objects.get(FILTER_CHAIN_RESOLVER_NAME);
+ if (factory instanceof IniFactorySupport) {
+ IniFactorySupport iniFactory = (IniFactorySupport) factory;
+ iniFactory.setIni(ini);
+ iniFactory.setDefaults(this.objects);
}
+ resolver = factory.getInstance();
}
return resolver;