Program: 17834
Project: 17834
Buggy source:
@SuppressWarnings("String_Node_Str") public final Object parse2JPAEntityValueMap(final Object jpaEntity,final EdmStructuralType edmEntityType,final Map<String,Object> propertyValueMap,final String entityName) throws ODataJPARuntimeException {
  if (jpaEntity == null || edmEntityType == null || propertyValueMap == null || propertyValueMap.size() == 0) {
    return null;
  }
  String jpaEntityAccessKey=jpaEntity.getClass().getName();
  if (!jpaEntityAccessMap.containsKey(jpaEntityAccessKey)) {
    jpaEntityAccessMap.put(jpaEntityAccessKey,getSetters(jpaEntity,edmEntityType,true));
  }
  HashMap<String,Method> setters=jpaEntityAccessMap.get(jpaEntityAccessKey);
  HashMap<String,String> embeddableKeys=jpaEmbeddableKeyMap.get(jpaEntityAccessKey);
  String propertyName=null;
  try {
    for (    String key : setters.keySet()) {
      EdmProperty property=(EdmProperty)edmEntityType.getProperty(key);
      if (property.getMapping() != null && property.getMapping().getInternalName() != null) {
        propertyName=property.getMapping().getInternalName();
      }
 else {
        propertyName=property.getName();
      }
      Method method=setters.get(key);
      Object propertyValue=propertyValueMap.get(key);
      if (propertyValue == null) {
        continue;
      }
      if (propertyValue instanceof java.util.GregorianCalendar) {
        propertyValue=((java.util.GregorianCalendar)propertyValue).getTime();
      }
      if (method != null) {
        if (property.getType().getKind().equals(EdmTypeKind.COMPLEX)) {
          Object complexObject=jpaComplexObjectMap.get(propertyName);
          parse2JPAEntityValueMap(complexObject,((EdmComplexType)property.getType()),(Map<String,Object>)propertyValue,propertyName);
          setters.get(key).invoke(jpaEntity,complexObject);
        }
 else {
          setters.get(key).invoke(jpaEntity,propertyValue);
        }
      }
    }
    if (embeddableKeys != null) {
      Object embeddableKeyObj=null;
      Method method=null;
      for (      String embeddableKey : embeddableKeys.keySet()) {
        String name=embeddableKeys.get(embeddableKey);
        String[] nameParts=name.split("String_Node_Str");
        Object propertyValue=jpaEntity;
        Class<?> propertyClass=null;
        try {
          for (          EntityType<?> entity : metamodel.getEntities()) {
            if (entity.getName().equals(entityName)) {
              Attribute<?,?> attribute=entity.getAttribute(nameParts[0].substring(3,4).toLowerCase() + nameParts[0].substring(4));
              propertyClass=attribute.getJavaType();
              if (embeddableKeyObj == null) {
                try {
                  embeddableKeyObj=propertyClass.newInstance();
                }
 catch (                InstantiationException e) {
                  throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
                }
              }
              break;
            }
          }
          method=propertyValue.getClass().getMethod(nameParts[0],propertyClass);
          populateEmbeddableKey(embeddableKeyObj,embeddableKey,nameParts[1],propertyValueMap);
        }
 catch (        NoSuchMethodException e) {
          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
        }
      }
      propertyName="String_Node_Str";
      method.invoke(jpaEntity,embeddableKeyObj);
    }
  }
 catch (  SecurityException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
catch (  EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
catch (  IllegalAccessException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
catch (  IllegalArgumentException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ERROR_JPQL_PARAM_VALUE.addContent(propertyName),e);
  }
catch (  InvocationTargetException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
  return jpaEntity;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public final Object parse2JPAEntityValueMap(final Object jpaEntity,final EdmStructuralType edmEntityType,final Map<String,Object> propertyValueMap,final String entityName) throws ODataJPARuntimeException {
  if (jpaEntity == null || edmEntityType == null || propertyValueMap == null || propertyValueMap.size() == 0) {
    return null;
  }
  String jpaEntityAccessKey=jpaEntity.getClass().getName();
  if (!jpaEntityAccessMap.containsKey(jpaEntityAccessKey)) {
    jpaEntityAccessMap.put(jpaEntityAccessKey,getSetters(jpaEntity,edmEntityType,true));
  }
  HashMap<String,Method> setters=jpaEntityAccessMap.get(jpaEntityAccessKey);
  HashMap<String,String> embeddableKeys=jpaEmbeddableKeyMap.get(jpaEntityAccessKey);
  String propertyName=null;
  try {
    for (    String key : setters.keySet()) {
      EdmProperty property=(EdmProperty)edmEntityType.getProperty(key);
      if (property.getMapping() != null && property.getMapping().getInternalName() != null) {
        propertyName=property.getMapping().getInternalName();
      }
 else {
        propertyName=property.getName();
      }
      Method method=setters.get(key);
      Object propertyValue=propertyValueMap.get(key);
      if (propertyValue == null) {
        continue;
      }
      if (method != null) {
        if (property.getType().getKind().equals(EdmTypeKind.COMPLEX)) {
          Object complexObject=jpaComplexObjectMap.get(propertyName);
          parse2JPAEntityValueMap(complexObject,((EdmComplexType)property.getType()),(Map<String,Object>)propertyValue,propertyName);
          setters.get(key).invoke(jpaEntity,complexObject);
        }
 else {
          setters.get(key).invoke(jpaEntity,propertyValue);
        }
      }
    }
    if (embeddableKeys != null) {
      Object embeddableKeyObj=null;
      Method method=null;
      for (      String embeddableKey : embeddableKeys.keySet()) {
        String name=embeddableKeys.get(embeddableKey);
        String[] nameParts=name.split("String_Node_Str");
        Object propertyValue=jpaEntity;
        Class<?> propertyClass=null;
        try {
          for (          EntityType<?> entity : metamodel.getEntities()) {
            if (entity.getName().equals(entityName)) {
              Attribute<?,?> attribute=entity.getAttribute(nameParts[0].substring(3,4).toLowerCase() + nameParts[0].substring(4));
              propertyClass=attribute.getJavaType();
              if (embeddableKeyObj == null) {
                try {
                  embeddableKeyObj=propertyClass.newInstance();
                }
 catch (                InstantiationException e) {
                  throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
                }
              }
              break;
            }
          }
          method=propertyValue.getClass().getMethod(nameParts[0],propertyClass);
          populateEmbeddableKey(embeddableKeyObj,embeddableKey,nameParts[1],propertyValueMap);
        }
 catch (        NoSuchMethodException e) {
          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
        }
      }
      propertyName="String_Node_Str";
      method.invoke(jpaEntity,embeddableKeyObj);
    }
  }
 catch (  SecurityException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
catch (  EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
catch (  IllegalAccessException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
catch (  IllegalArgumentException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ERROR_JPQL_PARAM_VALUE.addContent(propertyName),e);
  }
catch (  InvocationTargetException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
  return jpaEntity;
}