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

Felix Meschberger commented on SLING-2341:
------------------------------------------

Thanks for reporting the bug and providing the patch.
                
> SlingScriptHelper#getServices() causes ClassCastException
> ---------------------------------------------------------
>
>                 Key: SLING-2341
>                 URL: https://issues.apache.org/jira/browse/SLING-2341
>             Project: Sling
>          Issue Type: Bug
>          Components: Scripting
>    Affects Versions: Scripting Core 2.0.18
>            Reporter: Julian Sedding
>            Assignee: Felix Meschberger
>             Fix For: Scripting Core 2.0.20
>
>         Attachments: SLING-2341.patch
>
>
> The implementation of ScriptHelper#getServices() creates an Object[] and 
> tries to cast it to the generics class. This results in a ClassCastException, 
> as an Object[] cannot be cast to a more specific array (i.e. ServiceType[]). 
> The solution is to create an array of the correct type and size using 
> java.util.reflect.Array#newInstance(), see discussion on stackoverflow[0].
> [0] 
> http://stackoverflow.com/questions/529085/java-how-to-generic-array-creation

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to