You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Guido Spadotto (JIRA)" <ji...@apache.org> on 2009/06/17 12:42:07 UTC

[jira] Issue Comment Edited: (FELIX-1235) NullPointerException due to misconfigured watched dir

    [ https://issues.apache.org/jira/browse/FELIX-1235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12720609#action_12720609 ] 

Guido Spadotto edited comment on FELIX-1235 at 6/17/09 3:40 AM:
----------------------------------------------------------------

This bug is actually a spin-off of 
http://issues.apache.org/jira/browse/FELIX-1228

For a bit of context, check:
http://www.nabble.com/Re%3A-Felix-File-Install---Spaces-in-watched-directory-name-p24000232.html

and the related mail thread.

About this line in the patch:
throw new RuntimeException( "Cannot start FileInstall to watch a non-existent directory" );
actually, you *can* start FileInstall to watch a non-existent directory.

Should be something like:
throw new RuntimeException( "Cannot start FileInstall to watch something that is not a directory" );

      was (Author: gspadotto):
    This bug is actually a spin-off of 
http://issues.apache.org/jira/browse/FELIX-1228

For a bit of context, check:
http://www.nabble.com/Re%3A-Felix-File-Install---Spaces-in-watched-directory-name-p24000232.html

and the related mail thread.
  
> 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
>
>         Attachments: FELIX-1235.txt
>
>   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.