Program: 91895
Project: 91895
Buggy source:
/** 
 * Infers an operation for conversion or transformation between two coordinate reference systems. If a non-null authority factory – the <cite>registry</cite> – has been specified at construction time, this method will first query that factory (<cite>late-binding</cite> approach – see class javadoc). If no operation has been found in the registry or if no registry has been specified to the constructor, this method inspects the given CRS and delegates the work to one or many   {@code createOperationStep(…)}methods (<cite>early-binding</cite> approach). <p>At first, this method is invoked with the   {@code sourceCRS} and {@code targetCRS} arguments given to the{@link DefaultCoordinateOperationFactory#createOperation(CoordinateReferenceSystem,CoordinateReferenceSystem,CoordinateOperationContext) CoordinateOperationFactory.createOperation(…)} method. But then, this method maybe invoked recursively by some  {@code createOperationStep(…)} methods with different source or target CRS,for example in order to process the  {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS#getBaseCRS() base geographic CRS} of a projected CRS.</p>
 * @param sourceCRS  input coordinate reference system.
 * @param targetCRS  output coordinate reference system.
 * @return a coordinate operation from {@code sourceCRS} to {@code targetCRS}.
 * @throws OperationNotFoundException if no operation path was found from {@code sourceCRS} to {@code targetCRS}.
 * @throws FactoryException if the operation creation failed for some other reason.
 */
@Override public CoordinateOperation createOperation(final CoordinateReferenceSystem sourceCRS,final CoordinateReferenceSystem targetCRS) throws OperationNotFoundException, FactoryException {
  ArgumentChecks.ensureNonNull("String_Node_Str",sourceCRS);
  ArgumentChecks.ensureNonNull("String_Node_Str",targetCRS);
  if (!previousSearches.isEmpty()) {
  }
  final CRSPair key=new CRSPair(sourceCRS,targetCRS);
  if (previousSearches.put(key,Boolean.TRUE) != null) {
    throw new FactoryException(Errors.format(Errors.Keys.RecursiveCreateCallForCode_2,CoordinateOperation.class,key));
  }
  GeographicBoundingBox bbox=Extents.getGeographicBoundingBox(areaOfInterest);
  if (bbox == null) {
    bbox=Extents.intersection(CRS.getGeographicBoundingBox(sourceCRS),CRS.getGeographicBoundingBox(targetCRS));
    areaOfInterest=CoordinateOperationContext.setGeographicBoundingBox(areaOfInterest,bbox);
  }
  if (registry != null) {
    final CoordinateOperation op=super.createOperation(sourceCRS,targetCRS);
    if (op != null)     return op;
  }
  if (sourceCRS instanceof GeneralDerivedCRS) {
    final GeneralDerivedCRS source=(GeneralDerivedCRS)sourceCRS;
    if (targetCRS instanceof GeneralDerivedCRS) {
      return createOperationStep(source,(GeneralDerivedCRS)targetCRS);
    }
    if (targetCRS instanceof SingleCRS) {
      return createOperationStep(source,(SingleCRS)targetCRS);
    }
  }
  if (targetCRS instanceof GeneralDerivedCRS) {
    final GeneralDerivedCRS target=(GeneralDerivedCRS)targetCRS;
    if (sourceCRS instanceof SingleCRS) {
      return createOperationStep((SingleCRS)sourceCRS,target);
    }
  }
  if (sourceCRS instanceof GeodeticCRS) {
    final GeodeticCRS source=(GeodeticCRS)sourceCRS;
    if (targetCRS instanceof GeodeticCRS) {
      return createOperationStep(source,(GeodeticCRS)targetCRS);
    }
    if (targetCRS instanceof VerticalCRS) {
      return createOperationStep(source,(VerticalCRS)targetCRS);
    }
  }
  if (sourceCRS instanceof VerticalCRS) {
    final VerticalCRS source=(VerticalCRS)sourceCRS;
    if (targetCRS instanceof VerticalCRS) {
      return createOperationStep(source,(VerticalCRS)targetCRS);
    }
  }
  if (sourceCRS instanceof TemporalCRS) {
    final TemporalCRS source=(TemporalCRS)sourceCRS;
    if (targetCRS instanceof TemporalCRS) {
      return createOperationStep(source,(TemporalCRS)targetCRS);
    }
  }
  if (sourceCRS instanceof CompoundCRS || targetCRS instanceof CompoundCRS) {
    return createOperationStep(sourceCRS,CRS.getSingleComponents(sourceCRS),targetCRS,CRS.getSingleComponents(targetCRS));
  }
  throw new OperationNotFoundException(notFoundMessage(sourceCRS,targetCRS));
}

