This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 247173 - Restart IDE plugin prevents plugins scheduled at restart from being run.
Summary: Restart IDE plugin prevents plugins scheduled at restart from being run.
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Autoupdate (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL: http://plugins.netbeans.org/plugin/42525
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-16 15:23 UTC by sproger1
Modified: 2015-04-24 15:41 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sproger1 2014-09-16 15:23:13 UTC
There is a netbeans plugin called "Restart IDE" that adds a "Restart IDE" menu option to the File menu in netbeans. This menu action somehow clears/prevents the installation of updates that have been scheduled to be run after a restart of the IDE.

What steps will reproduce the problem?
1. Install netbeans updates (do NOT check the box to automatically restart nor restart by any means other than this restart-ide plugin). The Netbeans auto-update feature will tell you that "Restart is required to complete installation".
2. Click 'File --> Restart IDE' i.e. use this plugin to do the restart after going through the download and installation of netbeans updates.
3. Notice that when the IDE is restarted, the updates do net get run at startup.

What is the expected output? What do you see instead?
When the application is restarted, netbeans should show a rectangular blue window with a progress bar informing that it is finalizing the installation of updates that were installed before the application was restarted. But, this is not the case, instead, netbeans acts like no updates were ever installed, and the user has to do it all over again, and make sure that they do not use the File --> Restart IDE option. i.e. Manually closing and restarting the IDE works(i.e. Close via the 'X' on the top-right OR File --> Exit followed by manual relaunch of the IDE results in the correct behaviour).


What version of the product are you using? On what operating system?
Netbeans 8.0, Linux, and Windows.


The Restart IDE plugin appears to perform:
    public void actionPerformed(ActionEvent e) {
        LifecycleManager.getDefault().markForRestart();
        LifecycleManager.getDefault().exit();
    }

But this is somehow incompatible with the logic in org.netbeans.modules.autoupdate.services.InstallSuportImpl.java 'doRestartLater(...)' method.


What is different between exiting via LifecycleManager.getDefault().markForRestart/exit() and manually exiting the application via File --> Exit or clicking the 'X' to close the appliction???

I don't mind overriding the RestartAction, but I don't understand what is causing the loss/removal of the scheduled updates.
Comment 1 Jiri Kovalsky 2014-10-23 15:13:51 UTC
Benno, would you be so kind and take a look at this issue? Thanks a lot!
Comment 2 markiewb 2014-10-23 19:50:08 UTC
org.openide.LifecycleManager.markForRestart()/exit() is official and stable API to restart the platform. Yes, the plugin is that simple.

The difference between this simple restart and the restart by the updater is that the updater marks several modules to be updated. This is done in
* org.netbeans.modules.autoupdate.services.InstallSupportImpl.doRestartLater(Restarter)
* org.netbeans.modules.autoupdate.services.Utilities.writeInstallLater(UpdateElementImpl,File>)

I am sorry, my plugin cannot emulate that, because I have no idea how to get the Restarter object instance to call org.netbeans.api.autoupdate.InstallSupport.doRestart(Restarter, ProgressHandle) properly.

Perhaps the original author (Jiri Rechtacek) of InstallSupportImpl can help?
Comment 3 markiewb 2015-04-24 15:41:27 UTC
@Rano-aj@netbeans.org:

Please do not update the target version! It is for the NB dev only.
Please do not update the version! It states in which version the issue has been reported first.

Reverting all your changes!