[SHIRO-610] Allways create resolver for non-empty IniWebEnvironment
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 13843ed..5e9974f 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 @@
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 6bef199..13e3450 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
@@ -259,20 +259,13 @@
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;