Return-Path: Delivered-To: apmail-maven-issues-archive@locus.apache.org Received: (qmail 67002 invoked from network); 16 Apr 2008 21:33:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Apr 2008 21:33:28 -0000 Received: (qmail 82237 invoked by uid 500); 16 Apr 2008 21:33:29 -0000 Delivered-To: apmail-maven-issues-archive@maven.apache.org Received: (qmail 81946 invoked by uid 500); 16 Apr 2008 21:33:28 -0000 Mailing-List: contact issues-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list issues@maven.apache.org Received: (qmail 81935 invoked by uid 99); 16 Apr 2008 21:33:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 14:33:28 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [63.246.2.115] (HELO codehaus01.managed.contegix.com) (63.246.2.115) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 21:32:35 +0000 Received: from codehaus01.managed.contegix.com (localhost.localdomain [127.0.0.1]) by codehaus01.managed.contegix.com (Postfix) with ESMTP id 476401620001 for ; Wed, 16 Apr 2008 16:32:55 -0500 (CDT) Message-ID: <28196886.1208381575253.JavaMail.haus-jira@codehaus01.managed.contegix.com> Date: Wed, 16 Apr 2008 16:32:55 -0500 (CDT) From: "Arnaud Heritier (JIRA)" To: issues@maven.apache.org Subject: [jira] Updated: (MECLIPSE-427) .springBeans definition throws NullPointer if BaseDir does not exist In-Reply-To: <6088018.1207767658332.JavaMail.haus-jira@codehaus01.managed.contegix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://jira.codehaus.org/browse/MECLIPSE-427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arnaud Heritier updated MECLIPSE-427: ------------------------------------- Attachment: (was: MyEclipseSpringBeansWriter.java) > .springBeans definition throws NullPointer if BaseDir does not exist > -------------------------------------------------------------------- > > Key: MECLIPSE-427 > URL: http://jira.codehaus.org/browse/MECLIPSE-427 > Project: Maven 2.x Eclipse Plugin > Issue Type: Bug > Components: MyEclipse support > Affects Versions: 2.5, 2.5.1 > Reporter: Joe Freeman > > This is related to the fix submitted for MECLIPSE-359 > We have an application with 40 eclipse projects in it. About half of them have spring beans and 1/2 don't. The top level pom describes how the eclipse plugin should function and includes the Spring configuration component for the myeclipse target. A null pointer is thrown when running eclipse:myeclipse when the base dir doesn't exist, in our case in one of the projects that doesn't have any spring components. Our pom.xml fragment looks like > > 2.0 > *.xml > src/main/resources/conf > > The exception stack trace looks like > java.lang.NullPointerException > at org.apache.maven.plugin.eclipse.writers.myeclipse.MyEclipseSpringBeansWriter.getConfigurationFilesList(MyEclipseSpringBeansWriter.java:142) > at org.apache.maven.plugin.eclipse.writers.myeclipse.MyEclipseSpringBeansWriter.write(MyEclipseSpringBeansWriter.java:93) > The following code block with the problem throws NullPointer when directory.listFiles() returns a null into subdirs. Wrap the for() loop in a nullcheck > try > { > File directory = new File( basedir ); > File[] subdirs = directory.listFiles( new FileFilter() > { > public boolean accept( File pathname ) > { > return pathname.isDirectory(); > } > } ); > for ( int i = 0; i < subdirs.length; i++ ) > { > configFiles.addAll( getConfigurationFilesList( subdirs[i].getPath(), pattern ) ); > } > configFiles.addAll( FileUtils.getFileNames( directory, pattern, null, true ) ); > } > Testing: > Take one of the test cases and remove the directory that is pointed to by the basedir attribute. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira