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

[jira] Created: (FELIX-1203) NPE in fileinstall if a watched bundle is uninstalled by some other means

NPE in fileinstall if a watched bundle is uninstalled by some other means
-------------------------------------------------------------------------

                 Key: FELIX-1203
                 URL: https://issues.apache.org/jira/browse/FELIX-1203
             Project: Felix
          Issue Type: Bug
          Components: File Install
    Affects Versions:  fileinstall-1.0.0
         Environment: generic
            Reporter: Sahoo
             Fix For: fileinstall-1.2.0


test1.jar is part of watched dir /tmp/autodeploy-bundles/. I accidentally uninstalled test1.jar bundle using the Shell command. Next time, when I actually removed the file from the directory, fileinstall failed with the following NPE:

Jun 7, 2009 11:23:52 PM  
INFO: Failed to uninstall bundle: /tmp/autodeploy-bundles/test1.jar: java.lang.NullPointerException
Jun 7, 2009 11:23:52 PM  
INFO: java.lang.NullPointerException
Jun 7, 2009 11:23:52 PM  
INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:717)
Jun 7, 2009 11:23:52 PM  
INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:611)
Jun 7, 2009 11:23:52 PM  
INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWatcher.java:350)
Jun 7, 2009 11:23:52 PM  
INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.java:122)

I think it is OK to get the NPE, as user is expected to uninstall the bundle by removing the file unlike what I did in this case. But I am not sure. So, I am filing this bug to share my experience. The fix is pretty simple; we need to log the fact that the bundle has been uninstalled by some other means and add a null check in the code. 

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


[jira] Commented: (FELIX-1203) NPE in fileinstall if a watched bundle is uninstalled by some other means

Posted by "Sahoo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718445#action_12718445 ] 

Sahoo commented on FELIX-1203:
------------------------------

I vote for option #a.

The patch looks fine to me. Thanks.

> NPE in fileinstall if a watched bundle is uninstalled by some other means
> -------------------------------------------------------------------------
>
>                 Key: FELIX-1203
>                 URL: https://issues.apache.org/jira/browse/FELIX-1203
>             Project: Felix
>          Issue Type: Bug
>          Components: File Install
>    Affects Versions:  fileinstall-1.0.0
>         Environment: generic
>            Reporter: Sahoo
>             Fix For: fileinstall-1.2.0
>
>         Attachments: FELIX-1203.txt
>
>
> test1.jar is part of watched dir /tmp/autodeploy-bundles/. I accidentally uninstalled test1.jar bundle using the Shell command. Next time, when I actually removed the file from the directory, fileinstall failed with the following NPE:
> Jun 7, 2009 11:23:52 PM  
> INFO: Failed to uninstall bundle: /tmp/autodeploy-bundles/test1.jar: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:717)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:611)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWatcher.java:350)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.java:122)
> I think it is OK to get the NPE, as user is expected to uninstall the bundle by removing the file unlike what I did in this case. But I am not sure. So, I am filing this bug to share my experience. The fix is pretty simple; we need to log the fact that the bundle has been uninstalled by some other means and add a null check in the code. 

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


[jira] Updated: (FELIX-1203) NPE in fileinstall if a watched bundle is uninstalled by some other means

Posted by "Filippo Diotalevi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filippo Diotalevi updated FELIX-1203:
-------------------------------------

    Attachment: FELIX-1203.txt

The patch displays more meaningful logs instead of the NPE.

A question remains open though: consider the case
1) add a bundle.jar in the /load folder (watched by fileinstall) 
2) uninstall bundle.jar via console 
3) update the bundle.jar file in the /load folder (just:> touch bundle.jar f.i.) 

with the current behavior, fileinstall will try to update the bundle on every iteration, every time displaying the message "Cannot update bundle...."
Is it an acceptable solution?

Some options:
a) leave it as it is. Using fileinstall and another provisioning system is a problem anyway, so it's better to highlight this problem in the logs

b) remove bundle.jar from currentManagedBundles. In this case, fileinstall won't try to update it later, BUT it will install it in the next iteration since it will find the file in the /load folder

c) remove  bundle.jar from currentManagedBundles AND delete the file from /load (or instruct fileinstall to ignore it).

IMHO, a) it's the better solution, since b) and c) can really confuse the user. Wdyt?

> NPE in fileinstall if a watched bundle is uninstalled by some other means
> -------------------------------------------------------------------------
>
>                 Key: FELIX-1203
>                 URL: https://issues.apache.org/jira/browse/FELIX-1203
>             Project: Felix
>          Issue Type: Bug
>          Components: File Install
>    Affects Versions:  fileinstall-1.0.0
>         Environment: generic
>            Reporter: Sahoo
>             Fix For: fileinstall-1.2.0
>
>         Attachments: FELIX-1203.txt
>
>
> test1.jar is part of watched dir /tmp/autodeploy-bundles/. I accidentally uninstalled test1.jar bundle using the Shell command. Next time, when I actually removed the file from the directory, fileinstall failed with the following NPE:
> Jun 7, 2009 11:23:52 PM  
> INFO: Failed to uninstall bundle: /tmp/autodeploy-bundles/test1.jar: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:717)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:611)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWatcher.java:350)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.java:122)
> I think it is OK to get the NPE, as user is expected to uninstall the bundle by removing the file unlike what I did in this case. But I am not sure. So, I am filing this bug to share my experience. The fix is pretty simple; we need to log the fact that the bundle has been uninstalled by some other means and add a null check in the code. 

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


[jira] Resolved: (FELIX-1203) NPE in fileinstall if a watched bundle is uninstalled by some other means

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall resolved FELIX-1203.
------------------------------------

    Resolution: Fixed
      Assignee: Richard S. Hall

I have applied this patch. Please close if satisfied. Thanks!

> NPE in fileinstall if a watched bundle is uninstalled by some other means
> -------------------------------------------------------------------------
>
>                 Key: FELIX-1203
>                 URL: https://issues.apache.org/jira/browse/FELIX-1203
>             Project: Felix
>          Issue Type: Bug
>          Components: File Install
>    Affects Versions:  fileinstall-1.0.0
>         Environment: generic
>            Reporter: Sahoo
>            Assignee: Richard S. Hall
>             Fix For: fileinstall-1.2.0
>
>         Attachments: FELIX-1203.txt
>
>
> test1.jar is part of watched dir /tmp/autodeploy-bundles/. I accidentally uninstalled test1.jar bundle using the Shell command. Next time, when I actually removed the file from the directory, fileinstall failed with the following NPE:
> Jun 7, 2009 11:23:52 PM  
> INFO: Failed to uninstall bundle: /tmp/autodeploy-bundles/test1.jar: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:717)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:611)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWatcher.java:350)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.java:122)
> I think it is OK to get the NPE, as user is expected to uninstall the bundle by removing the file unlike what I did in this case. But I am not sure. So, I am filing this bug to share my experience. The fix is pretty simple; we need to log the fact that the bundle has been uninstalled by some other means and add a null check in the code. 

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


[jira] Closed: (FELIX-1203) NPE in fileinstall if a watched bundle is uninstalled by some other means

Posted by "Sahoo (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sahoo closed FELIX-1203.
------------------------


> NPE in fileinstall if a watched bundle is uninstalled by some other means
> -------------------------------------------------------------------------
>
>                 Key: FELIX-1203
>                 URL: https://issues.apache.org/jira/browse/FELIX-1203
>             Project: Felix
>          Issue Type: Bug
>          Components: File Install
>    Affects Versions:  fileinstall-1.0.0
>         Environment: generic
>            Reporter: Sahoo
>            Assignee: Richard S. Hall
>             Fix For: fileinstall-1.2.0
>
>         Attachments: FELIX-1203.txt
>
>
> test1.jar is part of watched dir /tmp/autodeploy-bundles/. I accidentally uninstalled test1.jar bundle using the Shell command. Next time, when I actually removed the file from the directory, fileinstall failed with the following NPE:
> Jun 7, 2009 11:23:52 PM  
> INFO: Failed to uninstall bundle: /tmp/autodeploy-bundles/test1.jar: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:717)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:611)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWatcher.java:350)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.java:122)
> I think it is OK to get the NPE, as user is expected to uninstall the bundle by removing the file unlike what I did in this case. But I am not sure. So, I am filing this bug to share my experience. The fix is pretty simple; we need to log the fact that the bundle has been uninstalled by some other means and add a null check in the code. 

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


[jira] Commented: (FELIX-1203) NPE in fileinstall if a watched bundle is uninstalled by some other means

Posted by "Filippo Diotalevi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718402#action_12718402 ] 

Filippo Diotalevi commented on FELIX-1203:
------------------------------------------

Generally speaking, weird things happen when you try  provision your container with FileInstall and another provisioning system.

Anyway I agree we should at least avoid the NPE and give a more expressive error message.

While looking into the code I realized that there's a very similar error case when you:
1) add a bundle.jar in the /load folder (watched by fileinstall)
2) uninstall bundle.jar via console
3) update the bundle.jar file  in the /load folder (just:> touch bundle.jar f.i.)
Similarly to the error case reported, you have 
Failed to update bundle /opt/myprojects/felix-1.8.0/load/sample.bundle-1.1.0-SNAPSHOT.jar: java.lang.NullPointerException

I'll submit a patch to avoid the NPE and give a more meaningful error message in both cases

> NPE in fileinstall if a watched bundle is uninstalled by some other means
> -------------------------------------------------------------------------
>
>                 Key: FELIX-1203
>                 URL: https://issues.apache.org/jira/browse/FELIX-1203
>             Project: Felix
>          Issue Type: Bug
>          Components: File Install
>    Affects Versions:  fileinstall-1.0.0
>         Environment: generic
>            Reporter: Sahoo
>             Fix For: fileinstall-1.2.0
>
>
> test1.jar is part of watched dir /tmp/autodeploy-bundles/. I accidentally uninstalled test1.jar bundle using the Shell command. Next time, when I actually removed the file from the directory, fileinstall failed with the following NPE:
> Jun 7, 2009 11:23:52 PM  
> INFO: Failed to uninstall bundle: /tmp/autodeploy-bundles/test1.jar: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO: java.lang.NullPointerException
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:717)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.uninstall(DirectoryWatcher.java:611)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWatcher.java:350)
> Jun 7, 2009 11:23:52 PM  
> INFO:   at org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.java:122)
> I think it is OK to get the NPE, as user is expected to uninstall the bundle by removing the file unlike what I did in this case. But I am not sure. So, I am filing this bug to share my experience. The fix is pretty simple; we need to log the fact that the bundle has been uninstalled by some other means and add a null check in the code. 

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