mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 05:45:58 +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()) {
|
if (canExportedArtifactInfo()) {
|
||||||
// Remove existing exported library, if it exists
|
// Remove existing exported library, if it exists
|
||||||
ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(this);
|
ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(this);
|
||||||
ICSettingEntry lib = CDataUtil.resolveEntries(new ICSettingEntry[] {
|
ICSettingEntry[] libs = CDataUtil.resolveEntries(new ICSettingEntry[] {
|
||||||
new CLibraryFileEntry(getArtifactName(), 0)}, des)[0];
|
new CLibraryFileEntry(getArtifactName(), 0)}, des);
|
||||||
for (ICExternalSetting setting : des.getExternalSettings()) {
|
if (libs.length > 0) {
|
||||||
Set<ICSettingEntry> entries = new LinkedHashSet<ICSettingEntry>(Arrays.asList(setting.getEntries()));
|
for (ICExternalSetting setting : des.getExternalSettings()) {
|
||||||
if (entries.contains(lib)) {
|
Set<ICSettingEntry> entries = new LinkedHashSet<ICSettingEntry>(Arrays.asList(setting.getEntries()));
|
||||||
entries.remove(lib);
|
for (ICSettingEntry lib : libs) {
|
||||||
des.removeExternalSetting(setting);
|
if (entries.contains(lib)) {
|
||||||
des.createExternalSetting(setting.getCompatibleLanguageIds(), setting.getCompatibleContentTypeIds(),
|
entries.remove(lib);
|
||||||
setting.getCompatibleExtensions(), entries.toArray(new ICSettingEntry[entries.size()]));
|
des.removeExternalSetting(setting);
|
||||||
break;
|
des.createExternalSetting(setting.getCompatibleLanguageIds(), setting.getCompatibleContentTypeIds(),
|
||||||
|
setting.getCompatibleExtensions(), entries.toArray(new ICSettingEntry[entries.size()]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue