Java выдает исключение: этот сайт содержится на другом сайте: "/" - PullRequest
0 голосов
/ 21 ноября 2018

У меня есть сайт обновления в моем коде Java, и обновление происходит нормально на всех платформах, таких как Windows, Linux, а также в MacOS Sierra.Но не в High sierra.

Только в High sierra выдает исключение

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

В чем может быть проблема с этой конкретной платформой?

Код:

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;
 }
}
...