You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Ryan Heinen (JIRA)" <ji...@apache.org> on 2012/07/14 18:48:33 UTC

[jira] [Updated] (BVAL-108) PrivilegedActions.getClassLoader(Class clazz) prefers thread context classloader over passed in type's classloader

     [ https://issues.apache.org/jira/browse/BVAL-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan Heinen updated BVAL-108:
-----------------------------

    Attachment: BVAL-108.patch

Apply using patch -p1
                
> PrivilegedActions.getClassLoader(Class clazz) prefers thread context classloader over passed in type's classloader
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: BVAL-108
>                 URL: https://issues.apache.org/jira/browse/BVAL-108
>             Project: BVal
>          Issue Type: Bug
>            Reporter: Ryan Heinen
>         Attachments: BVAL-108.patch
>
>
> The getClassLoader(Class clazz) method in PrivilegedActions.java will prefer the thread context class loader over the class loader available from the passed in type.
> This is unexpected when looking at the method, and appears to be a bug. Similar to BVAL-89 this fails in an OSGi environment. AnnotationProxyBuilder.createAnnotation uses this method to load annotations from types to be validated, and should be using the classloader of the requested type, or it will be unable to find them.
> This means that BVAL-89 is still an issue. Although that fix changed the createAnnotation method so it calls PrivilegedActions.getClassLoader, the getClassLoader is still returning the wrong class loader.
> The attached patch reverses the order of class loader retrieval in that method. If it is unable to get the class loader from the provided type, it will fall back to the thread context class loader rather than the other way around.

--
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