diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java index bab280e25f4..d30b08a456b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 Intel Corporation and others. + * Copyright (c) 2007, 2013 Intel Corporation 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 @@ -9,9 +9,11 @@ * Intel Corporation - Initial API and implementation * James Blackburn (Broadcom Corp.) * Baltasar Belyavsky (Texas Instruments) - bug 340219: Project metadata files are saved unnecessarily + * Serge Beauchamp (Freescale Semiconductor) - Bug 418184 - ConcurrentException in CProjectDescription *******************************************************************************/ package org.eclipse.cdt.internal.core.settings.model; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; @@ -50,7 +52,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon private final HashMap fCfgMap = new LinkedHashMap(); private boolean fIsReadOnly; private boolean fIsModified; - private HashMap fPropertiesMap; + private Map fPropertiesMap; private boolean fIsLoading; private boolean fIsApplying; private boolean fIsCreating; @@ -177,7 +179,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon (CProjectDescriptionPreferences) mngr.getProjectDescriptionWorkspacePreferences(false), false); - fPropertiesMap = new HashMap(); + fPropertiesMap = Collections.synchronizedMap(new HashMap()); } public void updateProject(IProject project) { @@ -318,8 +320,11 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon } } - @SuppressWarnings("unchecked") - HashMap cloneMap = (HashMap) base.fPropertiesMap.clone(); + // Shallow cloning the base map + Map cloneMap = Collections.synchronizedMap(new HashMap()); + synchronized(base.fPropertiesMap) { + cloneMap.putAll(base.fPropertiesMap); + } fPropertiesMap = cloneMap; }