Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-6109

NPE from null listener in DirectoryWatcher.findListener

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • fileinstall-3.6.4
    • fileinstall-3.6.6
    • File Install
    • None

    Description

      This error shows up intermittently in an OSGI application:

       

      *ERROR* [org.osgi.service.cm.ManagedServiceFactory, id=13, bundle=6/file:/opt/ls/bundles/system/org.apache.felix.fileinstall-3.6.4.jar]: Unexpected problem updating configuration org.apache.felix.fileinstall.06a753e4-56fc-42fa-8a5b-c2b0b374581f
      
      java.lang.NullPointerException
      
       at org.apache.felix.fileinstall.internal.DirectoryWatcher.findListener(DirectoryWatcher.java:533)
      
       at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:460)
      
       at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
      
       at org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:247)
      
       at org.apache.felix.fileinstall.internal.FileInstall.updated(FileInstall.java:254)
      
       at org.apache.felix.fileinstall.internal.FileInstall$ConfigAdminSupport$Tracker.updated(FileInstall.java:378)
      
       at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159)
      
       at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93)
      
       at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1400)
      
       at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138)
      
       at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105)
      
       at java.lang.Thread.run(Thread.java:748)
      

       

       The NPE seems to imply that there is a null listener in the list of listeners here:

       

        ArtifactListener findListener(File artifact, List<ArtifactListener> listeners)
          {
              for (ArtifactListener listener : listeners) {
                  if (listener.canHandle(artifact)) {
                      return listener;
                  }
              }
              return null;
      

       

      I don't know how that situation arises (some type of race condition, given that it's unpredictable), but seems like it should be easy enough to check for and ignore.

       

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            smarquard Stephen Marquard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: