felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guido Spadotto (JIRA)" <j...@apache.org>
Subject [jira] Created: (FELIX-1251) Looping NullPointerException if the polled directory is removed after File Install registration
Date Wed, 17 Jun 2009 22:37:07 GMT
Looping NullPointerException if the polled directory is removed after File Install registration
-----------------------------------------------------------------------------------------------

                 Key: FELIX-1251
                 URL: https://issues.apache.org/jira/browse/FELIX-1251
             Project: Felix
          Issue Type: Bug
          Components: File Install
    Affects Versions:  fileinstall-1.0.0
            Reporter: Guido Spadotto
            Priority: Minor


If the directory being polled by File Install is removed while File Install is running, 
the method DirectoryWatcher.traverse will raise a NullPointerException
when evaluating the condition for its "for" loop (the "list" variable  will be null).

This is a possible workaround:

void traverse(Map/* <String, Jar> */ jars, Set configs, File jardir)
    {
        String list[] = jardir.list();
        if (list==null){
            ConcurrentModificationException cme = new ConcurrentModificationException("Unable
to list "
                    +this.watchedDirectory+ " contents. Has it been removed after " +
                    "File Install started?");
            throw cme;
        }
        for (int i = 0; (list!=null) && i < list.length; i++)
        {
        ...

This will not stop the outer loop from logging the Exception though, 
which might not be convenient for the end user.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message