Program: 91676
Project: 91676
Buggy source:
/** 
 * Lookups objects which are approximatively equal to the specified object. The default implementation tries to instantiate some   {@linkplain AbstractIdentifiedObject identified objects}from the authority factory specified at construction time, in the following order: <ul> <li>If the specified object contains   {@linkplain AbstractIdentifiedObject#getIdentifiers() identifiers}associated to the same authority than the factory, then those identifiers are used for  {@linkplain GeodeticAuthorityFactory#createObject(String) creating objects} to be tested.</li><li>If the authority factory can create objects from their  {@linkplain AbstractIdentifiedObject#getName() name}in addition of identifiers, then the name and   {@linkplain AbstractIdentifiedObject#getAlias() aliases} areused for creating objects to be tested.</li> <li>If a full scan of the dataset is allowed, then full  {@linkplain #getCodeCandidates set of candidate codes}is used for creating objects to be tested.</li> </ul> The created objects which are equal to the specified object in the the sense of   {@link ComparisonMode#APPROXIMATIVE} are returned.
 * @param object  the object looked up.
 * @return the identified objects, or an empty set if not found.
 * @throws FactoryException if an error occurred while creating an object.
 */
public Set<IdentifiedObject> find(final IdentifiedObject object) throws FactoryException {
  ArgumentChecks.ensureNonNull("String_Node_Str",object);
  Set<IdentifiedObject> result=getFromCache(object);
  if (result == null) {
    final AuthorityFactoryProxy<?> previous=proxy;
    proxy=AuthorityFactoryProxy.getInstance(object.getClass());
    try {
      if (!ignoreIdentifiers) {
        IdentifiedObject candidate=createFromIdentifiers(object);
        if (candidate != null) {
          return Collections.singleton(candidate);
        }
        candidate=createFromNames(object);
        if (candidate != null) {
          return Collections.singleton(candidate);
        }
      }
      if (domain == Domain.DECLARATION) {
        return Collections.emptySet();
      }
      result=createFromCodes(object);
    }
  finally {
      proxy=previous;
    }
    result=cache(object,result);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Lookups objects which are approximatively equal to the specified object. The default implementation tries to instantiate some   {@linkplain AbstractIdentifiedObject identified objects}from the authority factory specified at construction time, in the following order: <ul> <li>If the specified object contains   {@linkplain AbstractIdentifiedObject#getIdentifiers() identifiers}associated to the same authority than the factory, then those identifiers are used for  {@linkplain GeodeticAuthorityFactory#createObject(String) creating objects} to be tested.</li><li>If the authority factory can create objects from their  {@linkplain AbstractIdentifiedObject#getName() name}in addition of identifiers, then the name and   {@linkplain AbstractIdentifiedObject#getAlias() aliases} areused for creating objects to be tested.</li> <li>If a full scan of the dataset is allowed, then full  {@linkplain #getCodeCandidates set of candidate codes}is used for creating objects to be tested.</li> </ul> The created objects which are equal to the specified object in the the sense of   {@link ComparisonMode#APPROXIMATIVE} are returned.
 * @param object  the object looked up.
 * @return the identified objects, or an empty set if not found.
 * @throws FactoryException if an error occurred while creating an object.
 */
public Set<IdentifiedObject> find(final IdentifiedObject object) throws FactoryException {
  ArgumentChecks.ensureNonNull("String_Node_Str",object);
  Set<IdentifiedObject> result=getFromCache(object);
  if (result == null) {
    final AuthorityFactoryProxy<?> previous=proxy;
    proxy=AuthorityFactoryProxy.getInstance(object.getClass());
    try {
      if (!ignoreIdentifiers && !ignoreAxes) {
        IdentifiedObject candidate=createFromIdentifiers(object);
        if (candidate != null) {
          return Collections.singleton(candidate);
        }
        candidate=createFromNames(object);
        if (candidate != null) {
          return Collections.singleton(candidate);
        }
      }
      if (domain == Domain.DECLARATION) {
        return Collections.emptySet();
      }
      result=createFromCodes(object);
    }
  finally {
      proxy=previous;
    }
    result=cache(object,result);
  }
  return result;
}