Program: 91923
Project: 91923
Buggy source:
/** 
 * Parses an   {@code "Ellipsoid"} element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#52">WKT 2 specification §8.2.1</a>. The legacy WKT 1 pattern was: {@preformat text}SPHEROID["<name>", <semi-major axis>, <inverse flattening>  ,<authority>}] }
 * @param mode {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent The parent element.
 * @return The {@code "Ellipsoid"} element as an {@link Ellipsoid} object.
 * @throws ParseException if the {@code "Ellipsoid"} element can not be parsed.
 * @see org.apache.sis.referencing.datum.DefaultEllipsoid#formatTo(Formatter)
 */
private Ellipsoid parseEllipsoid(final int mode,final Element parent) throws ParseException {
  final Element element=parent.pullElement(mode,WKTKeywords.Ellipsoid,WKTKeywords.Spheroid);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final double semiMajorAxis=element.pullDouble("String_Node_Str");
  double inverseFlattening=element.pullDouble("String_Node_Str");
  Unit<Length> unit=parseScaledUnit(element,WKTKeywords.LengthUnit,SI.METRE);
  if (unit == null) {
    unit=SI.METRE;
  }
  final Map<String,?> properties=parseMetadataAndClose(element,name,null);
  try {
    if (inverseFlattening == 0) {
      return datumFactory.createEllipsoid(properties,semiMajorAxis,semiMajorAxis,unit);
    }
 else {
      return datumFactory.createFlattenedSphere(properties,semiMajorAxis,inverseFlattening,unit);
    }
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}

Fixed version (ground truth):
/** 
 * Parses an   {@code "Ellipsoid"} element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#52">WKT 2 specification §8.2.1</a>. The legacy WKT 1 pattern was: {@preformat wkt}SPHEROID["<name>", <semi-major axis>, <inverse flattening>  ,<authority>}] }
 * @param mode {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent The parent element.
 * @return The {@code "Ellipsoid"} element as an {@link Ellipsoid} object.
 * @throws ParseException if the {@code "Ellipsoid"} element can not be parsed.
 * @see org.apache.sis.referencing.datum.DefaultEllipsoid#formatTo(Formatter)
 */
private Ellipsoid parseEllipsoid(final int mode,final Element parent) throws ParseException {
  final Element element=parent.pullElement(mode,WKTKeywords.Ellipsoid,WKTKeywords.Spheroid);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final double semiMajorAxis=element.pullDouble("String_Node_Str");
  double inverseFlattening=element.pullDouble("String_Node_Str");
  Unit<Length> unit=parseScaledUnit(element,WKTKeywords.LengthUnit,SI.METRE);
  if (unit == null) {
    unit=SI.METRE;
  }
  final Map<String,?> properties=parseMetadataAndClose(element,name,null);
  try {
    if (inverseFlattening == 0) {
      return datumFactory.createEllipsoid(properties,semiMajorAxis,semiMajorAxis,unit);
    }
 else {
      return datumFactory.createFlattenedSphere(properties,semiMajorAxis,inverseFlattening,unit);
    }
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}