1

I have a update site in my java code and update is happening fine in all platforms like windows, linux and also in MacOS Sierra. But not in High sierra.

Only in High sierra, throws an exception

org.eclipse.core.runtime.CoreException: This site is not contained in another site: "/".

What could be the issue with this specific platform?

Code :

private IConfiguredSite getLocalSite(String fromSite) throws Exception {
  if (fromSite == null) 
      return null;

  IConfiguredSite[] configuredSites = SiteManager.getLocalSite().getCurrentConfiguration().getConfiguredSites();

  File sitePath = new File(fromSite);

  File secondaryPath = sitePath.getName().equals("eclipse") ?
                      null : new File(sitePath, "eclipse"); 

  URL siteURL = new URL(URLDecoder.decode( sitePath.toURI().toURL().toExternalForm(), "UTF-8"));

  URL secondaryURL = (secondaryPath == null) ? null : new URL(URLDecoder.decode( secondaryPath.toURI().toURL().toExternalForm(), "UTF-8")); 

  for (int i = 0; i < configuredSites.length; i++) {
      IConfiguredSite csite = configuredSites[i];

      if (UpdateManagerUtils.sameURL(csite.getSite().getURL(),siteURL))
          return csite;
      else if (secondaryPath != null && UpdateManagerUtils.sameURL(csite.getSite().getURL(),secondaryURL))
          return csite;
  }

// extension site not found, need to create one

  if (!sitePath.exists())
      sitePath.mkdirs();
  URL toSiteURL = new URL(URLDecoder.decode( sitePath.toURI().toURL().toExternalForm(), "UTF-8"));
  ISite site = SiteManager.getSite(toSiteURL, null);
  if (site == null) {
      throw new Exception(Messages.Standalone_noSite + fromSite); 
  }
  IConfiguredSite csite = site.getCurrentConfiguredSite();
  if (csite == null) {
      csite = SiteManager.getLocalSite().getCurrentConfiguration().createConfiguredSite(sitePath);
      IStatus status = csite.verifyUpdatableStatus();
      // In MacOS Sierra, the control goes in IF and in High Sierra, the control goes in ELSE
      if (status.isOK())  
          SiteManager.getLocalSite().getCurrentConfiguration()
                   .addConfiguredSite(csite);
      else 
          throw new CoreException(status);
      return csite;
  }
  return csite;
 }
}
Kavipriya
  • 441
  • 4
  • 17

0 Answers0