mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Don't create empty file-mapping entries in .cproject file
When file language mapping is reset back to inherit, empty (without configuration, language and path attributes) file-mapping element is created in .cproject file. This leads to project corruption. Add a check for empty entry value in LanguageMappingStore#addFileMappings. 475344: Broken .cproject file after file language mapping is reset to inherit https://bugs.eclipse.org/bugs/show_bug.cgi?id=475344 Change-Id: I6e7d0b8d1199501e087ce42b75f0d8e83fca77cd Signed-off-by: Ivan Furnadjiev <ivan@eclipsesource.com>
This commit is contained in:
parent
74e4b6d504
commit
a48852f21a
1 changed files with 11 additions and 9 deletions
|
@ -270,15 +270,17 @@ public class LanguageMappingStore {
|
|||
|
||||
private void addFileMappings(Map<String, Map<String, String>> mappings, ICStorageElement rootElement) {
|
||||
for (Map.Entry<String, Map<String, String>> entry : mappings.entrySet()) {
|
||||
ICStorageElement mapping = rootElement.createChild(FILE_MAPPING);
|
||||
String path = entry.getKey();
|
||||
for (Entry<String, String> configurationEntry : entry.getValue().entrySet()) {
|
||||
String configuration = configurationEntry.getKey();
|
||||
String language = configurationEntry.getValue();
|
||||
|
||||
mapping.setAttribute(ATTRIBUTE_PATH, path);
|
||||
mapping.setAttribute(ATTRIBUTE_CONFIGURATION, configuration);
|
||||
mapping.setAttribute(ATTRIBUTE_LANGUAGE, language);
|
||||
if (!entry.getValue().isEmpty()) {
|
||||
ICStorageElement mapping = rootElement.createChild(FILE_MAPPING);
|
||||
String path = entry.getKey();
|
||||
for (Entry<String, String> configurationEntry : entry.getValue().entrySet()) {
|
||||
String configuration = configurationEntry.getKey();
|
||||
String language = configurationEntry.getValue();
|
||||
|
||||
mapping.setAttribute(ATTRIBUTE_PATH, path);
|
||||
mapping.setAttribute(ATTRIBUTE_CONFIGURATION, configuration);
|
||||
mapping.setAttribute(ATTRIBUTE_LANGUAGE, language);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue