Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 80644 invoked from network); 29 Dec 2009 16:48:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Dec 2009 16:48:57 -0000 Received: (qmail 7048 invoked by uid 500); 29 Dec 2009 16:48:56 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 6936 invoked by uid 500); 29 Dec 2009 16:48:56 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 6926 invoked by uid 99); 29 Dec 2009 16:48:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Dec 2009 16:48:56 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI 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; Tue, 29 Dec 2009 16:48:49 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 97023234C045 for ; Tue, 29 Dec 2009 08:48:29 -0800 (PST) Message-ID: <1323856116.1262105309604.JavaMail.jira@brutus.apache.org> Date: Tue, 29 Dec 2009 16:48:29 +0000 (UTC) From: "Dennis Lundberg (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (LOGGING-22) NullPointerException in LogFactory 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/LOGGING-22?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dennis Lundberg updated LOGGING-22: ----------------------------------- Fix Version/s: 1.0.3 > NullPointerException in LogFactory > ---------------------------------- > > Key: LOGGING-22 > URL: https://issues.apache.org/jira/browse/LOGGING-22 > Project: Commons Logging > Issue Type: Bug > Affects Versions: Nightly Builds > Environment: Operating System: All > Platform: PC > Reporter: Philip Mitchell > Fix For: 1.0.3 > > > Trying to run this software on an EAServer, a NullPointerException is thrown in > two different places within LogFactory.java. I was able to trace the problem > in the source: > 1) private static LogFactory getCachedFactory(ClassLoader contextClassLoader) > { > LogFactory factory = null; > if (contextClassLoader != null) > factory = (LogFactory) factories.get(contextClassLoader); > if (factory==null) > factory = (LogFactory) factories.get(LogFactory.class.getClassLoader > ()); > return factory; > } > the factories.get(LogFactory.class.getClassLoader()) will cause a problem > because LogFactory.class.GetClassLoader() is null (using jre 1.4) changing > that part to a call to getContextClassLoader() would resolve this bug. > 2) in getFactory(): > // Fourth, try the fallback implementation class > if (factory == null) { > factory = newFactory(FACTORY_DEFAULT, > LogFactory.class.getClassLoader()); > } > same deal here, replacing LogFactory.class.getClassLoader() with contextClass > will fix. > I don't know if there was a reason these were left as > LogFactory.class.getClassLoader(), but getContextClassLoader(), will determine > if this is the correct call to make (and it states that this is only > appropriate in pre-jdk1.1), instead of just assuming it is the right call, > causing NullPointerExceptions. > Perhaps this wasn't noticed since it usually doesn't get to this fallback > position, but on the application server, it does every time. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.