Program: 17903
Project: 17903
Buggy source:
private List<HashMap<?,?>> getSettersForNavigationProperties(Object jpaEntity,EdmEntitySet edmEntitySet,Map<String,Class<?>> relatedClassMap) throws ODataJPARuntimeException {
  List<HashMap<?,?>> mapList=new ArrayList<HashMap<?,?>>();
  HashMap<String,Method> setters=new HashMap<String,Method>();
  HashMap<String,EdmMultiplicity> multiplicityMap=new HashMap<String,EdmMultiplicity>();
  EdmEntityType edmEntityType=null;
  try {
    edmEntityType=edmEntitySet.getEntityType();
  }
 catch (  EdmException e2) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e2.getMessage()),e2);
  }
  try {
    for (    final String navigationPropertyName : edmEntityType.getNavigationPropertyNames()) {
      final EdmNavigationProperty navigationProperty=(EdmNavigationProperty)edmEntityType.getProperty(navigationPropertyName);
      String entityName=null;
      try {
        if (navigationProperty.getMapping() != null && navigationProperty.getMapping().getInternalName() != null) {
          entityName=navigationProperty.getMapping().getInternalName();
        }
 else {
          entityName=navigationProperty.getName();
        }
      }
 catch (      EdmException e1) {
        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e1.getMessage()),e1);
      }
      String name=getSetterName(entityName);
      Class<?> propertyClass=null;
      if (navigationProperty.getMultiplicity() == EdmMultiplicity.MANY) {
        propertyClass=List.class;
        multiplicityMap.put(entityName,EdmMultiplicity.MANY);
      }
 else {
        propertyClass=relatedClassMap.get(entityName);
        multiplicityMap.put(entityName,EdmMultiplicity.ONE);
      }
      try {
        setters.put(entityName,jpaEntity.getClass().getDeclaredMethod(name,propertyClass));
      }
 catch (      NoSuchMethodException e) {
        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
      }
catch (      SecurityException e) {
        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
      }
    }
  }
 catch (  EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
  mapList.add(0,setters);
  mapList.add(1,multiplicityMap);
  return mapList;
}

Fixed version (ground truth):
private List<HashMap<?,?>> getSettersForNavigationProperties(Object jpaEntity,EdmEntitySet edmEntitySet,Map<String,Class<?>> relatedClassMap) throws ODataJPARuntimeException {
  List<HashMap<?,?>> mapList=new ArrayList<HashMap<?,?>>();
  HashMap<String,Method> setters=new HashMap<String,Method>();
  HashMap<String,EdmMultiplicity> multiplicityMap=new HashMap<String,EdmMultiplicity>();
  EdmEntityType edmEntityType=null;
  try {
    edmEntityType=edmEntitySet.getEntityType();
  }
 catch (  EdmException e2) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e2.getMessage()),e2);
  }
  try {
    for (    final String navigationPropertyName : edmEntityType.getNavigationPropertyNames()) {
      final EdmNavigationProperty navigationProperty=(EdmNavigationProperty)edmEntityType.getProperty(navigationPropertyName);
      String entityName=null;
      try {
        if (navigationProperty.getMapping() != null && navigationProperty.getMapping().getInternalName() != null) {
          entityName=navigationProperty.getMapping().getInternalName();
        }
 else {
          entityName=navigationProperty.getName();
        }
      }
 catch (      EdmException e1) {
        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e1.getMessage()),e1);
      }
      String name=getSetterName(entityName);
      Class<?> propertyClass=null;
      if (navigationProperty.getMultiplicity() == EdmMultiplicity.MANY) {
        propertyClass=List.class;
        multiplicityMap.put(entityName,EdmMultiplicity.MANY);
      }
 else {
        propertyClass=relatedClassMap.get(entityName);
        if (propertyClass == null)         continue;
        multiplicityMap.put(entityName,EdmMultiplicity.ONE);
      }
      try {
        setters.put(entityName,jpaEntity.getClass().getDeclaredMethod(name,propertyClass));
      }
 catch (      NoSuchMethodException e) {
        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
      }
catch (      SecurityException e) {
        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
      }
    }
  }
 catch (  EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()),e);
  }
  mapList.add(0,setters);
  mapList.add(1,multiplicityMap);
  return mapList;
}