mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
[413000] intermittent RSEDOMExporter NPE
This commit is contained in:
parent
14ade17e04
commit
80a1777921
3 changed files with 39 additions and 20 deletions
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* 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;
|
||||
|
||||
|
@ -29,20 +30,26 @@ public class PropertyList extends PropertySet {
|
|||
}
|
||||
|
||||
public IProperty addProperty(String key, IProperty property) {
|
||||
_keys.remove(key);
|
||||
_keys.add(key);
|
||||
synchronized (_keys){
|
||||
_keys.remove(key);
|
||||
_keys.add(key);
|
||||
}
|
||||
return super.addProperty(key, property);
|
||||
}
|
||||
|
||||
public IProperty addProperty(String key, String value) {
|
||||
_keys.remove(key);
|
||||
_keys.add(key);
|
||||
synchronized (_keys){
|
||||
_keys.remove(key);
|
||||
_keys.add(key);
|
||||
}
|
||||
return super.addProperty(key, value);
|
||||
}
|
||||
|
||||
public IProperty addProperty(String key, String value, IPropertyType type) {
|
||||
_keys.remove(key);
|
||||
_keys.add(key);
|
||||
synchronized (_keys){
|
||||
_keys.remove(key);
|
||||
_keys.add(key);
|
||||
}
|
||||
return super.addProperty(key, value, type);
|
||||
}
|
||||
|
||||
|
@ -51,13 +58,17 @@ public class PropertyList extends PropertySet {
|
|||
}
|
||||
|
||||
public boolean removeProperty(String key) {
|
||||
_keys.remove(key);
|
||||
synchronized (_keys){
|
||||
_keys.remove(key);
|
||||
}
|
||||
return super.removeProperty(key);
|
||||
}
|
||||
|
||||
public void setProperties(Map map) {
|
||||
_keys.clear();
|
||||
_keys.addAll(map.keySet());
|
||||
synchronized (_keys){
|
||||
_keys.clear();
|
||||
_keys.addAll(map.keySet());
|
||||
}
|
||||
super.setProperties(map);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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 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) -[413000] intermittent RSEDOMExporter NPE
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.core.model;
|
||||
|
@ -134,7 +135,9 @@ public class PropertySet extends RSEModelObject implements IPropertySet, IRSEMod
|
|||
* @return The added Property
|
||||
*/
|
||||
public IProperty addProperty(String key, IProperty property) {
|
||||
_properties.put(key, property);
|
||||
synchronized (_properties){
|
||||
_properties.put(key, property);
|
||||
}
|
||||
setDirty(true);
|
||||
return property;
|
||||
}
|
||||
|
@ -157,7 +160,10 @@ public class PropertySet extends RSEModelObject implements IPropertySet, IRSEMod
|
|||
}
|
||||
|
||||
public boolean removeProperty(String key) {
|
||||
Object value = _properties.remove(key);
|
||||
Object value = null;
|
||||
synchronized (_properties){
|
||||
value = _properties.remove(key);
|
||||
}
|
||||
if (value == null) return false;
|
||||
setDirty(true);
|
||||
return true;
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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) - [232126] persist filter type attribute
|
||||
* David McKnight (IBM) - [247011] Process subsystem disappears after restart
|
||||
* David McKnight (IBM) - [413000] intermittent RSEDOMExporter NPE
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.persistence.dom;
|
||||
|
@ -192,12 +193,13 @@ public class RSEDOMExporter implements IRSEDOMExporter {
|
|||
String[] keys = set.getPropertyKeys();
|
||||
for (int k = 0; k < keys.length; k++) {
|
||||
String key = keys[k];
|
||||
String value = set.getPropertyValue(key);
|
||||
IPropertyType type = set.getPropertyType(key);
|
||||
RSEDOMNode propertyNode = new RSEDOMNode(propertySetNode, IRSEDOMConstants.TYPE_PROPERTY, key);
|
||||
propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, type.toString());
|
||||
propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE, value);
|
||||
|
||||
if (key != null){
|
||||
String value = set.getPropertyValue(key);
|
||||
IPropertyType type = set.getPropertyType(key);
|
||||
RSEDOMNode propertyNode = new RSEDOMNode(propertySetNode, IRSEDOMConstants.TYPE_PROPERTY, key);
|
||||
propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, type.toString());
|
||||
propertyNode.addAttribute(IRSEDOMConstants.ATTRIBUTE_VALUE, value);
|
||||
}
|
||||
}
|
||||
// persist nested property sets of property set
|
||||
if (set instanceof IRSEModelObject){
|
||||
|
|
Loading…
Add table
Reference in a new issue