jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Lombart (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1858) ClassDescriptor ReflectionUtils ClassLoader Defect
Date Mon, 17 Nov 2008 21:06:44 GMT

    [ https://issues.apache.org/jira/browse/JCR-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648335#action_12648335
] 

Christophe Lombart commented on JCR-1858:
-----------------------------------------

It should be nice to have a smaller test with less dependencies and files. Is it possible
to create patch with a unit test ? 

Thanks 

> ClassDescriptor ReflectionUtils ClassLoader Defect
> --------------------------------------------------
>
>                 Key: JCR-1858
>                 URL: https://issues.apache.org/jira/browse/JCR-1858
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-ocm
>    Affects Versions: 1.4
>         Environment: JVM 1.6.0.6/Windows XP SP2/Netbeans 6.2 Beta
>            Reporter: V. W.
>         Attachments: TestCase.zip
>
>
> I have stumbuled on a bug in the interaction between ClassDescriptor and ReflectionUtils
classes:
> 1. ClassDescriptor.validateClassName() uses ReflectionUtils.forName(String) to resolve
an annotated class by its name
> 2. ReflectionUtils is an evil stateful statics-based singleton. It has a field of a ClassLoader,
which by default is the one that loaded the ReflectionUtils. The method forName(String) uses
this ClassLoader to resolve the annotated class.
> The problem is that the ClassDescriptor assumses that the annotated class comes from
a global ClassLoader (the one that loaded the jars), which is not always correct. The workaround
is to manually set the ReflectionUtils ClassLoader field for it to use the correct ClassLoader.
> I've found this bug while working with NetBeans, writing a small Scala application and
using ScalaTest TestNG integration for testing. Apparantly many ClassLoader need to by involved
to run a single test.
> I've created a unit test (java only, libraries included) to reproduce the bug.
> The best solution would be for the ClassDescriptor to use a Class reference (the Class
contains its ClassLoader reference) instead of just a class-name or at least pair every class-name
with its ClassLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message