Program: 34965
Project: 34965
Buggy source:
@SuppressWarnings("String_Node_Str") private void write(final Map<String,Object> oDataEntryProperties,final boolean isCreate) throws ODataJPARuntimeException {
  try {
    EdmStructuralType structuralType=null;
    final List<String> keyNames=oDataEntityType.getKeyPropertyNames();
    if (isCreate) {
      jpaEntity=instantiateJPAEntity();
    }
 else     if (jpaEntity == null) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_NOT_FOUND,null);
    }
    if (accessModifiersWrite == null) {
      accessModifiersWrite=jpaEntityParser.getAccessModifiers(jpaEntity,oDataEntityType,JPAEntityParser.ACCESS_MODIFIER_SET);
    }
    if (oDataEntityType == null || oDataEntryProperties == null) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL,null);
    }
    final HashMap<String,String> embeddableKeys=jpaEntityParser.getJPAEmbeddableKeyMap(jpaEntity.getClass().getName());
    Set<String> propertyNames=null;
    if (embeddableKeys != null) {
      setEmbeddableKeyProperty(embeddableKeys,oDataEntityType.getKeyProperties(),oDataEntryProperties,jpaEntity);
      propertyNames=new HashSet<String>();
      propertyNames.addAll(oDataEntryProperties.keySet());
      for (      String key : embeddableKeys.keySet()) {
        propertyNames.remove(key);
      }
    }
 else {
      propertyNames=oDataEntryProperties.keySet();
    }
    for (    String propertyName : propertyNames) {
      EdmTyped edmTyped=(EdmTyped)oDataEntityType.getProperty(propertyName);
      Method accessModifier=null;
switch (edmTyped.getType().getKind()) {
case SIMPLE:
        if (isCreate == false) {
          if (keyNames.contains(edmTyped.getName())) {
            continue;
          }
        }
      accessModifier=accessModifiersWrite.get(propertyName);
    setProperty(accessModifier,jpaEntity,oDataEntryProperties.get(propertyName),(EdmSimpleType)edmTyped.getType());
  break;
case COMPLEX:
structuralType=(EdmStructuralType)edmTyped.getType();
accessModifier=accessModifiersWrite.get(propertyName);
setComplexProperty(accessModifier,jpaEntity,structuralType,(HashMap<String,Object>)oDataEntryProperties.get(propertyName));
break;
case NAVIGATION:
case ENTITY:
if (isCreate) {
structuralType=(EdmStructuralType)edmTyped.getType();
EdmNavigationProperty navProperty=(EdmNavigationProperty)edmTyped;
EdmEntitySet edmRelatedEntitySet=oDataEntitySet.getRelatedEntitySet(navProperty);
List<ODataEntry> relatedEntries=(List<ODataEntry>)oDataEntryProperties.get(propertyName);
if (relatedJPAEntityMap == null) {
relatedJPAEntityMap=new HashMap<String,List<Object>>();
}
List<Object> relatedJPAEntities=new ArrayList<Object>();
JPAEntity relatedEntity=new JPAEntity((EdmEntityType)structuralType,edmRelatedEntitySet,oDataJPAContext);
for (ODataEntry oDataEntry : relatedEntries) {
relatedEntity.setParentJPAEntity(this);
relatedEntity.setViaNavigationProperty(navProperty);
relatedEntity.create(oDataEntry);
if (oDataEntry.getProperties().size() == 0) {
if (!oDataEntry.getMetadata().getUri().isEmpty() && !relatedJPAEntityLink.contains(navProperty.getName())) {
relatedJPAEntityLink.add(navProperty.getName());
}
}
 else {
relatedJPAEntities.add(relatedEntity.getJPAEntity());
}
}
if (!relatedJPAEntities.isEmpty()) {
relatedJPAEntityMap.put(navProperty.getName(),relatedJPAEntities);
}
}
default :
continue;
}
}
}
 catch (Exception e) {
if (e instanceof ODataJPARuntimeException) {
throw (ODataJPARuntimeException)e;
}
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void write(final Map<String,Object> oDataEntryProperties,final boolean isCreate) throws ODataJPARuntimeException {
  try {
    EdmStructuralType structuralType=null;
    final List<String> keyNames=oDataEntityType.getKeyPropertyNames();
    if (isCreate) {
      jpaEntity=instantiateJPAEntity();
    }
 else     if (jpaEntity == null) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_NOT_FOUND,null);
    }
    if (accessModifiersWrite == null) {
      accessModifiersWrite=jpaEntityParser.getAccessModifiers(jpaEntity,oDataEntityType,JPAEntityParser.ACCESS_MODIFIER_SET);
    }
    if (oDataEntityType == null || oDataEntryProperties == null) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL,null);
    }
    final HashMap<String,String> embeddableKeys=jpaEntityParser.getJPAEmbeddableKeyMap(jpaEntity.getClass().getName());
    Set<String> propertyNames=null;
    if (embeddableKeys != null) {
      setEmbeddableKeyProperty(embeddableKeys,oDataEntityType.getKeyProperties(),oDataEntryProperties,jpaEntity);
      propertyNames=new HashSet<String>();
      propertyNames.addAll(oDataEntryProperties.keySet());
      for (      String key : embeddableKeys.keySet()) {
        propertyNames.remove(key);
      }
    }
 else {
      propertyNames=oDataEntryProperties.keySet();
    }
    for (    String propertyName : propertyNames) {
      EdmTyped edmTyped=(EdmTyped)oDataEntityType.getProperty(propertyName);
      Method accessModifier=null;
switch (edmTyped.getType().getKind()) {
case SIMPLE:
        if (isCreate == false) {
          if (keyNames.contains(edmTyped.getName())) {
            continue;
          }
        }
      accessModifier=accessModifiersWrite.get(propertyName);
    setProperty(accessModifier,jpaEntity,oDataEntryProperties.get(propertyName),(EdmSimpleType)edmTyped.getType());
  break;
case COMPLEX:
structuralType=(EdmStructuralType)edmTyped.getType();
accessModifier=accessModifiersWrite.get(propertyName);
setComplexProperty(accessModifier,jpaEntity,structuralType,(HashMap<String,Object>)oDataEntryProperties.get(propertyName));
break;
case NAVIGATION:
case ENTITY:
if (isCreate) {
structuralType=(EdmStructuralType)edmTyped.getType();
EdmNavigationProperty navProperty=(EdmNavigationProperty)edmTyped;
EdmEntitySet edmRelatedEntitySet=oDataEntitySet.getRelatedEntitySet(navProperty);
List<ODataEntry> relatedEntries=(List<ODataEntry>)oDataEntryProperties.get(propertyName);
if (relatedJPAEntityMap == null) {
relatedJPAEntityMap=new HashMap<String,List<Object>>();
}
List<Object> relatedJPAEntities=new ArrayList<Object>();
for (ODataEntry oDataEntry : relatedEntries) {
JPAEntity relatedEntity=new JPAEntity((EdmEntityType)structuralType,edmRelatedEntitySet,oDataJPAContext);
relatedEntity.setParentJPAEntity(this);
relatedEntity.setViaNavigationProperty(navProperty);
relatedEntity.create(oDataEntry);
if (oDataEntry.getProperties().size() == 0) {
if (!oDataEntry.getMetadata().getUri().isEmpty() && !relatedJPAEntityLink.contains(navProperty.getName())) {
relatedJPAEntityLink.add(navProperty.getName());
}
}
 else {
relatedJPAEntities.add(relatedEntity.getJPAEntity());
}
}
if (!relatedJPAEntities.isEmpty()) {
relatedJPAEntityMap.put(navProperty.getName(),relatedJPAEntities);
}
}
default :
continue;
}
}
}
 catch (Exception e) {
if (e instanceof ODataJPARuntimeException) {
throw (ODataJPARuntimeException)e;
}
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
}
}