JDK-7141410 : DT: need way to validate setup
  • Type: Bug
  • Component: deploy
  • Sub-Component: deployment_toolkit
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-01-31
  • Updated: 2013-09-12
  • Resolved: 2012-02-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u4Fixed 8 b27Fixed
Description
Older JRE/FX installers may cause registry corruption that will prevent us from sucessfully starting applet/JavaFX app.

One common case is that browser actually loads latest DT native plugin but will load older java plugin later on.
If DT can not detect this case then user will end up watching endless spinning wheel and will not see any error messages.

We should be able to 
  a) check whether java plugin registration is correct
  b) initiate correction procedure 
from inside DT plugin.

Possible API to be used from Javascript:
  a) int validateJavaPlugin();
     Returns 0 if current JavaPlugin is correctly registered
             1 if registration is wrong and we can NOT fix in place
             2 if registration is wrong and user can try fix in place
             (may also consider different substatus for UAC on check)

     It is sufficient to validate plugin for current browser only.

  b) int fixJavaPlugin()
     Attempts to fix registry problems. 
     Returns 0 on success, >0 on error
     (if we can get detailed error codes (e.g. no permissions vs generic failure) it will be great)

Pseuse code for usage

function recover(doLaunchFunc) {
     var r = dtplugin.fixJavaPlugin();
     if (r != 0) {
        //can we guess what is latest version here? JavaFX or JRE? version string?
        //this will help to have more accurate message
        showMessage("Failed to recover registry. Please reinstall JRE");
     } else {
        //success =>start
        doLaunchFunc();
     }
}

function validateAndRecover(onSuccessFunc) {
   var r = dtplugin.validateJavaPlugin();
   if (r == 0) {
      onSuccessFunc(); //launch
      return;
   } if (r != 2) {
      showMessage("Your Java setup is corrupt. <a onclick="recover(onSuccessFunc)">Click here to try to recover</a>.);
      return;
   } else if (r == 1) {
      showMessage("Please reinstall JRE/JavaFX");
      return;
   }
}

Implementation notes.

1. In IE we need to at least check that 
     a) dll will be really loaded from latest deploy home for generic CLSID/latest CLSID and applet tag

2. In FF 
     a) only one java plugin registered
     b) registered dll comes from latest deploy home
     c) no dlls (old or new plugin) in plugins folder

3. To recover we can run 
    ssvagent -register
   from latest deploy home
   and wait for it to complete. Then repeat the validation check

4. We should only offer to recover if DT version is NO HIGHER than latest deploy version.
   May want to ignore last part of the version (FX or not) but in general it will be bad idea 
   if older DT will try to call into newer JRE bits

Comments
EVALUATION Implemented the following new DT APIs validateSetup() fixSetup() They are not intended for external use at this point. So changes to dt javascript (dtjava.js) isn't required for now.
21-02-2012