Program: 18021
Project: 18021
Buggy source:
@SuppressWarnings("String_Node_Str") public final Object parse2JPAEntityValueMap(Object jpaEntity,EdmStructuralType edmEntityType,Map<String,Object> propertyValueMap,String entityName) throws ODataJPARuntimeException {
  if (jpaEntity == null || edmEntityType == null)   return null;
  String jpaEntityAccessKey=jpaEntity.getClass().getName();
  if (!jpaEntityAccessMap.containsKey(jpaEntityAccessKey))   jpaEntityAccessMap.put(jpaEntityAccessKey,getSetters(jpaEntity,edmEntityType,entityName));
  HashMap<String,Method> setters=jpaEntityAccessMap.get(jpaEntityAccessKey);
  HashMap<String,String> embeddableKeys=jpaEmbeddableKeyMap.get(jpaEntityAccessKey);
  try {
    for (    String key : setters.keySet()) {
      EdmProperty property=(EdmProperty)edmEntityType.getProperty(key);
      String propertyName=null;
      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 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 key : embeddableKeys.keySet()) {
        String name=embeddableKeys.get(key);
        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,key,nameParts[1],propertyValueMap);
        }
 catch (        NoSuchMethodException e) {
          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
        }
      }
      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.GENERAL.addContent(e.getMessage()),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(Object jpaEntity,EdmStructuralType edmEntityType,Map<String,Object> propertyValueMap,String entityName) throws ODataJPARuntimeException {
  if (jpaEntity == null || edmEntityType == null)   return null;
  String jpaEntityAccessKey=jpaEntity.getClass().getName();
  if (!jpaEntityAccessMap.containsKey(jpaEntityAccessKey))   jpaEntityAccessMap.put(jpaEntityAccessKey,getSetters(jpaEntity,edmEntityType));
  HashMap<String,Method> setters=jpaEntityAccessMap.get(jpaEntityAccessKey);
  HashMap<String,String> embeddableKeys=jpaEmbeddableKeyMap.get(jpaEntityAccessKey);
  try {
    for (    String key : setters.keySet()) {
      EdmProperty property=(EdmProperty)edmEntityType.getProperty(key);
      String propertyName=null;
      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 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 key : embeddableKeys.keySet()) {
        String name=embeddableKeys.get(key);
        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,key,nameParts[1],propertyValueMap);
        }
 catch (        NoSuchMethodException e) {
          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
        }
      }
      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.GENERAL.addContent(e.getMessage()),e);
  }
catch (  InvocationTargetException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
  return jpaEntity;
}