Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 89282 invoked from network); 15 Nov 2008 19:20:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Nov 2008 19:20:14 -0000 Received: (qmail 38014 invoked by uid 500); 15 Nov 2008 19:20:21 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 37980 invoked by uid 500); 15 Nov 2008 19:20:20 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 37966 invoked by uid 99); 15 Nov 2008 19:20:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Nov 2008 11:20:20 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Nov 2008 19:19:08 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9B452234C282 for ; Sat, 15 Nov 2008 11:19:47 -0800 (PST) Message-ID: <1474824770.1226776787634.JavaMail.jira@brutus> Date: Sat, 15 Nov 2008 11:19:47 -0800 (PST) From: "V. W. (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Updated: (JCR-1858) ClassDescriptor ReflectionUtils ClassLoader Defect In-Reply-To: <888197760.1226776670483.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JCR-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] V. W. updated JCR-1858: ----------------------- Attachment: TestCase.zip A unit test to reproduce the bug. > 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.