jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Moved: (OCM-6) ClassDescriptor ReflectionUtils ClassLoader Defect
Date Mon, 27 Apr 2009 15:02:33 GMT

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

Jukka Zitting moved JCR-1858 to OCM-6:

          Component/s:     (was: jackrabbit-ocm)
    Affects Version/s:     (was: 1.4)
             Workflow: no-reopen-closed, patch-avail  (was: jira)
                  Key: OCM-6  (was: JCR-1858)
              Project: Jackrabbit OCM  (was: Jackrabbit Content Repository)

> ClassDescriptor ReflectionUtils ClassLoader Defect
> --------------------------------------------------
>                 Key: OCM-6
>                 URL: https://issues.apache.org/jira/browse/OCM-6
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>         Environment: JVM 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
> 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.

View raw message