Program: 91933
Project: 91933
Buggy source:
/** 
 * Parses an optional   {@code "UNIT"} element of a known dimension.This element has the following pattern: {@preformat text}UNIT["<name>", <conversion factor>  ,<authority>}] } Unit was a mandatory element in WKT 1, but became optional in WKT 2 because the unit may be specified in each   {@code AXIS[…]} element instead than for the whole coordinate system.
 * @param parent   The parent element.
 * @param keyword  The unit keyword (e.g. {@code "LengthUnit"} or {@code "AngleUnit"}).
 * @param baseUnit The base unit, usually {@code SI.METRE} or {@code SI.RADIAN}.
 * @return The {@code "UNIT"} element as an {@link Unit} object, or {@code null} if none.
 * @throws ParseException if the {@code "UNIT"} can not be parsed.
 * @todo Authority code is currently ignored. We may consider to create a subclass of{@link Unit} which implements {@link IdentifiedObject} in a future version.
 */
@SuppressWarnings("String_Node_Str") private <Q extends Quantity>Unit<Q> parseScaledUnit(final Element parent,final String keyword,final Unit<Q> baseUnit) throws ParseException {
  final Element element=parent.pullElement(OPTIONAL,keyword,WKTKeywords.Unit);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final double factor=element.pullDouble("String_Node_Str");
  final Unit<?> unit=parseUnitID(element);
  element.close(ignoredElements);
  if (unit != null) {
    if (baseUnit.toSI().equals(unit.toSI())) {
      return (Unit<Q>)unit;
    }
 else {
      warning(Errors.formatInternational(Errors.Keys.IllegalUnitFor_2,keyword,unit),null);
    }
  }
  return Units.multiply(baseUnit,factor);
}

Fixed version (ground truth):
/** 
 * Parses an optional   {@code "UNIT"} element of a known dimension.This element has the following pattern: {@preformat wkt}UNIT["<name>", <conversion factor>  ,<authority>}] } Unit was a mandatory element in WKT 1, but became optional in WKT 2 because the unit may be specified in each   {@code AXIS[…]} element instead than for the whole coordinate system.
 * @param parent   The parent element.
 * @param keyword  The unit keyword (e.g. {@code "LengthUnit"} or {@code "AngleUnit"}).
 * @param baseUnit The base unit, usually {@code SI.METRE} or {@code SI.RADIAN}.
 * @return The {@code "UNIT"} element as an {@link Unit} object, or {@code null} if none.
 * @throws ParseException if the {@code "UNIT"} can not be parsed.
 * @todo Authority code is currently ignored. We may consider to create a subclass of{@link Unit} which implements {@link IdentifiedObject} in a future version.
 */
@SuppressWarnings("String_Node_Str") private <Q extends Quantity>Unit<Q> parseScaledUnit(final Element parent,final String keyword,final Unit<Q> baseUnit) throws ParseException {
  final Element element=parent.pullElement(OPTIONAL,keyword,WKTKeywords.Unit);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final double factor=element.pullDouble("String_Node_Str");
  final Unit<?> unit=parseUnitID(element);
  element.close(ignoredElements);
  if (unit != null) {
    if (baseUnit.toSI().equals(unit.toSI())) {
      return (Unit<Q>)unit;
    }
 else {
      warning(parent,element,Errors.formatInternational(Errors.Keys.IllegalUnitFor_2,keyword,unit),null);
    }
  }
  return Units.multiply(baseUnit,factor);
}