java - Java 抛出异常:此站点包含在另一个站点中:“/”
问题描述
我的 Java 代码中有一个更新站点,并且在 Windows、Linux 以及 MacOS 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;
}
}
解决方案
推荐阅读
- c - C LibHaru 参考
没有定义的 - android - 连接到任何已配对的蓝牙设备
- c - 如何制作函数的多个副本并在C中异步调用它
- loops - 使用逻辑回归运行循环
- reactjs - React Hooks: useState 给出错误: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
- go - Circleci 和 GoBuffalo 挑战
- javascript - node rsa base 128 编码在加密时给出未知的编码错误
- google-tag-manager - 在 GTM 中使用增强型电子商务数据层进行 Google Ads 转化
- powershell - 不断收到错误:“无法绑定参数'Headers'”
- pandas - 在数据框中调用列时出错