1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 09:45:39 +02:00

[413000] intermittent RSEDOMExporter NPE

This commit is contained in:
David McKnight 2013-07-17 11:57:13 -04:00
parent 14ade17e04
commit 80a1777921
3 changed files with 39 additions and 20 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 IBM Corporation and others. * Copyright (c) 2007, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
* David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement * David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement
* David McKnight (IBM) -[413000] intermittent RSEDOMExporter NPE
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.core.model; package org.eclipse.rse.core.model;
@ -29,20 +30,26 @@ public class PropertyList extends PropertySet {
} }
public IProperty addProperty(String key, IProperty property) { public IProperty addProperty(String key, IProperty property) {
_keys.remove(key); synchronized (_keys){
_keys.add(key); _keys.remove(key);
_keys.add(key);
}
return super.addProperty(key, property); return super.addProperty(key, property);
} }
public IProperty addProperty(String key, String value) { public IProperty addProperty(String key, String value) {
_keys.remove(key); synchronized (_keys){
_keys.add(key); _keys.remove(key);
_keys.add(key);
}
return super.addProperty(key, value); return super.addProperty(key, value);
} }
public IProperty addProperty(String key, String value, IPropertyType type) { public IProperty addProperty(String key, String value, IPropertyType type) {
_keys.remove(key); synchronized (_keys){
_keys.add(key); _keys.remove(key);
_keys.add(key);
}
return super.addProperty(key, value, type); return super.addProperty(key, value, type);
} }
@ -51,13 +58,17 @@ public class PropertyList extends PropertySet {
} }
public boolean removeProperty(String key) { public boolean removeProperty(String key) {
_keys.remove(key); synchronized (_keys){
_keys.remove(key);
}
return super.removeProperty(key); return super.removeProperty(key);
} }
public void setProperties(Map map) { public void setProperties(Map map) {
_keys.clear(); synchronized (_keys){
_keys.addAll(map.keySet()); _keys.clear();
_keys.addAll(map.keySet());
}
super.setProperties(map); super.setProperties(map);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2011 IBM Corporation and others. * Copyright (c) 2006, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,6 +16,7 @@
* David McKnight (IBM) - [217715] [api] RSE property sets should support nested property sets * David McKnight (IBM) - [217715] [api] RSE property sets should support nested property sets
* David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement * David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement
* David McKnight (IBM) - [334837] Ordering of Library list entries incorrect after migration * David McKnight (IBM) - [334837] Ordering of Library list entries incorrect after migration
* David McKnight (IBM) -[413000] intermittent RSEDOMExporter NPE
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.core.model; package org.eclipse.rse.core.model;
@ -134,7 +135,9 @@ public class PropertySet extends RSEModelObject implements IPropertySet, IRSEMod
* @return The added Property * @return The added Property
*/ */
public IProperty addProperty(String key, IProperty property) { public IProperty addProperty(String key, IProperty property) {
_properties.put(key, property); synchronized (_properties){
_properties.put(key, property);
}
setDirty(true); setDirty(true);
return property; return property;
} }
@ -157,7 +160,10 @@ public class PropertySet extends RSEModelObject implements IPropertySet, IRSEMod
} }
public boolean removeProperty(String key) { public boolean removeProperty(String key) {
Object value = _properties.remove(key); Object value = null;
synchronized (_properties){
value = _properties.remove(key);
}
if (value == null) return false; if (value == null) return false;
setDirty(true); setDirty(true);
return true; return true;

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -20,6 +20,7 @@
* David Dykstal (IBM) - [189274] provide import and export operations for profiles * David Dykstal (IBM) - [189274] provide import and export operations for profiles
* David Dykstal (IBM) - [232126] persist filter type attribute * David Dykstal (IBM) - [232126] persist filter type attribute
* David McKnight (IBM) - [247011] Process subsystem disappears after restart * David McKnight (IBM) - [247011] Process subsystem disappears after restart
* David McKnight (IBM) - [413000] intermittent RSEDOMExporter NPE
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.persistence.dom; package org.eclipse.rse.internal.persistence.dom;
@ -192,12 +193,13 @@ public class RSEDOMExporter implements IRSEDOMExporter {
String[] keys = set.getPropertyKeys(); String[] keys = set.getPropertyKeys();
for (int k = 0; k < keys.length; k++) { for (int k = 0; k < keys.length; k++) {
String key = keys[k]; String key = keys[k];
String value = set.getPropertyValue(key); if (key != null){
IPropertyType type = set.getPropertyType(key); String value = set.getPropertyValue(key);
RSEDOMNode propertyNode = new RSEDOMNode(propertySetNode, IRSEDOMConstants.TYPE_PROPERTY, key); IPropertyType type = set.getPropertyType(key);
propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, type.toString()); RSEDOMNode propertyNode = new RSEDOMNode(propertySetNode, IRSEDOMConstants.TYPE_PROPERTY, key);
propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE, value); propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, type.toString());
propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE, value);
}
} }
// persist nested property sets of property set // persist nested property sets of property set
if (set instanceof IRSEModelObject){ if (set instanceof IRSEModelObject){