nus-yam/ex-repair huggingface dataset:
Program: 92004
Project: 92004
Buggy source:
/** 
 * Tests the concatenation of two affine transforms than can be represented as a   {@link ConcatenatedTransformDirect2D}.
 * @throws TransformException Should never happen.
 */
@Test public void testDirect2D() throws TransformException {
  final AffineTransform2D first=new AffineTransform2D();
  first.translate(2,4);
  first.freeze();
  final AffineTransform2D second=new AffineTransform2D();
  second.translate(0.25,0.75);
  second.freeze();
  tolerance=1E-10;
  transform=new ConcatenatedTransformDirect2D(first,second);
  validate();
  final double[] source=generateRandomCoordinates(CoordinateDomain.PROJECTED,0);
  final double[] target=new double[source.length];
  first.transform(source,0,target,0,source.length / 2);
  second.transform(target,0,target,0,target.length / 2);
  verifyTransform(source,target);
  transform=new ConcatenatedTransform2D(first,second);
  validate();
  verifyTransform(source,target);
  transform=new ConcatenatedTransformDirect(first,second);
  verifyTransform(source,target);
  transform=new ConcatenatedTransform(first,second);
  verifyTransform(source,target);
  transform=MathTransforms.concatenate(first,second);
  assertInstanceOf("String_Node_Str",AffineTransform2D.class,transform);
  validate();
  verifyTransform(source,target);
}

Fixed version (ground truth):
/** 
 * Tests the concatenation of two affine transforms than can be represented as a   {@link ConcatenatedTransformDirect2D}.
 * @throws TransformException Should never happen.
 */
@Test public void testDirect2D() throws TransformException {
  final AffineTransform2D first=new AffineTransform2D(1,0,0,1,2.00,4.00);
  final AffineTransform2D second=new AffineTransform2D(1,0,0,1,0.25,0.75);
  tolerance=1E-10;
  transform=new ConcatenatedTransformDirect2D(first,second);
  validate();
  final double[] source=generateRandomCoordinates(CoordinateDomain.PROJECTED,0);
  final double[] target=new double[source.length];
  first.transform(source,0,target,0,source.length / 2);
  second.transform(target,0,target,0,target.length / 2);
  verifyTransform(source,target);
  transform=new ConcatenatedTransform2D(first,second);
  validate();
  verifyTransform(source,target);
  transform=new ConcatenatedTransformDirect(first,second);
  verifyTransform(source,target);
  transform=new ConcatenatedTransform(first,second);
  verifyTransform(source,target);
  transform=MathTransforms.concatenate(first,second);
  assertInstanceOf("String_Node_Str",AffineTransform2D.class,transform);
  validate();
  verifyTransform(source,target);
}
Program: 92005
Project: 92005
Buggy source:
/** 
 * Tests the concatenation of two affine transforms than can not be represented as a  {@link ConcatenatedTransformDirect}. The slower   {@link ConcatenatedTransform} shall be used.
 * @throws TransformException Should never happen.
 */
@Test @org.junit.Ignore("String_Node_Str") public void testGeneric() throws TransformException {
  final MathTransform first=null;
  final AffineTransform2D second=new AffineTransform2D();
  second.scale(0.5,0.25);
  second.freeze();
  transform=new ConcatenatedTransform(first,second);
  isInverseTransformSupported=false;
  validate();
  final double[] source=generateRandomCoordinates(CoordinateDomain.PROJECTED,0);
  final double[] target=new double[source.length / 2];
  first.transform(source,0,target,0,target.length / 2);
  second.transform(target,0,target,0,target.length / 2);
  verifyTransform(source,target);
  transform=ConcatenatedTransform.create(first,second);
  assertInstanceOf("String_Node_Str",ProjectiveTransform.class,transform);
  validate();
  verifyTransform(source,target);
}

Fixed version (ground truth):
/** 
 * Tests the concatenation of two affine transforms than can not be represented as a  {@link ConcatenatedTransformDirect}. The slower   {@link ConcatenatedTransform} shall be used.
 * @throws TransformException Should never happen.
 */
@Test @org.junit.Ignore("String_Node_Str") public void testGeneric() throws TransformException {
  final MathTransform first=null;
  final AffineTransform2D second=new AffineTransform2D(0.5,0,0,0.25,0,0);
  transform=new ConcatenatedTransform(first,second);
  isInverseTransformSupported=false;
  validate();
  final double[] source=generateRandomCoordinates(CoordinateDomain.PROJECTED,0);
  final double[] target=new double[source.length / 2];
  first.transform(source,0,target,0,target.length / 2);
  second.transform(target,0,target,0,target.length / 2);
  verifyTransform(source,target);
  transform=ConcatenatedTransform.create(first,second);
  assertInstanceOf("String_Node_Str",ProjectiveTransform.class,transform);
  validate();
  verifyTransform(source,target);
}
Program: 92006
Project: 92006
Buggy source:
/** 
 * Converts the given XML value to an enumeration constant name.
 * @param value The text in the XML element.
 * @return The presumed enumeration constant name.
 */
protected static String name(String value){
  final char[] ca=value.toCharArray();
  for (int i=0; i < ca.length; i++) {
    final char c=ca[i];
    ca[i]=(c >= '0') ? Character.toUpperCase(c) : '_';
  }
  return String.valueOf(ca);
}

Fixed version (ground truth):
/** 
 * Converts the given XML value to an enumeration constant name.
 * @param value The text in the XML element.
 * @return The presumed enumeration constant name.
 */
protected static String name(final String value){
  final int length=value.length();
  final StringBuilder buffer=new StringBuilder(length);
  for (int i=0; i < length; i++) {
    char c=value.charAt(i);
    if (c < '0') {
      c='_';
    }
 else     if (!Character.isUpperCase(c)) {
      c=Character.toUpperCase(c);
    }
 else     if (i != 0) {
      buffer.append('_');
    }
    buffer.append(c);
  }
  return buffer.toString();
}
Program: 92007
Project: 92007
Buggy source:
/** 
 * Returns   {@code true} if the projection specified by the given parameters has the given keyword or identifier.If non-null, the given identifier is presumed in the EPSG namespace and has precedence over the keyword. <div class="note"><b>Implementation note:</b> Since callers usually give a constant string for the  {@code regex} argument, it would be more efficient tocompile the  {@link java.util.regex.Pattern} once for all. However the regular expression is used only as afallback if the descriptor does not contain EPSG identifier, which should be rare. Usually, the regular expression will never be compiled.</div>
 * @param parameters The user-specified parameters.
 * @param regex      The regular expression to use when using the operation name as the criterion.
 * @param identifier The identifier to compare against the parameter group name.
 * @return {@code true} if the given parameter group name contains the given keywordor has an EPSG identifier equals to the given identifier.
 */
static boolean identMatch(final ParameterDescriptorGroup parameters,final String regex,final String identifier){
  if (identifier != null) {
    for (    final Identifier id : parameters.getIdentifiers()) {
      if (Constants.EPSG.equals(id.getCodeSpace())) {
        return identifier.equals(id.getCode());
      }
    }
  }
  return parameters.getName().getCode().matches(regex);
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if the projection specified by the given parameters has the given keyword or identifier.If non-null, the given identifier is presumed in the EPSG namespace and has precedence over the keyword. <div class="note"><b>Implementation note:</b> Since callers usually give a constant string for the  {@code regex} argument, it would be more efficient tocompile the  {@link java.util.regex.Pattern} once for all. However the regular expression is used only as afallback if the descriptor does not contain EPSG identifier, which should be rare. Usually, the regular expression will never be compiled.</div>
 * @param parameters The user-specified parameters.
 * @param regex      The regular expression to use when using the operation name as the criterion.
 * @param identifier The identifier to compare against the parameter group name.
 * @return {@code true} if the given parameter group name contains the given keywordor has an EPSG identifier equals to the given identifier.
 */
static boolean identMatch(final ParameterDescriptorGroup parameters,final String regex,final String identifier){
  if (identifier != null) {
    for (    final Identifier id : parameters.getIdentifiers()) {
      if (Constants.EPSG.equals(id.getCodeSpace())) {
        return identifier.equals(id.getCode());
      }
    }
  }
  return parameters.getName().getCode().replace('_',' ').matches(regex);
}
Program: 92008
Project: 92008
Buggy source:
/** 
 * Returns the (<var>role</var> → <var>parameter</var>) associations for a Polar Stereographic projection.
 * @param variant One of {@link #A},   {@link #B},   {@link #C},   {@link #NORTH} or {@link #SOUTH} constants.
 * @return The roles map to give to super-class constructor.
 */
private static Map<ParameterRole,ParameterDescriptor<Double>> roles(final byte variant){
  final EnumMap<ParameterRole,ParameterDescriptor<Double>> roles=new EnumMap<>(ParameterRole.class);
  ParameterDescriptor<Double> falseEasting=PolarStereographicA.FALSE_EASTING;
  ParameterDescriptor<Double> falseNorthing=PolarStereographicA.FALSE_NORTHING;
  if (variant == C) {
    falseEasting=PolarStereographicC.EASTING_AT_FALSE_ORIGIN;
    falseNorthing=PolarStereographicC.NORTHING_AT_FALSE_ORIGIN;
  }
  roles.put(ParameterRole.FALSE_EASTING,falseEasting);
  roles.put(ParameterRole.FALSE_NORTHING,falseNorthing);
  roles.put(ParameterRole.SCALE_FACTOR,PolarStereographicA.SCALE_FACTOR);
  roles.put(ParameterRole.CENTRAL_MERIDIAN,(variant == B || variant == C) ? PolarStereographicB.LONGITUDE_OF_ORIGIN : PolarStereographicA.LONGITUDE_OF_ORIGIN);
  return roles;
}

Fixed version (ground truth):
/** 
 * Returns the (<var>role</var> → <var>parameter</var>) associations for a Polar Stereographic projection.
 * @param variant One of {@link #A},   {@link #B},   {@link #C},   {@link #NORTH} or {@link #SOUTH} constants.
 * @return The roles map to give to super-class constructor.
 */
private static Map<ParameterRole,ParameterDescriptor<Double>> roles(final byte variant){
  final EnumMap<ParameterRole,ParameterDescriptor<Double>> roles=new EnumMap<>(ParameterRole.class);
  ParameterDescriptor<Double> falseEasting=PolarStereographicA.FALSE_EASTING;
  ParameterDescriptor<Double> falseNorthing=PolarStereographicA.FALSE_NORTHING;
  if (variant == C) {
    falseEasting=PolarStereographicC.EASTING_AT_FALSE_ORIGIN;
    falseNorthing=PolarStereographicC.NORTHING_AT_FALSE_ORIGIN;
  }
  roles.put(ParameterRole.FALSE_EASTING,falseEasting);
  roles.put(ParameterRole.FALSE_NORTHING,falseNorthing);
  roles.put(ParameterRole.SCALE_FACTOR,PolarStereographicA.SCALE_FACTOR);
  roles.put(ParameterRole.CENTRAL_MERIDIAN,(variant == A) ? PolarStereographicA.LONGITUDE_OF_ORIGIN : PolarStereographicB.LONGITUDE_OF_ORIGIN);
  return roles;
}
Program: 92009
Project: 92009
Buggy source:
/** 
 * Parses a coordinate reference system element.
 * @param element The parent element.
 * @param mandatory {@code true} if a CRS must be present, or {@code false} if optional.
 * @return The next element as a {@code CoordinateReferenceSystem} object.
 * @throws ParseException if the next element can not be parsed.
 */
private CoordinateReferenceSystem parseCoordinateReferenceSystem(final Element element,final boolean mandatory) throws ParseException {
  CoordinateReferenceSystem crs;
  if ((crs=parseGeodeticCRS(FIRST,element,null)) == null && (crs=parseProjectedCRS(FIRST,element,false)) == null && (crs=parseVerticalCRS(FIRST,element,false)) == null && (crs=parseTimeCRS(FIRST,element,false)) == null && (crs=parseEngineeringCRS(FIRST,element,false)) == null && (crs=parseImageCRS(FIRST,element)) == null && (crs=parseCompoundCRS(FIRST,element)) == null && (crs=parseFittedCS(FIRST,element)) == null) {
    if (mandatory) {
      throw element.missingOrUnknownComponent(WKTKeywords.GeodeticCRS);
    }
  }
  return crs;
}

Fixed version (ground truth):
/** 
 * Parses a coordinate reference system element.
 * @param element The parent element.
 * @param mandatory {@code true} if a CRS must be present, or {@code false} if optional.
 * @return The next element as a {@code CoordinateReferenceSystem} object.
 * @throws ParseException if the next element can not be parsed.
 */
private CoordinateReferenceSystem parseCoordinateReferenceSystem(final Element element,final boolean mandatory) throws ParseException {
  CoordinateReferenceSystem crs;
  if ((crs=parseGeodeticCRS(FIRST,element,2,null)) == null && (crs=parseProjectedCRS(FIRST,element,false)) == null && (crs=parseVerticalCRS(FIRST,element,false)) == null && (crs=parseTimeCRS(FIRST,element,false)) == null && (crs=parseEngineeringCRS(FIRST,element,false)) == null && (crs=parseImageCRS(FIRST,element)) == null && (crs=parseCompoundCRS(FIRST,element)) == null && (crs=parseFittedCS(FIRST,element)) == null) {
    if (mandatory) {
      throw element.missingOrUnknownComponent(WKTKeywords.GeodeticCRS);
    }
  }
  return crs;
}
Program: 92010
Project: 92010
Buggy source:
/** 
 * Parses an   {@code "ImageCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification §12</a>.
 * @param mode {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent The parent element.
 * @return The {@code "ImageCRS"} element as an {@link ImageCRS} object.
 * @throws ParseException if the {@code "ImageCRS"} element can not be parsed.
 */
private ImageCRS parseImageCRS(final int mode,final Element parent) throws ParseException {
  final Element element=parent.pullElement(mode,WKTKeywords.ImageCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final ImageDatum datum=parseImageDatum(MANDATORY,element);
  final Unit<?> unit=parseUnit(element);
  try {
    final CoordinateSystem cs=parseCoordinateSystem(element,WKTKeywords.Cartesian,2,false,unit,datum);
    return crsFactory.createImageCRS(parseMetadataAndClose(element,name,datum),datum,(CartesianCS)cs);
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}

Fixed version (ground truth):
/** 
 * Parses an   {@code "ImageCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification §12</a>.
 * @param mode {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent The parent element.
 * @return The {@code "ImageCRS"} element as an {@link ImageCRS} object.
 * @throws ParseException if the {@code "ImageCRS"} element can not be parsed.
 */
private ImageCRS parseImageCRS(final int mode,final Element parent) throws ParseException {
  final Element element=parent.pullElement(mode,WKTKeywords.ImageCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final ImageDatum datum=parseImageDatum(MANDATORY,element);
  final Unit<?> unit=parseUnit(element);
  final CoordinateSystem cs;
  try {
    cs=parseCoordinateSystem(element,WKTKeywords.Cartesian,2,false,unit,datum);
    final Map<String,?> properties=parseMetadataAndClose(element,name,datum);
    if (cs instanceof CartesianCS) {
      return crsFactory.createImageCRS(properties,datum,(CartesianCS)cs);
    }
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
  throw element.illegalCS(cs);
}
Program: 92015
Project: 92015
Buggy source:
/** 
 * Parses   {@code "TimeCRS"} element.
 * @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 "TimeCRS"} element as a {@link TemporalCRS} object.
 * @throws ParseException if the {@code "TimeCRS"} element can not be parsed.
 */
private TemporalCRS parseTimeCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final TemporalDatum datum=parseTimeDatum(MANDATORY,element);
  final Unit<Duration> timeUnit=parseScaledUnit(element,WKTKeywords.TimeUnit,SI.SECOND);
  try {
    final CoordinateSystem cs=parseCoordinateSystem(element,WKTKeywords.temporal,1,false,timeUnit,datum);
    return crsFactory.createTemporalCRS(parseMetadataAndClose(element,name,datum),datum,(TimeCS)cs);
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}

Fixed version (ground truth):
/** 
 * Parses   {@code "TimeCRS"} element.
 * @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 "TimeCRS"} element as a {@link TemporalCRS} object.
 * @throws ParseException if the {@code "TimeCRS"} element can not be parsed.
 */
private SingleCRS parseTimeCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final Unit<Duration> unit=parseScaledUnit(element,WKTKeywords.TimeUnit,SI.SECOND);
  TemporalDatum datum=null;
  SingleCRS baseCRS=null;
  Conversion fromBase=null;
  if (!isBaseCRS) {
    fromBase=parseDerivingConversion(OPTIONAL,element,WKTKeywords.DerivingConversion,null,null);
    if (fromBase != null) {
      baseCRS=parseTimeCRS(MANDATORY,element,true);
    }
  }
  if (baseCRS == null) {
    datum=parseTimeDatum(MANDATORY,element);
  }
  final CoordinateSystem cs;
  try {
    cs=parseCoordinateSystem(element,WKTKeywords.temporal,1,false,unit,datum);
    final Map<String,?> properties=parseMetadataAndClose(element,name,datum);
    if (cs instanceof TimeCS) {
      if (baseCRS != null) {
        return crsFactory.createDerivedCRS(properties,baseCRS,fromBase,cs);
      }
      return crsFactory.createTemporalCRS(properties,datum,(TimeCS)cs);
    }
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
  throw element.illegalCS(cs);
}
Program: 92017
Project: 92017
Buggy source:
/** 
 * Parses a coordinate reference system element.
 * @param element The parent element.
 * @param mandatory {@code true} if a CRS must be present, or {@code false} if optional.
 * @return The next element as a {@code CoordinateReferenceSystem} object.
 * @throws ParseException if the next element can not be parsed.
 */
private CoordinateReferenceSystem parseCoordinateReferenceSystem(final Element element,final boolean mandatory) throws ParseException {
  CoordinateReferenceSystem crs;
  if ((crs=parseGeodeticCRS(FIRST,element,null)) == null && (crs=parseProjectedCRS(FIRST,element,false)) == null && (crs=parseVerticalCRS(FIRST,element,false)) == null && (crs=parseTimeCRS(FIRST,element,false)) == null && (crs=parseEngineeringCRS(FIRST,element,false)) == null && (crs=parseImageCRS(FIRST,element)) == null && (crs=parseCompoundCRS(FIRST,element)) == null && (crs=parseFittedCS(FIRST,element)) == null) {
    if (mandatory) {
      throw element.missingOrUnknownComponent(WKTKeywords.GeodeticCRS);
    }
  }
  return crs;
}

Fixed version (ground truth):
/** 
 * Parses a coordinate reference system element.
 * @param element The parent element.
 * @param mandatory {@code true} if a CRS must be present, or {@code false} if optional.
 * @return The next element as a {@code CoordinateReferenceSystem} object.
 * @throws ParseException if the next element can not be parsed.
 */
private CoordinateReferenceSystem parseCoordinateReferenceSystem(final Element element,final boolean mandatory) throws ParseException {
  CoordinateReferenceSystem crs;
  if ((crs=parseGeodeticCRS(FIRST,element,2,null)) == null && (crs=parseProjectedCRS(FIRST,element,false)) == null && (crs=parseVerticalCRS(FIRST,element,false)) == null && (crs=parseTimeCRS(FIRST,element,false)) == null && (crs=parseEngineeringCRS(FIRST,element,false)) == null && (crs=parseImageCRS(FIRST,element)) == null && (crs=parseCompoundCRS(FIRST,element)) == null && (crs=parseFittedCS(FIRST,element)) == null) {
    if (mandatory) {
      throw element.missingOrUnknownComponent(WKTKeywords.GeodeticCRS);
    }
  }
  return crs;
}
Program: 92018
Project: 92018
Buggy source:
/** 
 * Parses an   {@code "ImageCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification §12</a>.
 * @param mode {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent The parent element.
 * @return The {@code "ImageCRS"} element as an {@link ImageCRS} object.
 * @throws ParseException if the {@code "ImageCRS"} element can not be parsed.
 */
private ImageCRS parseImageCRS(final int mode,final Element parent) throws ParseException {
  final Element element=parent.pullElement(mode,WKTKeywords.ImageCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final ImageDatum datum=parseImageDatum(MANDATORY,element);
  final Unit<?> unit=parseUnit(element);
  try {
    final CoordinateSystem cs=parseCoordinateSystem(element,WKTKeywords.Cartesian,2,false,unit,datum);
    return crsFactory.createImageCRS(parseMetadataAndClose(element,name,datum),datum,(CartesianCS)cs);
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}

Fixed version (ground truth):
/** 
 * Parses an   {@code "ImageCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification §12</a>.
 * @param mode {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent The parent element.
 * @return The {@code "ImageCRS"} element as an {@link ImageCRS} object.
 * @throws ParseException if the {@code "ImageCRS"} element can not be parsed.
 */
private ImageCRS parseImageCRS(final int mode,final Element parent) throws ParseException {
  final Element element=parent.pullElement(mode,WKTKeywords.ImageCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final ImageDatum datum=parseImageDatum(MANDATORY,element);
  final Unit<?> unit=parseUnit(element);
  final CoordinateSystem cs;
  try {
    cs=parseCoordinateSystem(element,WKTKeywords.Cartesian,2,false,unit,datum);
    final Map<String,?> properties=parseMetadataAndClose(element,name,datum);
    if (cs instanceof CartesianCS) {
      return crsFactory.createImageCRS(properties,datum,(CartesianCS)cs);
    }
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
  throw element.illegalCS(cs);
}
Program: 92023
Project: 92023
Buggy source:
/** 
 * Parses   {@code "TimeCRS"} element.
 * @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 "TimeCRS"} element as a {@link TemporalCRS} object.
 * @throws ParseException if the {@code "TimeCRS"} element can not be parsed.
 */
private TemporalCRS parseTimeCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final TemporalDatum datum=parseTimeDatum(MANDATORY,element);
  final Unit<Duration> timeUnit=parseScaledUnit(element,WKTKeywords.TimeUnit,SI.SECOND);
  try {
    final CoordinateSystem cs=parseCoordinateSystem(element,WKTKeywords.temporal,1,false,timeUnit,datum);
    return crsFactory.createTemporalCRS(parseMetadataAndClose(element,name,datum),datum,(TimeCS)cs);
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}

Fixed version (ground truth):
/** 
 * Parses   {@code "TimeCRS"} element.
 * @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 "TimeCRS"} element as a {@link TemporalCRS} object.
 * @throws ParseException if the {@code "TimeCRS"} element can not be parsed.
 */
private SingleCRS parseTimeCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final Unit<Duration> unit=parseScaledUnit(element,WKTKeywords.TimeUnit,SI.SECOND);
  TemporalDatum datum=null;
  SingleCRS baseCRS=null;
  Conversion fromBase=null;
  if (!isBaseCRS) {
    fromBase=parseDerivingConversion(OPTIONAL,element,WKTKeywords.DerivingConversion,null,null);
    if (fromBase != null) {
      baseCRS=parseTimeCRS(MANDATORY,element,true);
    }
  }
  if (baseCRS == null) {
    datum=parseTimeDatum(MANDATORY,element);
  }
  final CoordinateSystem cs;
  try {
    cs=parseCoordinateSystem(element,WKTKeywords.temporal,1,false,unit,datum);
    final Map<String,?> properties=parseMetadataAndClose(element,name,datum);
    if (cs instanceof TimeCS) {
      if (baseCRS != null) {
        return crsFactory.createDerivedCRS(properties,baseCRS,fromBase,cs);
      }
      return crsFactory.createTemporalCRS(properties,datum,(TimeCS)cs);
    }
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
  throw element.illegalCS(cs);
}
Program: 92025
Project: 92025
Buggy source:
/** 
 * Parses a coordinate reference system element.
 * @param element The parent element.
 * @param mandatory {@code true} if a CRS must be present, or {@code false} if optional.
 * @return The next element as a {@code CoordinateReferenceSystem} object.
 * @throws ParseException if the next element can not be parsed.
 */
private CoordinateReferenceSystem parseCoordinateReferenceSystem(final Element element,final boolean mandatory) throws ParseException {
  CoordinateReferenceSystem crs;
  if ((crs=parseGeodeticCRS(FIRST,element,null)) == null && (crs=parseProjectedCRS(FIRST,element,false)) == null && (crs=parseVerticalCRS(FIRST,element,false)) == null && (crs=parseTimeCRS(FIRST,element,false)) == null && (crs=parseEngineeringCRS(FIRST,element,false)) == null && (crs=parseImageCRS(FIRST,element)) == null && (crs=parseCompoundCRS(FIRST,element)) == null && (crs=parseFittedCS(FIRST,element)) == null) {
    if (mandatory) {
      throw element.missingOrUnknownComponent(WKTKeywords.GeodeticCRS);
    }
  }
  return crs;
}

Fixed version (ground truth):
/** 
 * Parses a coordinate reference system element.
 * @param element The parent element.
 * @param mandatory {@code true} if a CRS must be present, or {@code false} if optional.
 * @return The next element as a {@code CoordinateReferenceSystem} object.
 * @throws ParseException if the next element can not be parsed.
 */
private CoordinateReferenceSystem parseCoordinateReferenceSystem(final Element element,final boolean mandatory) throws ParseException {
  CoordinateReferenceSystem crs;
  if ((crs=parseGeodeticCRS(FIRST,element,2,null)) == null && (crs=parseProjectedCRS(FIRST,element,false)) == null && (crs=parseVerticalCRS(FIRST,element,false)) == null && (crs=parseTimeCRS(FIRST,element,false)) == null && (crs=parseEngineeringCRS(FIRST,element,false)) == null && (crs=parseImageCRS(FIRST,element)) == null && (crs=parseCompoundCRS(FIRST,element)) == null && (crs=parseFittedCS(FIRST,element)) == null) {
    if (mandatory) {
      throw element.missingOrUnknownComponent(WKTKeywords.GeodeticCRS);
    }
  }
  return crs;
}
Program: 92026
Project: 92026
Buggy source:
/** 
 * Parses an   {@code "ImageCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification §12</a>.
 * @param mode {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent The parent element.
 * @return The {@code "ImageCRS"} element as an {@link ImageCRS} object.
 * @throws ParseException if the {@code "ImageCRS"} element can not be parsed.
 */
private ImageCRS parseImageCRS(final int mode,final Element parent) throws ParseException {
  final Element element=parent.pullElement(mode,WKTKeywords.ImageCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final ImageDatum datum=parseImageDatum(MANDATORY,element);
  final Unit<?> unit=parseUnit(element);
  try {
    final CoordinateSystem cs=parseCoordinateSystem(element,WKTKeywords.Cartesian,2,false,unit,datum);
    return crsFactory.createImageCRS(parseMetadataAndClose(element,name,datum),datum,(CartesianCS)cs);
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}

Fixed version (ground truth):
/** 
 * Parses an   {@code "ImageCRS"} (WKT 2) element. The syntax is given by<a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification §12</a>.
 * @param mode {@link #FIRST},   {@link #OPTIONAL} or {@link #MANDATORY}.
 * @param parent The parent element.
 * @return The {@code "ImageCRS"} element as an {@link ImageCRS} object.
 * @throws ParseException if the {@code "ImageCRS"} element can not be parsed.
 */
private ImageCRS parseImageCRS(final int mode,final Element parent) throws ParseException {
  final Element element=parent.pullElement(mode,WKTKeywords.ImageCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final ImageDatum datum=parseImageDatum(MANDATORY,element);
  final Unit<?> unit=parseUnit(element);
  final CoordinateSystem cs;
  try {
    cs=parseCoordinateSystem(element,WKTKeywords.Cartesian,2,false,unit,datum);
    final Map<String,?> properties=parseMetadataAndClose(element,name,datum);
    if (cs instanceof CartesianCS) {
      return crsFactory.createImageCRS(properties,datum,(CartesianCS)cs);
    }
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
  throw element.illegalCS(cs);
}
Program: 92031
Project: 92031
Buggy source:
/** 
 * Parses   {@code "TimeCRS"} element.
 * @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 "TimeCRS"} element as a {@link TemporalCRS} object.
 * @throws ParseException if the {@code "TimeCRS"} element can not be parsed.
 */
private TemporalCRS parseTimeCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final TemporalDatum datum=parseTimeDatum(MANDATORY,element);
  final Unit<Duration> timeUnit=parseScaledUnit(element,WKTKeywords.TimeUnit,SI.SECOND);
  try {
    final CoordinateSystem cs=parseCoordinateSystem(element,WKTKeywords.temporal,1,false,timeUnit,datum);
    return crsFactory.createTemporalCRS(parseMetadataAndClose(element,name,datum),datum,(TimeCS)cs);
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
}

Fixed version (ground truth):
/** 
 * Parses   {@code "TimeCRS"} element.
 * @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 "TimeCRS"} element as a {@link TemporalCRS} object.
 * @throws ParseException if the {@code "TimeCRS"} element can not be parsed.
 */
private SingleCRS parseTimeCRS(final int mode,final Element parent,final boolean isBaseCRS) throws ParseException {
  final Element element=parent.pullElement(mode,isBaseCRS ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS);
  if (element == null) {
    return null;
  }
  final String name=element.pullString("String_Node_Str");
  final Unit<Duration> unit=parseScaledUnit(element,WKTKeywords.TimeUnit,SI.SECOND);
  TemporalDatum datum=null;
  SingleCRS baseCRS=null;
  Conversion fromBase=null;
  if (!isBaseCRS) {
    fromBase=parseDerivingConversion(OPTIONAL,element,WKTKeywords.DerivingConversion,null,null);
    if (fromBase != null) {
      baseCRS=parseTimeCRS(MANDATORY,element,true);
    }
  }
  if (baseCRS == null) {
    datum=parseTimeDatum(MANDATORY,element);
  }
  final CoordinateSystem cs;
  try {
    cs=parseCoordinateSystem(element,WKTKeywords.temporal,1,false,unit,datum);
    final Map<String,?> properties=parseMetadataAndClose(element,name,datum);
    if (cs instanceof TimeCS) {
      if (baseCRS != null) {
        return crsFactory.createDerivedCRS(properties,baseCRS,fromBase,cs);
      }
      return crsFactory.createTemporalCRS(properties,datum,(TimeCS)cs);
    }
  }
 catch (  FactoryException exception) {
    throw element.parseFailed(exception);
  }
  throw element.illegalCS(cs);
}
Program: 92033
Project: 92033
Buggy source:
/** 
 * Ensures that storing a feature of the given type is valid for an association expecting the given base type.
 */
final void ensureValid(final FeatureType base,final FeatureType type){
  if (base != type && !DefaultFeatureType.maybeAssignableFrom(base,type)) {
    throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentClass_3,getName(),base.getName(),type.getName()));
  }
}

Fixed version (ground truth):
/** 
 * Ensures that storing a feature of the given type is valid for an association expecting the given base type.
 */
final void ensureValid(final FeatureType base,final FeatureType type){
  if (base != type && !DefaultFeatureType.maybeAssignableFrom(base,type)) {
    throw new InvalidPropertyValueException(Errors.format(Errors.Keys.IllegalArgumentClass_3,getName(),base.getName(),type.getName()));
  }
}
Program: 92034
Project: 92034
Buggy source:
/** 
 * Returns the associated feature, or   {@code null} if none. This convenience method can be invoked inthe common case where the  {@linkplain DefaultAssociationRole#getMaximumOccurs() maximum number} offeatures is restricted to 1 or 0.
 * @return The associated feature (may be {@code null}).
 * @throws IllegalStateException if this association contains more than one value.
 * @see AbstractFeature#getPropertyValue(String)
 */
@Override public abstract Feature getValue();

Fixed version (ground truth):
/** 
 * Returns the associated feature, or   {@code null} if none. This convenience method can be invoked inthe common case where the  {@linkplain DefaultAssociationRole#getMaximumOccurs() maximum number} offeatures is restricted to 1 or 0.
 * @return The associated feature (may be {@code null}).
 * @throws MultiValuedPropertyException if this association contains more than one value.
 * @see AbstractFeature#getPropertyValue(String)
 */
@Override public abstract Feature getValue() throws MultiValuedPropertyException ;
Program: 92035
Project: 92035
Buggy source:
/** 
 * Sets the features. All previous values are replaced by the given collection. <p>The default implementation ensures that the given collection contains at most one element, then delegates to   {@link #setValue(Feature)}.</p>
 * @param values The new values.
 * @throws IllegalArgumentException if the given collection contains too many elements.
 */
@Override public void setValues(final Collection<? extends Feature> values) throws IllegalArgumentException {
  super.setValues(values);
}

Fixed version (ground truth):
/** 
 * Sets the features. All previous values are replaced by the given collection. <p>The default implementation ensures that the given collection contains at most one element, then delegates to   {@link #setValue(Feature)}.</p>
 * @param values The new values.
 * @throws InvalidPropertyValueException if the given collection contains too many elements.
 */
@Override public void setValues(final Collection<? extends Feature> values) throws InvalidPropertyValueException {
  super.setValues(values);
}
Program: 92036
Project: 92036
Buggy source:
/** 
 * Sets the associated feature. <div class="section">Validation</div> The amount of validation performed by this method is implementation dependent. Usually, only the most basic constraints are verified. This is so for performance reasons and also because some rules may be temporarily broken while constructing a feature. A more exhaustive verification can be performed by invoking the   {@link #quality()} method.
 * @param value The new value, or {@code null}.
 * @throws IllegalArgumentException If the given feature is not valid for this association.
 * @see AbstractFeature#setPropertyValue(String,Object)
 */
@Override public abstract void setValue(final Feature value) throws IllegalArgumentException ;

Fixed version (ground truth):
/** 
 * Sets the associated feature. <div class="section">Validation</div> The amount of validation performed by this method is implementation dependent. Usually, only the most basic constraints are verified. This is so for performance reasons and also because some rules may be temporarily broken while constructing a feature. A more exhaustive verification can be performed by invoking the   {@link #quality()} method.
 * @param value The new value, or {@code null}.
 * @throws InvalidPropertyValueException If the given feature is not valid for this association.
 * @see AbstractFeature#setPropertyValue(String,Object)
 */
@Override public abstract void setValue(final Feature value) throws InvalidPropertyValueException ;
Program: 92037
Project: 92037
Buggy source:
/** 
 * Returns the attribute value, or   {@code null} if none. This convenience method can be invoked inthe common case where the  {@linkplain DefaultAttributeType#getMaximumOccurs() maximum number}of attribute values is restricted to 1 or 0.
 * @return The attribute value (may be {@code null}).
 * @throws IllegalStateException if this attribute contains more than one value.
 * @see AbstractFeature#getPropertyValue(String)
 */
@Override public abstract V getValue() throws IllegalStateException ;

Fixed version (ground truth):
/** 
 * Returns the attribute value, or   {@code null} if none. This convenience method can be invoked inthe common case where the  {@linkplain DefaultAttributeType#getMaximumOccurs() maximum number}of attribute values is restricted to 1 or 0.
 * @return The attribute value (may be {@code null}).
 * @throws MultiValuedPropertyException if this attribute contains more than one value.
 * @see AbstractFeature#getPropertyValue(String)
 */
@Override public abstract V getValue() throws MultiValuedPropertyException ;
Program: 92038
Project: 92038
Buggy source:
/** 
 * Sets the attribute values. All previous values are replaced by the given collection. <p>The default implementation ensures that the given collection contains at most one element, then delegates to   {@link #setValue(Object)}.</p>
 * @param values The new values.
 * @throws IllegalArgumentException if the given collection contains too many elements.
 */
@Override public void setValues(final Collection<? extends V> values) throws IllegalArgumentException {
  super.setValues(values);
}

Fixed version (ground truth):
/** 
 * Sets the attribute values. All previous values are replaced by the given collection. <p>The default implementation ensures that the given collection contains at most one element, then delegates to   {@link #setValue(Object)}.</p>
 * @param values The new values.
 * @throws InvalidPropertyValueException if the given collection contains too many elements.
 */
@Override public void setValues(final Collection<? extends V> values) throws InvalidPropertyValueException {
  super.setValues(values);
}
Program: 92039
Project: 92039
Buggy source:
/** 
 * Verifies if the given property can be assigned to this feature.
 * @param name Shall be {@code property.getName().toString()}.
 * @param property The property to verify.
 */
final void verifyPropertyType(final String name,final Property property){
  final PropertyType pt, base=type.getProperty(name);
  if (property instanceof Attribute<?>) {
    pt=((Attribute<?>)property).getType();
  }
 else   if (property instanceof FeatureAssociation) {
    pt=((FeatureAssociation)property).getRole();
  }
 else {
    throw illegalPropertyType(base.getName(),property.getClass());
  }
  if (pt != base) {
    throw new IllegalArgumentException(base == null ? Errors.format(Errors.Keys.PropertyNotFound_2,getName(),name) : Errors.format(Errors.Keys.MismatchedPropertyType_1,name));
  }
}

Fixed version (ground truth):
/** 
 * Verifies if the given property can be assigned to this feature.
 * @param name Shall be {@code property.getName().toString()}.
 * @param property The property to verify.
 */
final void verifyPropertyType(final String name,final Property property){
  final PropertyType pt, base=type.getProperty(name);
  if (property instanceof Attribute<?>) {
    pt=((Attribute<?>)property).getType();
  }
 else   if (property instanceof FeatureAssociation) {
    pt=((FeatureAssociation)property).getRole();
  }
 else {
    throw illegalPropertyType(base.getName(),property.getClass());
  }
  if (pt != base) {
    if (base == null) {
      throw new PropertyNotFoundException(Errors.format(Errors.Keys.PropertyNotFound_2,getName(),name));
    }
 else {
      throw new InvalidPropertyValueException(Errors.format(Errors.Keys.MismatchedPropertyType_1,name));
    }
  }
}
Program: 92040
Project: 92040
Buggy source:
/** 
 * Returns the property (attribute, feature association or operation result) of the given name. If the property type is a parameterless   {@linkplain AbstractOperation operation}, then this method may return the result of   {@linkplain AbstractOperation#apply executing} the operationon this feature, at implementation choice. <div class="note"><b>Tip:</b> This method returns the property <em>instance</em>. If only the property <em>value</em> is desired, then  {@link #getPropertyValue(String)} is preferred since it gives to SIS achance to avoid the creation of  {@link AbstractAttribute} or {@link AbstractAssociation} instances.</div>
 * @param name The property name.
 * @return The property of the given name (never {@code null}).
 * @throws IllegalArgumentException If the given argument is not a property name of this feature.
 * @see #getPropertyValue(String)
 * @see DefaultFeatureType#getProperty(String)
 */
@Override public abstract Property getProperty(final String name) throws IllegalArgumentException ;

Fixed version (ground truth):
/** 
 * Returns the property (attribute, feature association or operation result) of the given name. If the property type is a parameterless   {@linkplain AbstractOperation operation}, then this method may return the result of   {@linkplain AbstractOperation#apply executing} the operationon this feature, at implementation choice. <div class="note"><b>Tip:</b> This method returns the property <em>instance</em>. If only the property <em>value</em> is desired, then  {@link #getPropertyValue(String)} is preferred since it gives to SIS achance to avoid the creation of  {@link AbstractAttribute} or {@link AbstractAssociation} instances.</div>
 * @param name The property name.
 * @return The property of the given name (never {@code null}).
 * @throws PropertyNotFoundException if the given argument is not a property name of this feature.
 * @see #getPropertyValue(String)
 * @see DefaultFeatureType#getProperty(String)
 */
@Override public abstract Property getProperty(final String name) throws PropertyNotFoundException ;
Program: 92041
Project: 92041
Buggy source:
/** 
 * Returns the exception for a property type which neither an attribute or an association. This method is invoked after a   {@link PropertyType} has been found for the user-supplied name,but that property can not be stored in a  {@link Property} instance.
 */
static IllegalArgumentException unsupportedPropertyType(final GenericName name){
  return new IllegalArgumentException(Errors.format(Errors.Keys.CanNotInstantiate_1,name));
}

Fixed version (ground truth):
/** 
 * Returns the exception for a property type which is neither an attribute or an association. This method is invoked after a   {@link PropertyType} has been found for the user-supplied name,but that property can not be stored in or extracted from a  {@link Property} instance.
 */
static IllegalArgumentException unsupportedPropertyType(final GenericName name){
  return new IllegalArgumentException(Errors.format(Errors.Keys.CanNotInstantiate_1,name));
}
Program: 92043
Project: 92043
Buggy source:
/** 
 * Sets the property (attribute or feature association). The given property shall comply to the following conditions: <ul> <li>It must be non-null.</li> <li>Its   {@linkplain Property#getName() name} shall be the name of the property to set in this feature.</li><li>Its type shall be the same instance than the  {@linkplain DefaultFeatureType#getProperty(String) property type} defined by the feature type for the above name.In other words, the following condition shall hold:</li> </ul> {@preformat javaassert property.getType() == getType().getProperty(property.getName());}<div class="note"><b>Note:</b> This method is useful for storing non-default   {@code Attribute} or{@code FeatureAssociation} implementations in this feature. When default implementations are sufficient,the  {@link #setPropertyValue(String,Object)} method is preferred.</div>
 * @param property The property to set.
 * @throws IllegalArgumentException if the type of the given property is not one of the typesknown to this feature, or if the property can not be set of an other reason.
 * @see #setPropertyValue(String,Object)
 */
@Override public abstract void setProperty(final Property property) throws IllegalArgumentException ;

Fixed version (ground truth):
/** 
 * Sets the property (attribute or feature association). The given property shall comply to the following conditions: <ul> <li>It must be non-null.</li> <li>Its   {@linkplain Property#getName() name} shall be the name of the property to set in this feature.</li><li>Its type shall be the same instance than the  {@linkplain DefaultFeatureType#getProperty(String) property type} defined by the feature type for the above name.In other words, the following condition shall hold:</li> </ul> {@preformat javaassert property.getType() == getType().getProperty(property.getName());}<div class="note"><b>Note:</b> This method is useful for storing non-default   {@code Attribute} or{@code FeatureAssociation} implementations in this feature. When default implementations are sufficient,the  {@link #setPropertyValue(String,Object)} method is preferred.</div>
 * @param property The property to set.
 * @throws PropertyNotFoundException if the name of the given property is not a property name of this feature.
 * @throws InvalidPropertyValueException if the value of the given property is not valid.
 * @throws IllegalArgumentException if the property can not be set for another reason.
 * @see #setPropertyValue(String,Object)
 */
@Override public abstract void setProperty(final Property property) throws IllegalArgumentException ;