mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 18:55:38 +02:00
Bug 417852 - java.utilConcurrentModificationException in
LanguageVerifier Change-Id: I8c614c37ab1559069c0639e8c4247ec414e0f0fd Signed-off-by: Serge Beauchamp <sergebeauchamp@mac.com> Reviewed-on: https://git.eclipse.org/r/16703 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
7569b2522f
commit
dc28d7f6f8
3 changed files with 56 additions and 2 deletions
|
@ -0,0 +1,47 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013 Serge Beauchamp and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Serge Beauchamp (Freescale Semiconductor.) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui.tests.misc;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.language.WorkspaceLanguageConfiguration;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.language.LanguageVerifier;
|
||||
|
||||
/**
|
||||
* Tests for CDT Language Verifier.
|
||||
*/
|
||||
public class LanguageVerifierTests extends TestCase {
|
||||
|
||||
/**
|
||||
* This API call was throwing a java.utilConcurrentModificationException.
|
||||
* see Bug 417852
|
||||
*/
|
||||
public void testConcurrentExceptionInLanguageVerifier() throws Exception {
|
||||
|
||||
WorkspaceLanguageConfiguration config = new WorkspaceLanguageConfiguration();
|
||||
|
||||
config.addWorkspaceMapping("foo", "bar");
|
||||
config.addWorkspaceMapping("foo2", "bar2");
|
||||
|
||||
Map<String, ILanguage> availableLanguages = new HashMap<String, ILanguage>();
|
||||
|
||||
availableLanguages.put("foo", null);
|
||||
availableLanguages.put("foo3", null);
|
||||
|
||||
LanguageVerifier.removeMissingLanguages(config, availableLanguages);
|
||||
}
|
||||
}
|
|
@ -25,5 +25,6 @@ public class MiscTestSuite extends TestSuite {
|
|||
public MiscTestSuite() {
|
||||
super(MiscTestSuite.class.getName());
|
||||
addTestSuite(CDTSharedImagesTests.class);
|
||||
addTestSuite(LanguageVerifierTests.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,13 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - Initial API and implementation
|
||||
* Freescale Semiconductor - Bug 417852
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.language;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
@ -97,16 +100,19 @@ public class LanguageVerifier {
|
|||
|
||||
// Check content type mappings
|
||||
Iterator<Entry<String, String>> contentTypeMappings = config.getWorkspaceMappings().entrySet().iterator();
|
||||
List<String> removals = new ArrayList<String>();
|
||||
while (contentTypeMappings.hasNext()) {
|
||||
Entry<String, String> entry = contentTypeMappings.next();
|
||||
String contentTypeId = entry.getKey();
|
||||
String languageId = entry.getValue();
|
||||
if (!availableLanguages.containsKey(languageId)) {
|
||||
missingLanguages.add(languageId);
|
||||
config.removeWorkspaceMapping(contentTypeId);
|
||||
removals.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
for (String removal : removals) {
|
||||
config.removeWorkspaceMapping(removal);
|
||||
}
|
||||
return missingLanguages;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue