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

Ronald Plöger commented on SLING-4339:
--------------------------------------

When I try to set "Default Parameter Encoding" in the OSGI Configuration 
"Apache Sling Request Parameter Handling" in "Adobe Experience Manager 
(6.0.0.SP1)" I get the following NullPointerException when "Temporary File 
Location" is left empty. 

{code}
21.01.2015 10:54:15.564 *ERROR* [CM Event Dispatcher (Fire ConfigurationEvent: 
pid=org.apache.sling.engine.parameters)] org.apache.sling.engine 
[org.apache.sling.engine.parameters(456)] The configure method has thrown an 
exception (java.lang.NullPointerException)
java.lang.NullPointerException: null
        at 
org.apache.sling.engine.impl.parameters.RequestParameterSupportConfigurer.getFileLocation(RequestParameterSupportConfigurer.java:132)
        at 
org.apache.sling.engine.impl.parameters.RequestParameterSupportConfigurer.configure(RequestParameterSupportConfigurer.java:108)
        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:483)
        at 
org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:231)
        at 
org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:39)
        at 
org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:624)
        at 
org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:508)
        at 
org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:149)
        at 
org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:315)
        at 
org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:127)
        at 
org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:871)
        at 
org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:838)
        at 
org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:850)
        at 
org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:648)
        at 
org.apache.felix.scr.impl.config.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:328)
        at 
org.apache.felix.scr.impl.config.ConfigurationSupport.configurationEvent(ConfigurationSupport.java:290)
        at 
org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2032)
        at 
org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2002)
        at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:103)
        at java.lang.Thread.run(Thread.java:745)
{code}

It only works when I set "Temporary File Location" to an absolute path.This is 
because "SlingSettingsService settings" is null in the following code and this 
is not checked:

{code}
    private String getFileLocation(final ComponentContext context, String 
fileLocation) {
        if (fileLocation != null) {
            File file = new File(fileLocation);
            if (!file.isAbsolute()) {
                final SlingSettingsService settings = (SlingSettingsService) 
context.locateService("SlingSettings");
                file = new File(settings.getSlingHomePath(), fileLocation);
{code}

> NullPointerException at 
> org.apache.sling.engine.impl.parameters.RequestParameterSupportConfigurer.getFileLocation(RequestParameterSupportConfigurer.java:132)
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-4339
>                 URL: https://issues.apache.org/jira/browse/SLING-4339
>             Project: Sling
>          Issue Type: Bug
>          Components: Engine
>            Reporter: Ronald Plöger
>




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

Reply via email to