Return-Path: Delivered-To: apmail-abdera-dev-archive@www.apache.org Received: (qmail 19070 invoked from network); 11 Jan 2011 23:11:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Jan 2011 23:11:12 -0000 Received: (qmail 23342 invoked by uid 500); 11 Jan 2011 23:11:12 -0000 Delivered-To: apmail-abdera-dev-archive@abdera.apache.org Received: (qmail 23223 invoked by uid 500); 11 Jan 2011 23:11:11 -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 23215 invoked by uid 99); 11 Jan 2011 23:11:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jan 2011 23:11:11 +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; Tue, 11 Jan 2011 23:11:10 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p0BNAme0016998 for ; Tue, 11 Jan 2011 23:10:48 GMT Message-ID: <8760403.299341294787448336.JavaMail.jira@thor> Date: Tue, 11 Jan 2011 18:10:48 -0500 (EST) From: "Antoine Toulme (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 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/ABDERA-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980417#action_12980417 ] Antoine Toulme commented on ABDERA-279: --------------------------------------- Christine, where should I place those tests ? Where should I start ? It doesn't like there are tests for this class at all and the method is private static, which makes it difficult to test. > 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.