Program: 92022
Project: 92022
Buggy source:
/** 
 * Parses a   {@code "ProjectedCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#57">WKT 2 specification §9</a>. The legacy WKT 1 specification was: {@preformat text}PROJCS["<name>", <geographic cs>, <projection>,  <parameter>,}*, <linear unit> {,<twin axes>}{,<authority>}] }
 * @param mode      {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent    The parent element.
 * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
 * @return The {@code "ProjectedCRS"} element as a {@link ProjectedCRS} object.
 * @throws ParseException if the {@code "ProjectedCRS"} element can not be parsed.
 */
private ProjectedCRS parseProjectedCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? new String[]{WKTKeywords.BaseProjCRS} : new String[]{WKTKeywords.ProjectedCRS,WKTKeywords.ProjCRS,WKTKeywords.ProjCS});
  if (element == null) {
    return null;
  }
  final boolean isWKT1=element.getKeywordIndex() == 2;
  final String name=element.pullString("String_Node_Str");
  final SingleCRS geoCRS=parseGeodeticCRS(MANDATORY,element,WKTKeywords.ellipsoidal);
  if (!(geoCRS instanceof GeographicCRS)) {
    throw new LocalizedParseException(errorLocale,Errors.Keys.IllegalCRSType_1,new Object[]{geoCRS.getClass()},element.offset);
  }
  final Unit<Length> linearUnit=parseScaledUnit(element,WKTKeywords.LengthUnit,SI.METRE);
  final boolean ignoreUnits=isWKT1 && usesCommonUnits;
  final Conversion conversion=parseDerivingConversion(MANDATORY,element,isWKT1 ? null : WKTKeywords.Conversion,ignoreUnits ? SI.METRE : linearUnit,ignoreUnits ? NonSI.DEGREE_ANGLE : geoCRS.getCoordinateSystem().getAxis(0).getUnit().asType(Angle.class));
  final CoordinateSystem cs;
  try {
    cs=parseCoordinateSystem(element,WKTKeywords.Cartesian,2,isWKT1,linearUnit,geoCRS.getDatum());
    final Map<String,?> properties=parseMetadataAndClose(element,name,conversion);
    return crsFactory.createProjectedCRS(properties,(GeographicCRS)geoCRS,conversion,(CartesianCS)cs);
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}

Fixed version (ground truth):
/** 
 * Parses a   {@code "ProjectedCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#57">WKT 2 specification §9</a>. The legacy WKT 1 specification was: {@preformat text}PROJCS["<name>", <geographic cs>, <projection>,  <parameter>,}*, <linear unit> {,<twin axes>}{,<authority>}] }
 * @param mode      {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent    The parent element.
 * @param isBaseCRS {@code true} if parsing the CRS inside a {@code DerivedCRS}.
 * @return The {@code "ProjectedCRS"} element as a {@link ProjectedCRS} object.
 * @throws ParseException if the {@code "ProjectedCRS"} element can not be parsed.
 */
private ProjectedCRS parseProjectedCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? new String[]{WKTKeywords.BaseProjCRS} : new String[]{WKTKeywords.ProjectedCRS,WKTKeywords.ProjCRS,WKTKeywords.ProjCS});
  if (element == null) {
    return null;
  }
  final boolean isWKT1=element.getKeywordIndex() == 2;
  final String name=element.pullString("String_Node_Str");
  final SingleCRS geoCRS=parseGeodeticCRS(MANDATORY,element,2,WKTKeywords.ellipsoidal);
  if (!(geoCRS instanceof GeographicCRS)) {
    throw new LocalizedParseException(errorLocale,Errors.Keys.IllegalCRSType_1,new Object[]{geoCRS.getClass()},element.offset);
  }
  Unit<Length> linearUnit=parseScaledUnit(element,WKTKeywords.LengthUnit,SI.METRE);
  final boolean ignoreUnits=isWKT1 && usesCommonUnits;
  final Conversion conversion=parseDerivingConversion(MANDATORY,element,isWKT1 ? null : WKTKeywords.Conversion,ignoreUnits ? SI.METRE : linearUnit,ignoreUnits ? NonSI.DEGREE_ANGLE : geoCRS.getCoordinateSystem().getAxis(0).getUnit().asType(Angle.class));
  if (linearUnit == null && isBaseCRS) {
    linearUnit=SI.METRE;
  }
  final CoordinateSystem cs;
  try {
    cs=parseCoordinateSystem(element,WKTKeywords.Cartesian,2,isWKT1,linearUnit,geoCRS.getDatum());
    final Map<String,?> properties=parseMetadataAndClose(element,name,conversion);
    if (cs instanceof CartesianCS) {
      return crsFactory.createProjectedCRS(properties,(GeographicCRS)geoCRS,conversion,(CartesianCS)cs);
    }
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
  throw element.illegalCS(cs);
}