Return-Path: Delivered-To: apmail-abdera-dev-archive@www.apache.org Received: (qmail 75604 invoked from network); 14 Jan 2011 08:16:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Jan 2011 08:16:12 -0000 Received: (qmail 24257 invoked by uid 500); 14 Jan 2011 08:16:11 -0000 Delivered-To: apmail-abdera-dev-archive@abdera.apache.org Received: (qmail 24119 invoked by uid 500); 14 Jan 2011 08:16:08 -0000 Mailing-List: contact dev-help@abdera.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@abdera.apache.org Delivered-To: mailing list dev@abdera.apache.org Received: (qmail 24103 invoked by uid 99); 14 Jan 2011 08:16:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Jan 2011 08:16:07 +0000 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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Jan 2011 08:16:06 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p0E8FjHN010798 for ; Fri, 14 Jan 2011 08:15:46 GMT Message-ID: <11380487.364911294992945838.JavaMail.jira@thor> Date: Fri, 14 Jan 2011 03:15:45 -0500 (EST) From: "ant elder (JIRA)" To: dev@abdera.apache.org Subject: [jira] Commented: (ABDERA-279) Faulty classloading - unreachable code In-Reply-To: <13048809.258051294684191321.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/ABDERA-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981671#action_12981671 ] ant elder commented on ABDERA-279: ---------------------------------- Patch applied, thanks for the fix Antoine. Tests would be good but as the class has no other testing already it seems ok to not require them for others. I needed to get the 1.1.2 release out for a fix for another user and as it was already being voted on it would have delayed it to long to include this. I can do a 1.1.3 release to include this fix now if you need it ASAP. > Faulty classloading - unreachable code > -------------------------------------- > > Key: ABDERA-279 > URL: https://issues.apache.org/jira/browse/ABDERA-279 > Project: Abdera > Issue Type: Bug > Affects Versions: 1.1.1 > Reporter: Antoine Toulme > Attachments: fix_classloader.patch > > > The Discover class uses this method to get a class: > {code} > private static Class getClass(ClassLoader loader, String spec) { > Class c = null; > try { > c = (Class)loader.loadClass(spec); > c = (Class)(c != null ? c : getClass(Discover.class.getClassLoader(), spec)); > } catch (ClassNotFoundException e) { > throw new RuntimeException(e); > } > return c; > } > {code} > However the first line inside the try statement will throw a CNF exception if the class cannot be found. As a result, the second line is never executed. > {code} > c = (Class)(c != null ? c : getClass(Discover.class.getClassLoader(), spec)); > {code} > The code executes recursively, which makes things harder. I would recommend changing the way the code is currently written to avoid recursion. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.