This is an automated email from the ASF dual-hosted git repository.

fpapon pushed a commit to branch 1.5.x
in repository https://gitbox.apache.org/repos/asf/shiro.git


The following commit(s) were added to refs/heads/1.5.x by this push:
     new 6253e6d  [SHIRO-610] Allways create resolver for non-empty 
IniWebEnvironment
6253e6d is described below

commit 6253e6d2a9e035abf042f85c911be1e52eb54a2e
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 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 @@ 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 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 @@ 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;

Reply via email to