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 62158

Summary: Show license dialog when user did not accept license during installation
Product: platform Reporter: mslama <mslama>
Component: -- Other --Assignee: mslama <mslama>
Status: RESOLVED FIXED    
Severity: blocker CC: apireviews
Priority: P2 Keywords: API_REVIEW_FAST
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: TASK Exception Reporter:
Bug Depends on: 62791, 62829, 62831    
Bug Blocks:    
Attachments: Diff
New files to be added
Correct original diff (for completness)
Modified new files 1
Modified diff1

Description mslama 2005-08-11 13:27:09 UTC
Task is to maake sure that user accept license if she does not use installer to
install IDE. (When user uses installer she must accept license during
installation.) This should be done per user not per user dir to avoid repeated
license dialog when the same user creates new user dir. License must be shown
very soon. As there is similar task (import of user dir) I decided to use the
same property and not to introduce another class/system property for this task.
(Of course it can be separeted completely if necessary ie. create separate
module, separate system property,...). At this moment there is only added new
method to existing netbeans.importclass.

There are 3 markers:
1.File $NBINSTALLDIR/$nbcluster.dir/var/license_accepted.
2.File $netbeans.home/var/license_accepted.
3.In user preferences node org.netbeans.core.startup.Main.class there is key   
                string "LICENSE" + "|" + [IDE (License) version] + "|" + [MD5
fingerprint of install dir]. Special key is in Bundle for [IDE (License) version].
MD5 fingerprint is used because key length in default preferences implementation
is limited to 80 characters.

How it works:
1.Installer creates file $NBINSTALLDIR/$nbcluster.dir/var/license_accepted.
2.IDE starts and looks for var/license_accepted. If it is found check passes.
3.If it is not found user preference is checked for given key. If key is found
with any value check passes.
4.If key is not found license dialog is displayed. If user does not accept
license IDE exits.
5.If user accepts license preference key is created and marker
var/license_accepted is created in user dir. (It is created to speed up check as
then only 2 is necessary to pass test. Positive check of preference key is about
4 times slower than looking for file using InstalledFileLocator. By this way
positive test takes about 100ms according to my measurement.)

UI: Simple JEditorPane and JOptionPane is used to display license (it is similar
to license dialogs used when building IDE from sources).
Comment 1 mslama 2005-08-11 13:49:32 UTC
Created attachment 23722 [details]
Diff
Comment 2 mslama 2005-08-11 13:50:51 UTC
Created attachment 23723 [details]
New files to be added
Comment 3 mslama 2005-08-11 13:55:30 UTC
Note: Currently license text is directly in module updater jar. As license will
be added to nb cluster UI will use it and it will be removed from jar.
Comment 4 Jaroslav Tulach 2005-08-16 06:46:23 UTC
Where is the change to core/startup code? I cannot find any. 
 
However I am affraid that there is small problem. If I am not mistaken, you 
are reusing netbeans.importclass and searching for method acceptLicense in it. 
This may cause problems to our partners using the property in earlier versions 
and not defining the acceptLicense there.  
 
Of course, this is just friend contract, but maybe the correct way is to add 
new property? 
 
Comment 5 mslama 2005-08-16 07:40:15 UTC
Oops I attached incorrect diff.

If there can be problem with anyone else using this friend API I will introduce
new system property 'netbeans.acceptlicenseclass'. Then it is necessary also to
modify IDE launcher to define new property. I assume it is not necessary to
create separate module for it. I just create new class. I will modify sources
and attach modified and correct diff.
Comment 6 mslama 2005-08-16 09:26:24 UTC
Created attachment 23880 [details]
Correct original diff (for completness)
Comment 7 mslama 2005-08-16 14:03:55 UTC
Created attachment 23940 [details]
Modified new files 1
Comment 8 mslama 2005-08-16 14:04:25 UTC
Created attachment 23941 [details]
Modified diff1
Comment 9 Jaroslav Tulach 2005-08-17 11:18:06 UTC
Ok. I guess. Btw. you can do cvs add and then use cvs diff -N to generate diff 
even for new files. 
Comment 10 mslama 2005-08-19 08:43:44 UTC
Today I am going to modify License dialog UI according to UI review and add some
details about logic (The same description as given above.) I am going to commit
changes on Monday.

Last undecided issue is if license text should be in jar or not. I prefer to
have license text in jar so that jar will be independent and solution will be
more robust. License text is also present in nb cluster dir to be available to
user. But if it would be deleted from nb cluster this dialog could not work.
License is now small (~15KB) so saved disk space is not issue here.
Comment 11 mslama 2005-08-22 15:21:46 UTC
Fixed in main trunk.

/cvs/core/arch/arch-core-launcher.xml
new revision: 1.31; previous revision: 1.30

/cvs/core/startup/src/org/netbeans/core/startup/Bundle.properties
new revision: 1.6; previous revision: 1.5

/cvs/core/startup/src/org/netbeans/core/startup/Main.java
new revision: 1.3; previous revision: 1.2

/cvs/core/startup/test/unit/src/org/netbeans/core/startup/NonGuiHandleCheckOfLicenseTest.java
initial revision: 1.1

/cvs/ide/branding/core/src/org/netbeans/core/startup/Bundle_nb.properties
new revision: 1.3; previous revision: 1.2

/cvs/ide/launcher/os2/netbeans.cmd
new revision: 1.11; previous revision: 1.10

/cvs/ide/launcher/unix/netbeans
new revision: 1.23; previous revision: 1.22

/cvs/ide/launcher/upgrade/build.xml
new revision: 1.2; previous revision: 1.1

/cvs/ide/launcher/upgrade/src/org/netbeans/license/AcceptLicense.java
initial revision: 1.1

/cvs/ide/launcher/upgrade/src/org/netbeans/license/Bundle.properties
initial revision: 1.1

/cvs/ide/launcher/upgrade/src/org/netbeans/license/LicensePanel.form
initial revision: 1.1

/cvs/ide/launcher/upgrade/src/org/netbeans/license/LicensePanel.java
initial revision: 1.1

/cvs/ide/launcher/windows/netbeans.cpp
new revision: 1.17; previous revision: 1.16

/cvs/ide/www/proposals/LicenseDlg.gif
new revision: 1.2; previous revision: 1.1

/cvs/ide/www/proposals/ui-spec-display-click-through-license.html
new revision: 1.2; previous revision: 1.1

/cvs/installer/lib/src/org/netbeans/installer/PostInstallFixupAction.java
new revision: 1.13; previous revision: 1.12