[ 
https://issues.apache.org/jira/browse/SHIRO-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14950144#comment-14950144
 ] 

Andreas Kohn commented on SHIRO-513:
------------------------------------

No, that would not be correct: The code following that check depends on the 
environment being a _Mutable_WebEnvironment.

I think the other way around would be fine: 
{code}
   Class<?> clazz = determineWebEnvironmentClass(sc);
        if (!MutableWebEnvironment.class.isAssignableFrom(clazz)) {
            throw new ConfigurationException("Custom WebEnvironment class [" + 
clazz.getName() +
                    "] is not of required type [" + 
MutableWebEnvironment.class.getName() + "]");
        }
{code}

> Misleading error message when using custom WebEnvironment
> ---------------------------------------------------------
>
>                 Key: SHIRO-513
>                 URL: https://issues.apache.org/jira/browse/SHIRO-513
>             Project: Shiro
>          Issue Type: Bug
>          Components: Web
>    Affects Versions: 1.2.3
>            Reporter: Andreas Kohn
>            Priority: Trivial
>
> Found while reading the code in EnvironmentLoader#createEnvironment():
> {code}
>         Class<?> clazz = determineWebEnvironmentClass(sc);
>         if (!MutableWebEnvironment.class.isAssignableFrom(clazz)) {
>             throw new ConfigurationException("Custom WebEnvironment class [" 
> + clazz.getName() +
>                     "] is not of required type [" + 
> WebEnvironment.class.getName() + "]");
>         }
> {code}
> The message says you need a WebEnvironment, the check (and later code) 
> however requires _Mutable_WebEnvironment.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to