[192752] duplicate entries
diff --git a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java
index 685900e..d71fdcf 100644
--- a/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java
+++ b/plugins/org.eclipse.wst.common.emf/wtpemf/org/eclipse/wst/common/internal/emf/resource/EMF2DOMAdapterImpl.java
@@ -1145,6 +1145,7 @@
try {
return map.convertStringToValue(trimmedValue, emfObject);
} catch (FeatureValueConversionException ex) {
+ org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ex);
handleFeatureValueConversionException(ex);
return null;
}
@@ -1708,12 +1709,25 @@
map.clearList(mofObject);
// Go through the list of nodes and update the MOF collection
+ int addIndex = 0;
for (int i = 0; i < nodeChildren.size(); i++) {
Node child = (Node) nodeChildren.get(i);
Object attributeValue = extractValue(child, map, mofObject);
- if (attributeValue != null)
- map.setMOFValue(mofObject, attributeValue, i);
-
+ boolean advanceAddIndex = true;
+ if (attributeValue != null){
+ if(map.getFeature() != null && map.getFeature().isUnique() && mofObject.eGet(map.getFeature()) != null && ((List) mofObject.eGet(map.getFeature())).contains(attributeValue)){
+ advanceAddIndex = false;
+ String domName = map.domNameAndPath != null ? map.domNameAndPath : "attribute"; //$NON-NLS-1$
+ org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(new IllegalArgumentException("The 'no duplicates' constraint is violated by "+domName+" = "+attributeValue));
+ handleInvalidMultiNodes(child.getNodeName());
+ } else {
+ map.setMOFValue(mofObject, attributeValue, addIndex);
+ }
+ if(advanceAddIndex){
+ addIndex ++;
+ }
+ }
+
// Adapt the node so update will occur.
addDOMAdapter(child);
}