mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Prevent potential ArrayIndexOutOfBounds if entry isn't resolved; handle multiple entries if CDataUtil resolves the setting entry multiple times
This commit is contained in:
parent
8200badda8
commit
84e5c95821
1 changed files with 13 additions and 10 deletions
|
@ -1453,16 +1453,19 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
if (canExportedArtifactInfo()) {
|
||||
// Remove existing exported library, if it exists
|
||||
ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(this);
|
||||
ICSettingEntry lib = CDataUtil.resolveEntries(new ICSettingEntry[] {
|
||||
new CLibraryFileEntry(getArtifactName(), 0)}, des)[0];
|
||||
for (ICExternalSetting setting : des.getExternalSettings()) {
|
||||
Set<ICSettingEntry> entries = new LinkedHashSet<ICSettingEntry>(Arrays.asList(setting.getEntries()));
|
||||
if (entries.contains(lib)) {
|
||||
entries.remove(lib);
|
||||
des.removeExternalSetting(setting);
|
||||
des.createExternalSetting(setting.getCompatibleLanguageIds(), setting.getCompatibleContentTypeIds(),
|
||||
setting.getCompatibleExtensions(), entries.toArray(new ICSettingEntry[entries.size()]));
|
||||
break;
|
||||
ICSettingEntry[] libs = CDataUtil.resolveEntries(new ICSettingEntry[] {
|
||||
new CLibraryFileEntry(getArtifactName(), 0)}, des);
|
||||
if (libs.length > 0) {
|
||||
for (ICExternalSetting setting : des.getExternalSettings()) {
|
||||
Set<ICSettingEntry> entries = new LinkedHashSet<ICSettingEntry>(Arrays.asList(setting.getEntries()));
|
||||
for (ICSettingEntry lib : libs) {
|
||||
if (entries.contains(lib)) {
|
||||
entries.remove(lib);
|
||||
des.removeExternalSetting(setting);
|
||||
des.createExternalSetting(setting.getCompatibleLanguageIds(), setting.getCompatibleContentTypeIds(),
|
||||
setting.getCompatibleExtensions(), entries.toArray(new ICSettingEntry[entries.size()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue