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 218162 - Uninstallation of Java ME SDK does not remove the platform from NetBeans.
Summary: Uninstallation of Java ME SDK does not remove the platform from NetBeans.
Status: CLOSED FIXED
Alias: None
Product: javame
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.1.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: David Strupl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-11 23:02 UTC by sungmoonc
Modified: 2014-05-14 18:10 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Java Platform Manager after the uninstallation of Java ME SDK 3.2. It is still there. (70.82 KB, image/png)
2012-09-11 23:02 UTC, sungmoonc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sungmoonc 2012-09-11 23:02:09 UTC
Created attachment 124189 [details]
Java Platform Manager after the uninstallation of Java ME SDK 3.2. It is still there.

When I install ME SDK, it registers itself as a Java ME platform on NetBeans. However,  when I uninstall Java ME SDK, it does not remove itself from the platform list.

This must be fixed to prevent confusions and potential bugs.

Here are steps to reproduce.
1. Close NetBeans
2. Click "Uninstall Java ME SDK" from the Windows start menu
3. Check "Remove the user directory" and finish the uninstallation
4. Launch NetBeans
5. Remove Java ME SDK tools from the plug-in menu
6. Restart NetBeans
7. Go to Java Platform Manager, then you see that "Oracle Java ME SDK 3.2" is still in the J2ME platform list
Comment 1 Petr Somol 2012-11-27 11:49:41 UTC
The problem here was that NB did not recognize the incompletely deleted platform as invalid and did not inform users in any way.

The standard way of dealing with externally deleted or damaged platforms in NB is to mark the platform in Platform Manager as faulty and to mark each project in which the platform is selected as faulty, usually by red text color. NB generally does not remove platform definitions automatically as this would be prone to negative consequences (a faulty platform might be easy to fix so automatic removal in NB could be premature; also, there is no way to ensure that it is removed automatically from all projects where it might be in use as some such projects may be closed + it may not be clear by which platform should this one be replaced in projects, etc.). The default NB behavior on opening of a project using invalid platform is to display a warning dialog, possibly offering a Repair button that helps with resolving the problem.

the following changeset fixes NB behavior in this sense:
http://hg.netbeans.org/jet-main/rev/77c94d110450

Now the validity of mobile Java platform is verified not only by existence of its root directory but also by existence of selected essential tools. More thorough validity check would be possible but would be quite expensive with the negative consequence on UI response times.
Comment 2 alexander.burdukov 2012-11-27 14:48:41 UTC
ME SDK tools automatically registers ME SDK in Java Platforms after plugins installation if this instance of ME SDK is not registered yet.

In fact, we want to remove ME SDK from Java Platforms automatically when ME SDK plugins are uninstalled. This should be done on ME SDK plugins side.
However, to do it we need some hook in NB so NB can notifies our plugins when plugins are going to be uninstalled so we can perform some cleanup work.

If it is not possible, please, move this issue back to resolved state.
Comment 3 Quality Engineering 2012-11-28 02:35:54 UTC
Integrated into 'main-golden', will be available in build *201211280002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/77c94d110450
User: Petr Somol <psomol@netbeans.org>
Log: #218162 - Uninstallation of Java ME SDK does not remove the platform from NetBeans.
Comment 4 David Strupl 2013-04-09 11:23:00 UTC
Assigning to the new owner of javame modules.
Comment 5 David Strupl 2013-04-09 12:56:06 UTC
Ooops, re-assigning back.
Comment 6 Tomas Zezula 2013-04-24 08:18:20 UTC
The NB notifies the module when the module is disabled by calling ModuleInstall.uninstalled().
Comment 7 Petr Somol 2013-04-24 08:30:53 UTC
In view of Comment #2 and Comment #6 I am reassigning to Alexander to consider if ME team intends to take use of plugin uninstall notification to implement cleanup on ME SDK side.
Comment 8 alexander.burdukov 2013-12-19 20:14:16 UTC
ModuleInstall.uninstalled() does not work in our case.
Uninstallation of our modules requires NetBeans restart and this notification is never passed to our plugin.

Moreover, from javadoc for this method we cannot even rely on this notification:

<quote>
Beware: in practice there is no way to ensure that this method will really be called. The module might simply be deleted or disabled while the application is not running. In fact this is always the case in NetBeans 6.0; the Plugin Manager only uninstalls or disables modules between restarts. This method will still be called if you reload a module during development.
</quote>

David, could you re-assign this RFE to someone on NetBeans side.

Thanks,
  Alex.
Comment 9 David Strupl 2013-12-19 20:26:39 UTC
Alexander,
can you use ModuleInstall.close() to detect whether the SDK has been removed during the shutdown? If the SDK is being uninstalled you can remove the platform - can you give this a try?

Thanks,

David
Comment 10 David Strupl 2013-12-20 09:57:25 UTC
Hello,

we were discussing with Roman what the best approach should be and agreed that the IDE should behave consistently across all the platforms. With Java SE when you uninstall the JDK that your registered platform points to the platform stays in the list but is marked as "broken". The same is currently true for Java ME SDK. We think this is enough for the user to be informed about the state of the platform. I am closing the report as fixed as I think the change done by Petr fixed the problem.

I think it would be bad to check on every exit that some folders exist. It would be just adding useless overhead when shutting down.

Br,

David
Comment 11 alexander.burdukov 2014-05-14 18:10:46 UTC
It seems ModeulInstall.close() does not work for us. At least I could not find a way to check if module was removed in this method. 
However, I'm OK with last comment to keep the current behavior for consistency.