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

ASF GitHub Bot commented on SLING-5070:
---------------------------------------

GitHub user Buuhuu opened a pull request:

    https://github.com/apache/sling/pull/102

    SLING-5070

    As workaround for SLING-5068 we set the cache size of SlingServletResolver 
to 0 to prevent it from caching servlets. We mentioned that there is a NPE 
thrown by the MBean implementation because the cache member field is null. This 
fixes the problem by not registering the MBean when the cache size is 0.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Buuhuu/sling trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/sling/pull/102.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #102
    
----
commit aee84f800124fda2b3de374070ba92ccbf905294
Author: Dirk Rudolph <[email protected]>
Date:   2015-09-04T15:03:03Z

    Merge pull request #1 from apache/trunk
    
    Sync Fork

commit f7825f1481b1fbdad6d2863617f9679e8595c844
Author: Dirk Rudolph <[email protected]>
Date:   2015-09-28T15:23:07Z

    SLING-5070: check the cacheSize before registering the 
SlingServletResolverMBean and register it only when there is a cache present.

----


> ServletResolverCacheMBeanImpl throws NPE when cache is diabled
> --------------------------------------------------------------
>
>                 Key: SLING-5070
>                 URL: https://issues.apache.org/jira/browse/SLING-5070
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets Resolver 2.3.6
>            Reporter: Dirk Rudolph
>            Priority: Minor
>
> When setting the cache size configuration of SlingServletResolver to a value 
> < 5 the cache will be disabled and therefor the member will be null. This 
> causes a NPE in the MBean. So either the MBean is able to handle this or it 
> will not be registered in that case.
> {code}
> Caused by: java.lang.NullPointerException: null
>         at 
> org.apache.sling.servlets.resolver.internal.SlingServletResolver$ServletResolverCacheMBeanImpl.getCacheSize(SlingServletResolver.java:1383)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
>         at 
> com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
>         at 
> com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
>         at 
> com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
>         at 
> com.sun.jmx.mbeanserver.PerInterface.getAttribute(PerInterface.java:83)
>         at 
> com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(MBeanSupport.java:206)
>         at javax.management.StandardMBean.getAttribute(StandardMBean.java:372)
>         at 
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
>         ... 67 common frames omitted
> {code}



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

Reply via email to