Fixed version (ground truth):
/** 
 * Infers an operation for conversion or transformation between two coordinate reference systems. If a non-null authority factory – the <cite>registry</cite> – has been specified at construction time, this method will first query that factory (<cite>late-binding</cite> approach – see class javadoc). If no operation has been found in the registry or if no registry has been specified to the constructor, this method inspects the given CRS and delegates the work to one or many   {@code createOperationStep(…)}methods (<cite>early-binding</cite> approach). <p>At first, this method is invoked with the   {@code sourceCRS} and {@code targetCRS} arguments given to the{@link DefaultCoordinateOperationFactory#createOperation(CoordinateReferenceSystem,CoordinateReferenceSystem,CoordinateOperationContext) CoordinateOperationFactory.createOperation(…)} method. But then, this method maybe invoked recursively by some  {@code createOperationStep(…)} methods with different source or target CRS,for example in order to process the  {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS#getBaseCRS() base geographic CRS} of a projected CRS.</p>
 * @param sourceCRS  input coordinate reference system.
 * @param targetCRS  output coordinate reference system.
 * @return a coordinate operation from {@code sourceCRS} to {@code targetCRS}.
 * @throws OperationNotFoundException if no operation path was found from {@code sourceCRS} to {@code targetCRS}.
 * @throws FactoryException if the operation creation failed for some other reason.
 */
@Override public CoordinateOperation createOperation(final CoordinateReferenceSystem sourceCRS,final CoordinateReferenceSystem targetCRS) throws OperationNotFoundException, FactoryException {
  ArgumentChecks.ensureNonNull("String_Node_Str",sourceCRS);
  ArgumentChecks.ensureNonNull("String_Node_Str",targetCRS);
  if (equalsIgnoreMetadata(sourceCRS,targetCRS))   try {
    return createFromAffineTransform(AXIS_CHANGES,sourceCRS,targetCRS,CoordinateSystems.swapAndScaleAxes(sourceCRS.getCoordinateSystem(),targetCRS.getCoordinateSystem()));
  }
 catch (  IllegalArgumentException e) {
    throw new FactoryException(Errors.format(Errors.Keys.CanNotInstantiate_1,new CRSPair(sourceCRS,targetCRS)),e);
  }
catch (  ConversionException e) {
    throw new FactoryException(Errors.format(Errors.Keys.CanNotInstantiate_1,new CRSPair(sourceCRS,targetCRS)),e);
  }
  final CRSPair key=new CRSPair(sourceCRS,targetCRS);
  if (useCache && !previousSearches.isEmpty()) {
    final CoordinateOperation op=factorySIS.cache.peek(key);
    if (op != null)     return op;
  }
  if (previousSearches.put(key,Boolean.TRUE) != null) {
    throw new FactoryException(Errors.format(Errors.Keys.RecursiveCreateCallForCode_2,CoordinateOperation.class,key));
  }
  GeographicBoundingBox bbox=Extents.getGeographicBoundingBox(areaOfInterest);
  if (bbox == null) {
    bbox=Extents.intersection(CRS.getGeographicBoundingBox(sourceCRS),CRS.getGeographicBoundingBox(targetCRS));
    areaOfInterest=CoordinateOperationContext.setGeographicBoundingBox(areaOfInterest,bbox);
  }
  if (registry != null) {
    final CoordinateOperation op=super.createOperation(sourceCRS,targetCRS);
    if (op != null)     return op;
  }
  if (sourceCRS instanceof GeneralDerivedCRS) {
    final GeneralDerivedCRS source=(GeneralDerivedCRS)sourceCRS;
    if (targetCRS instanceof GeneralDerivedCRS) {
      return createOperationStep(source,(GeneralDerivedCRS)targetCRS);
    }
    if (targetCRS instanceof SingleCRS) {
      return createOperationStep(source,(SingleCRS)targetCRS);
    }
  }
  if (targetCRS instanceof GeneralDerivedCRS) {
    final GeneralDerivedCRS target=(GeneralDerivedCRS)targetCRS;
    if (sourceCRS instanceof SingleCRS) {
      return createOperationStep((SingleCRS)sourceCRS,target);
    }
  }
  if (sourceCRS instanceof GeodeticCRS) {
    final GeodeticCRS source=(GeodeticCRS)sourceCRS;
    if (targetCRS instanceof GeodeticCRS) {
      return createOperationStep(source,(GeodeticCRS)targetCRS);
    }
    if (targetCRS instanceof VerticalCRS) {
      return createOperationStep(source,(VerticalCRS)targetCRS);
    }
  }
  if (sourceCRS instanceof VerticalCRS) {
    final VerticalCRS source=(VerticalCRS)sourceCRS;
    if (targetCRS instanceof VerticalCRS) {
      return createOperationStep(source,(VerticalCRS)targetCRS);
    }
  }
  if (sourceCRS instanceof TemporalCRS) {
    final TemporalCRS source=(TemporalCRS)sourceCRS;
    if (targetCRS instanceof TemporalCRS) {
      return createOperationStep(source,(TemporalCRS)targetCRS);
    }
  }
  if (sourceCRS instanceof CompoundCRS || targetCRS instanceof CompoundCRS) {
    return createOperationStep(sourceCRS,CRS.getSingleComponents(sourceCRS),targetCRS,CRS.getSingleComponents(targetCRS));
  }
  throw new OperationNotFoundException(notFoundMessage(sourceCRS,targetCRS));
}