Program: 92012
Project: 92012
Buggy source:
/** 
 * Parses a   {@code "EngineeringCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#74">WKT 2 specification §11</a>. The legacy WKT 1 pattern was: {@preformat text}LOCAL_CS["<name>", <local datum>, <unit>, <axis>,  ,<axis>}* {,<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 "EngineeringCRS"} element as an {@link EngineeringCRS} object.
 * @throws ParseException if the {@code "EngineeringCRS"} element can not be parsed.
 */
private EngineeringCRS parseEngineeringCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? new String[]{WKTKeywords.BaseEngCRS} : new String[]{WKTKeywords.EngineeringCRS,WKTKeywords.EngCRS,WKTKeywords.Local_CS});
  if (element == null) {
    return null;
  }
  final boolean isWKT1=element.getKeywordIndex() == 2;
  final String name=element.pullString("String_Node_Str");
  final EngineeringDatum datum=parseEngineeringDatum(MANDATORY,element,isWKT1);
  final Unit<?> unit=parseUnit(element);
  try {
    final CoordinateSystem cs=parseCoordinateSystem(element,null,1,isWKT1,unit,datum);
    return crsFactory.createEngineeringCRS(parseMetadataAndClose(element,name,datum),datum,cs);
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}

Fixed version (ground truth):
/** 
 * Parses a   {@code "EngineeringCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#74">WKT 2 specification §11</a>. The legacy WKT 1 pattern was: {@preformat text}LOCAL_CS["<name>", <local datum>, <unit>, <axis>,  ,<axis>}* {,<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 "EngineeringCRS"} element as an {@link EngineeringCRS} object.
 * @throws ParseException if the {@code "EngineeringCRS"} element can not be parsed.
 */
private SingleCRS parseEngineeringCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? new String[]{WKTKeywords.BaseEngCRS} : new String[]{WKTKeywords.EngineeringCRS,WKTKeywords.EngCRS,WKTKeywords.Local_CS});
  if (element == null) {
    return null;
  }
  final boolean isWKT1=element.getKeywordIndex() == 2;
  final String name=element.pullString("String_Node_Str");
  final Unit<?> unit=parseUnit(element);
  EngineeringDatum datum=null;
  SingleCRS baseCRS=null;
  Conversion fromBase=null;
  if (!isWKT1 && !isBaseCRS) {
    fromBase=parseDerivingConversion(OPTIONAL,element,WKTKeywords.DerivingConversion,null,null);
    if (fromBase != null) {
      baseCRS=parseEngineeringCRS(OPTIONAL,element,true);
      if (baseCRS == null) {
        baseCRS=parseGeodeticCRS(OPTIONAL,element,getSourceDimensions(fromBase.getMethod()),WKTKeywords.ellipsoidal);
        if (baseCRS == null) {
          baseCRS=parseProjectedCRS(MANDATORY,element,true);
        }
      }
    }
  }
  if (baseCRS == null) {
    datum=parseEngineeringDatum(MANDATORY,element,isWKT1);
  }
  try {
    final CoordinateSystem cs=parseCoordinateSystem(element,null,1,isWKT1,unit,datum);
    final Map<String,?> properties=parseMetadataAndClose(element,name,datum);
    if (baseCRS != null) {
      return crsFactory.createDerivedCRS(properties,baseCRS,fromBase,cs);
    }
    return crsFactory.createEngineeringCRS(properties,datum,cs);
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}