use of com.intellij.diagnostic.PluginException in project intellij-community by JetBrains.
the class IdeaPluginDescriptorImpl method readExternal.
// used in upsource
protected void readExternal(@NotNull Element element) {
final PluginBean pluginBean = XmlSerializer.deserialize(element, PluginBean.class);
url = pluginBean.url;
myName = pluginBean.name;
String idString = pluginBean.id;
if (idString == null || idString.isEmpty()) {
idString = myName;
}
myId = idString == null ? null : PluginId.getId(idString);
String internalVersionString = pluginBean.formatVersion;
if (internalVersionString != null) {
try {
//noinspection ResultOfMethodCallIgnored
Integer.parseInt(internalVersionString);
} catch (NumberFormatException e) {
LOG.error(new PluginException("Invalid value in plugin.xml format version: '" + internalVersionString + "'", e, myId));
}
}
myUseIdeaClassLoader = pluginBean.useIdeaClassLoader;
myAllowBundledUpdate = pluginBean.allowBundledUpdate;
if (pluginBean.ideaVersion != null) {
mySinceBuild = pluginBean.ideaVersion.sinceBuild;
myUntilBuild = convertExplicitBigNumberInUntilBuildToStar(pluginBean.ideaVersion.untilBuild);
}
myResourceBundleBaseName = pluginBean.resourceBundle;
myDescriptionChildText = pluginBean.description;
myChangeNotes = pluginBean.changeNotes;
myVersion = pluginBean.pluginVersion;
if (myVersion == null) {
myVersion = PluginManagerCore.getBuildNumber().asStringWithoutProductCode();
}
myCategory = pluginBean.category;
if (pluginBean.vendor != null) {
myVendor = pluginBean.vendor.name;
myVendorEmail = pluginBean.vendor.email;
myVendorUrl = pluginBean.vendor.url;
myVendorLogoPath = pluginBean.vendor.logo;
}
// preserve items order as specified in xml (filterBadPlugins will not fail if module comes first)
Set<PluginId> dependentPlugins = new LinkedHashSet<>();
Set<PluginId> optionalDependentPlugins = new LinkedHashSet<>();
if (pluginBean.dependencies != null) {
myOptionalConfigs = new THashMap<>();
for (PluginDependency dependency : pluginBean.dependencies) {
String text = dependency.pluginId;
if (!StringUtil.isEmpty(text)) {
PluginId id = PluginId.getId(text);
dependentPlugins.add(id);
if (dependency.optional) {
optionalDependentPlugins.add(id);
if (!StringUtil.isEmpty(dependency.configFile)) {
myOptionalConfigs.put(id, dependency.configFile);
}
}
}
}
}
myDependencies = dependentPlugins.isEmpty() ? PluginId.EMPTY_ARRAY : dependentPlugins.toArray(new PluginId[dependentPlugins.size()]);
myOptionalDependencies = optionalDependentPlugins.isEmpty() ? PluginId.EMPTY_ARRAY : optionalDependentPlugins.toArray(new PluginId[optionalDependentPlugins.size()]);
if (pluginBean.helpSets == null || pluginBean.helpSets.length == 0) {
myHelpSets = HelpSetPath.EMPTY;
} else {
myHelpSets = new HelpSetPath[pluginBean.helpSets.length];
PluginHelpSet[] sets = pluginBean.helpSets;
for (int i = 0, n = sets.length; i < n; i++) {
PluginHelpSet pluginHelpSet = sets[i];
myHelpSets[i] = new HelpSetPath(pluginHelpSet.file, pluginHelpSet.path);
}
}
myAppComponents = pluginBean.applicationComponents;
myProjectComponents = pluginBean.projectComponents;
myModuleComponents = pluginBean.moduleComponents;
if (myAppComponents == null)
myAppComponents = ComponentConfig.EMPTY_ARRAY;
if (myProjectComponents == null)
myProjectComponents = ComponentConfig.EMPTY_ARRAY;
if (myModuleComponents == null)
myModuleComponents = ComponentConfig.EMPTY_ARRAY;
StringInterner interner = new StringInterner();
List<Element> extensions = copyElements(pluginBean.extensions, interner);
if (extensions != null) {
myExtensions = MultiMap.createSmart();
for (Element extension : extensions) {
myExtensions.putValue(ExtensionsAreaImpl.extractEPName(extension), extension);
}
}
List<Element> extensionPoints = copyElements(pluginBean.extensionPoints, interner);
if (extensionPoints != null) {
myExtensionsPoints = MultiMap.createSmart();
for (Element extensionPoint : extensionPoints) {
myExtensionsPoints.putValue(StringUtil.notNullize(extensionPoint.getAttributeValue(ExtensionsAreaImpl.ATTRIBUTE_AREA)), extensionPoint);
}
}
myActionsElements = copyElements(pluginBean.actions, interner);
if (pluginBean.modules != null && !pluginBean.modules.isEmpty()) {
myModules = pluginBean.modules;
}
}
Aggregations