Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 70350 invoked from network); 17 Jun 2009 09:26:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Jun 2009 09:26:19 -0000 Received: (qmail 37390 invoked by uid 500); 17 Jun 2009 09:26:30 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 37321 invoked by uid 500); 17 Jun 2009 09:26:30 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 37311 invoked by uid 99); 17 Jun 2009 09:26:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2009 09:26:30 +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.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2009 09:26:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 573D3234C044 for ; Wed, 17 Jun 2009 02:26:07 -0700 (PDT) Message-ID: <1403072567.1245230767343.JavaMail.jira@brutus> Date: Wed, 17 Jun 2009 02:26:07 -0700 (PDT) From: "Filippo Diotalevi (JIRA)" To: dev@felix.apache.org Subject: [jira] Commented: (FELIX-1235) NullPointerException due to misconfigured watched dir In-Reply-To: <1178215142.1244822527943.JavaMail.jira@brutus> 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/FELIX-1235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12720580#action_12720580 ] Filippo Diotalevi commented on FELIX-1235: ------------------------------------------ Do you get an exception if you start FileInstall watching a non-existent directory? I don't have Win machine to check, but with Linux/MacOS that's not the case; the directory is created at startup. Anyway, I spot a (quite unlikely to happen) bug. If you start FileInstall watching a "foo" directory, but "foo" is actually a file, you get into a pretty bad situation: Welcome to Felix. ================= felix.fileinstall.poll (ms) 2000 felix.fileinstall.dir /opt/myprojects/felix-1.8.0/./load felix.fileinstall.debug -1 felix.fileinstall.bundles.new.start true In main loop, we have serious trouble: java.lang.NullPointerException In main loop, we have serious trouble: java.lang.NullPointerException In main loop, we have serious trouble: java.lang.NullPointerException ...... I'll submit a patch for it, but I need to check it does not interfere with FELIX-1228 > NullPointerException due to misconfigured watched dir > ----------------------------------------------------- > > Key: FELIX-1235 > URL: https://issues.apache.org/jira/browse/FELIX-1235 > Project: Felix > Issue Type: Bug > Components: File Install > Affects Versions: fileinstall-1.0.0 > Environment: Windows [Vista|XP] > Reporter: Guido Spadotto > Fix For: fileinstall-1.2.0 > > Original Estimate: 1.5h > Remaining Estimate: 1.5h > > The "traverse" method of the DirectoryWatcher class will raise a NPE if the provided "jardir" parameter does not point to a directory. > The for loop inside that method should read: > for (int i = 0; (list!=null) && (i < list.length); i++){...} > To avoid hiding the configuration problem, the constructor of the DirectoryWatcher class could be amended like this: > ... > this.watchedDirectory = new File(dir); > > if (!this.watchedDirectory.exists()){ > if (!this.watchedDirectory.mkdirs()) { throw new RuntimeException("Failed to create directory " + this.watchedDirectory.getAbsolutePath());} > }else{ > if (this.watchedDirectory.isDirectory()){ > log(this.watchedDirectory.getAbsolutePath() + " already existing", null); > }else{ > log(this.watchedDirectory.getAbsolutePath() + " exists, but is not a directory", null); > throw new RuntimeException(this.watchedDirectory.getAbsolutePath()+" exists, but is not a directory"); > } > } > Object value = properties.get(START_NEW_BUNDLES); > ... -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.