nus-yam/ex-repair huggingface dataset:
Program: 91665
Project: 91665
Buggy source:
/** 
 * Returns the axis direction that matches the given string, or returns a new one if none match it. More specifically, this methods returns the first instance for which <code>  {@linkplain #name() name()}.  {@linkplain String#equals equals}(code)</code> returns   {@code true}. If no existing instance is found, then a new one is created for the given name.
 * @param code  the name of the code to fetch or to create.
 * @return a code matching the given name.
 */
public static SensorType valueOf(String code){
  return valueOf(SensorType.class,code);
}

Fixed version (ground truth):
/** 
 * Returns the sensor type that matches the given string, or returns a new one if none match it. More specifically, this methods returns the first instance for which <code>  {@linkplain #name() name()}.  {@linkplain String#equals equals}(code)</code> returns   {@code true}. If no existing instance is found, then a new one is created for the given name.
 * @param code  the name of the code to fetch or to create.
 * @return a code matching the given name.
 */
public static SensorType valueOf(String code){
  return valueOf(SensorType.class,code);
}
Program: 91666
Project: 91666
Buggy source:
/** 
 * Sets the   {@code <gco:CharacterString>},   {@code <gmx:FileName>} or {@code <gmx:MimeFileType>} value.<p>This method is invoked by JAXB at unmarshalling time and should not need to be invoked directly.</p>
 */
private void setValue(final Object value){
  if (value instanceof Anchor) {
    setText((Anchor)value,ANCHOR);
  }
 else   if (value instanceof FileName) {
    setText(value.toString(),FILENAME);
  }
 else   if (value instanceof MimeFileType) {
    setText(value.toString(),MIME_TYPE);
  }
 else {
    setText((CharSequence)value,(byte)0);
  }
}

Fixed version (ground truth):
/** 
 * Sets the   {@code <gco:CharacterString>},   {@code <gmx:FileName>} or {@code <gmx:MimeFileType>} value.<p>This method is invoked by JAXB at unmarshalling time and should not need to be invoked directly.</p>
 */
@SuppressWarnings("String_Node_Str") private void setValue(final Object value){
  if (value instanceof Anchor) {
    setText((Anchor)value,ANCHOR);
  }
 else   if (value instanceof FileName) {
    setText(value.toString(),FILENAME);
  }
 else   if (value instanceof MimeFileType) {
    setText(value.toString(),MIME_TYPE);
  }
 else {
    setText((CharSequence)value,(byte)0);
  }
}
Program: 91667
Project: 91667
Buggy source:
/** 
 * Concatenates three transformation steps. If the first and/or the last operation is an   {@link #AXIS_CHANGES}, then it will be included as part of the second operation instead of creating a   {@link ConcatenatedOperation}. If a concatenated operation is created, it will get an automatically generated name.
 * @param step1  the first  step, or {@code null} for the identity operation.
 * @param step2  the second step, or {@code null} for the identity operation.
 * @param step3  the third  step, or {@code null} for the identity operation.
 * @return a concatenated operation, or {@code null} if all arguments were null.
 * @throws FactoryException if the operation can not be constructed.
 */
private CoordinateOperation concatenate(final CoordinateOperation step1,final CoordinateOperation step2,final CoordinateOperation step3) throws FactoryException {
  if (isIdentity(step1))   return concatenate(step2,step3);
  if (isIdentity(step2))   return concatenate(step1,step3);
  if (isIdentity(step3))   return concatenate(step1,step2);
  if (step1.getName() == AXIS_CHANGES)   return concatenate(concatenate(step1,step2),step3);
  if (step3.getName() == AXIS_CHANGES)   return concatenate(step1,concatenate(step2,step3));
  final Map<String,?> properties=defaultName(step1.getSourceCRS(),step3.getTargetCRS());
  return factory.createConcatenatedOperation(properties,step1,step2,step3);
}

Fixed version (ground truth):
/** 
 * Concatenates three transformation steps. If the first and/or the last operation is an   {@link #AXIS_CHANGES}, then it will be included as part of the second operation instead of creating a   {@link ConcatenatedOperation}. If a concatenated operation is created, it will get an automatically generated name.
 * @param step1  the first  step, or {@code null} for the identity operation.
 * @param step2  the second step, or {@code null} for the identity operation.
 * @param step3  the third  step, or {@code null} for the identity operation.
 * @return a concatenated operation, or {@code null} if all arguments were null.
 * @throws FactoryException if the operation can not be constructed.
 */
private CoordinateOperation concatenate(final CoordinateOperation step1,final CoordinateOperation step2,final CoordinateOperation step3) throws FactoryException {
  if (isIdentity(step1))   return concatenate(step2,step3);
  if (isIdentity(step2))   return concatenate(step1,step3);
  if (isIdentity(step3))   return concatenate(step1,step2);
  if (canHide(step1.getName()))   return concatenate(concatenate(step1,step2),step3);
  if (canHide(step3.getName()))   return concatenate(step1,concatenate(step2,step3));
  final Map<String,?> properties=defaultName(step1.getSourceCRS(),step3.getTargetCRS());
  return factory.createConcatenatedOperation(properties,step1,step2,step3);
}
Program: 91668
Project: 91668
Buggy source:
/** 
 * Returns   {@code true} if the specified operation is an identity conversion.This method always returns  {@code false} for transformations even if theirassociated math transform is an identity one, because such transformations are usually datum shift and must be visible.
 */
private static boolean isIdentity(final CoordinateOperation operation){
  return (operation == null) || ((operation instanceof Conversion) && operation.getMathTransform().isIdentity());
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if the specified operation is an identity conversion.This method always returns  {@code false} for transformations even if theirassociated math transform is an identity one, because such transformations are usually datum shift and must be visible.
 */
private static boolean isIdentity(final CoordinateOperation operation){
  if (operation == null) {
    return true;
  }
  if ((operation instanceof Conversion) && operation.getMathTransform().isIdentity()) {
    return CoordinateOperations.wrapAroundChanges(operation).isEmpty();
  }
  return false;
}
Program: 91669
Project: 91669
Buggy source:
/** 
 * Creates a rectangle for the given CRS and coordinate values.
 */
@Override Rectangle2D createFromExtremums(CoordinateReferenceSystem crs,double xmin,double ymin,double xmax,double ymax){
  return new Rectangle2D.Double(xmin,ymin,xmax - xmin,ymax - ymin);
}

Fixed version (ground truth):
/** 
 * Creates a rectangle for the given CRS and coordinate values.
 */
@Override Rectangle2D createFromExtremums(CoordinateReferenceSystem crs,double xmin,double ymin,double xmax,double ymax){
  if (xmin > xmax) {
    final CoordinateSystemAxis axis=crs.getCoordinateSystem().getAxis(0);
    xmin=axis.getMinimumValue();
    xmax=axis.getMaximumValue();
  }
  return new Rectangle2D.Double(xmin,ymin,xmax - xmin,ymax - ymin);
}
Program: 91670
Project: 91670
Buggy source:
/** 
 * Tests transform of an envelope over the ±180° limit. The Mercator projection used in this test is not expected to wrap the longitude around Earth when using only the   {@code MathTransform}. However when the target CRS is known, then "wrap around" should be applied.
 * @throws TransformException if an error occurred while transforming the envelope.
 * @since 0.8
 */
@Test @DependsOnMethod("String_Node_Str") public void testTransformOverAntiMeridian() throws TransformException {
  final ProjectedCRS sourceCRS=HardCodedConversions.mercator();
  final GeographicCRS targetCRS=sourceCRS.getBaseCRS();
  final Conversion conversion=inverse(sourceCRS.getConversionFromBase());
  final G expected=createFromExtremums(targetCRS,179,40,181,50);
  final G rectangle=createFromExtremums(sourceCRS,19926188.852,4838471.398,20148827.834,6413524.594);
  final G actual=transform(conversion,rectangle);
  assertGeometryEquals(expected,actual,ANGULAR_TOLERANCE,ANGULAR_TOLERANCE);
}

Fixed version (ground truth):
/** 
 * Tests transform of an envelope over the ±180° limit. The Mercator projection used in this test is not expected to wrap the longitude around Earth when using only the   {@code MathTransform}. However when the target CRS is known, then "wrap around" should be applied.
 * @throws TransformException if an error occurred while transforming the envelope.
 * @since 0.8
 */
@Test @DependsOnMethod("String_Node_Str") public final void testTransformOverAntiMeridian() throws TransformException {
  final ProjectedCRS sourceCRS=HardCodedConversions.mercator();
  final GeographicCRS targetCRS=sourceCRS.getBaseCRS();
  final Conversion conversion=inverse(sourceCRS.getConversionFromBase());
  final G expected=createFromExtremums(targetCRS,179,40,181,50);
  final G rectangle=createFromExtremums(sourceCRS,19926188.852,4838471.398,20148827.834,6413524.594);
  final G actual=transform(conversion,rectangle);
  assertGeometryEquals(expected,actual,ANGULAR_TOLERANCE,ANGULAR_TOLERANCE);
}
Program: 91671
Project: 91671
Buggy source:
/** 
 * Asserts that two envelopes have the same minimum and maximum ordinates. This method ignores the envelope type (i.e. the implementation class) and the CRS.
 * @param expected    the expected envelope.
 * @param actual      the envelope to compare with the expected one.
 * @param tolerances  the tolerance threshold on location along each axis. If this array length is shorterthan the number of dimensions, then the last tolerance is reused for all remaining axes. If this array is empty, then the tolerance threshold is zero.
 * @since 0.7
 */
public static void assertEnvelopeEquals(final Envelope expected,final Envelope actual,final double... tolerances){
  final int dimension=expected.getDimension();
  assertEquals("String_Node_Str",dimension,actual.getDimension());
  double tolerance=0;
  for (int i=0; i < dimension; i++) {
    if (i < tolerances.length) {
      tolerance=tolerances[i];
    }
    if (abs(expected.getMinimum(i) - actual.getMinimum(i)) > tolerance || abs(expected.getMaximum(i) - actual.getMaximum(i)) > tolerance) {
      fail("String_Node_Str" + "String_Node_Str" + Envelopes.toString(expected) + "String_Node_Str"+ "String_Node_Str"+ Envelopes.toString(actual));
    }
  }
}

Fixed version (ground truth):
/** 
 * Asserts that two envelopes have the same minimum and maximum ordinates. This method ignores the envelope type (i.e. the implementation class) and the CRS.
 * @param expected    the expected envelope.
 * @param actual      the envelope to compare with the expected one.
 * @param tolerances  the tolerance threshold on location along each axis. If this array length is shorterthan the number of dimensions, then the last tolerance is reused for all remaining axes. If this array is empty, then the tolerance threshold is zero.
 * @since 0.7
 */
public static void assertEnvelopeEquals(final Envelope expected,final Envelope actual,final double... tolerances){
  final int dimension=expected.getDimension();
  assertEquals("String_Node_Str",dimension,actual.getDimension());
  final DirectPosition expectedLower=expected.getLowerCorner();
  final DirectPosition expectedUpper=expected.getUpperCorner();
  final DirectPosition actualLower=actual.getLowerCorner();
  final DirectPosition actualUpper=actual.getUpperCorner();
  double tolerance=0;
  for (int i=0; i < dimension; i++) {
    if (i < tolerances.length) {
      tolerance=tolerances[i];
    }
    if (abs(expectedLower.getOrdinate(i) - actualLower.getOrdinate(i)) > tolerance || abs(expectedUpper.getOrdinate(i) - actualUpper.getOrdinate(i)) > tolerance) {
      fail("String_Node_Str" + i + "String_Node_Str"+ "String_Node_Str"+ Envelopes.toString(expected)+ "String_Node_Str"+ "String_Node_Str"+ Envelopes.toString(actual));
    }
  }
}
Program: 91673
Project: 91673
Buggy source:
/** 
 * Asserts that the intersection of the two following envelopes is equals to the given rectangle. First, this method tests using the   {@link Envelope2D} implementation. Then, it tests using the{@link GeneralEnvelope} implementation.
 */
private static void assertIntersectEquals(final GeneralEnvelope e1,final GeneralEnvelope e2,final double xmin,final double ymin,final double xmax,final double ymax){
  final boolean isEmpty=!(((xmax - xmin) * (ymax - ymin)) != 0);
  final Envelope2D r1=new Envelope2D(e1);
  final Envelope2D r2=new Envelope2D(e2);
  final Envelope2D ri=r1.createIntersection(r2);
  assertEquals("String_Node_Str",isEmpty,r1.isEmpty());
  assertEnvelopeEquals(ri,xmin,ymin,xmax,ymax);
  assertEquals("String_Node_Str",ri,r2.createIntersection(r1));
  final GeneralEnvelope ei=new GeneralEnvelope(e1);
  ei.intersect(e2);
  assertEquals("String_Node_Str",isEmpty,e1.isEmpty());
  assertEnvelopeEquals(ei,xmin,ymin,xmax,ymax);
  assertTrue("String_Node_Str",ei.equals(ri,STRICT,false));
  ei.setEnvelope(e2);
  ei.intersect(e1);
  assertEquals("String_Node_Str",isEmpty,e1.isEmpty());
  assertEnvelopeEquals(ei,xmin,ymin,xmax,ymax);
  assertTrue("String_Node_Str",ei.equals(ri,STRICT,false));
}

Fixed version (ground truth):
/** 
 * Asserts that the intersection of the two following envelopes is equals to the given rectangle. First, this method tests using the   {@link Envelope2D} implementation. Then, it tests using the{@link GeneralEnvelope} implementation.
 */
private static void assertIntersectEquals(final GeneralEnvelope e1,final GeneralEnvelope e2,final double xmin,final double ymin,final double xmax,final double ymax){
  final Envelope2D r1=new Envelope2D(e1);
  final Envelope2D r2=new Envelope2D(e2);
  final Envelope2D ri=r1.createIntersection(r2);
  assertFalse("String_Node_Str",r1.isEmpty());
  assertEnvelopeEquals(ri,xmin,ymin,xmax,ymax);
  assertEquals("String_Node_Str",ri,r2.createIntersection(r1));
  final GeneralEnvelope ei=new GeneralEnvelope(e1);
  ei.intersect(e2);
  assertFalse("String_Node_Str",e1.isEmpty());
  assertEnvelopeEquals(ei,xmin,ymin,xmax,ymax);
  assertTrue("String_Node_Str",ei.equals(ri,STRICT,false));
  ei.setEnvelope(e2);
  ei.intersect(e1);
  assertFalse("String_Node_Str",e1.isEmpty());
  assertEnvelopeEquals(ei,xmin,ymin,xmax,ymax);
  assertTrue("String_Node_Str",ei.equals(ri,STRICT,false));
}
Program: 91674
Project: 91674
Buggy source:
/** 
 * Tests the   {@link GeneralEnvelope#intersect(Envelope)} and{@link Envelope2D#createIntersection(Rectangle2D)} methods.
 */
@Test public void testIntersection(){
  final GeneralEnvelope e1=create(20,-20,80,10);
  final GeneralEnvelope e2=create(40,-10,62,8);
  assertIntersectEquals(e1,e2,40,-10,62,8);
  e1.setEnvelope(20,-20,80,12);
  e2.setEnvelope(40,-10,100,30);
  final double ymin=-10, ymax=12;
  assertIntersectEquals(e1,e2,40,ymin,80,ymax);
  e1.setRange(0,80,20);
  e2.setRange(0,100,18);
  assertIntersectEquals(e1,e2,100,ymin,18,ymax);
  e2.setRange(0,100,90);
  assertIntersectEquals(e1,e2,100,ymin,20,ymax);
  e2.setRange(0,10,30);
  assertIntersectEquals(e1,e2,10,ymin,20,ymax);
  e2.setRange(0,10,16);
  assertIntersectEquals(e1,e2,10,ymin,16,ymax);
  e2.setRange(0,40,60);
  assertIntersectEquals(e1,e2,NaN,ymin,NaN,ymax);
  e2.setRange(0,10,90);
  assertIntersectEquals(e1,e2,NaN,ymin,NaN,ymax);
  verifyInvariants(e1);
  verifyInvariants(e2);
}

Fixed version (ground truth):
/** 
 * Tests the   {@link GeneralEnvelope#intersect(Envelope)} and{@link Envelope2D#createIntersection(Rectangle2D)} methods.
 */
@Test public void testIntersection(){
  final GeneralEnvelope e1=create(20,-20,80,10);
  final GeneralEnvelope e2=create(40,-10,62,8);
  assertIntersectEquals(e1,e2,40,-10,62,8);
  e1.setEnvelope(20,-20,80,12);
  e2.setEnvelope(40,-10,100,30);
  final double ymin=-10, ymax=12;
  assertIntersectEquals(e1,e2,40,ymin,80,ymax);
  e1.setRange(0,80,20);
  e2.setRange(0,100,18);
  assertIntersectEquals(e1,e2,100,ymin,18,ymax);
  e2.setRange(0,100,90);
  assertIntersectEquals(e1,e2,100,ymin,20,ymax);
  e2.setRange(0,10,30);
  assertIntersectEquals(e1,e2,10,ymin,20,ymax);
  e2.setRange(0,10,16);
  assertIntersectEquals(e1,e2,10,ymin,16,ymax);
  e2.setRange(0,40,60);
  assertIntersectEquals(e1,e2,NaN,ymin,NaN,ymax);
  e2.setRange(0,10,90);
  assertIntersectEquals(e1,e2,NaN,ymin,NaN,ymax);
  e1.setRange(0,0.0,-0.0);
  e2.setRange(0,-10,30);
  assertIntersectEquals(e1,e2,-10,ymin,30,ymax);
  e1.setRange(0,0.0,-0.0);
  e2.setRange(0,0.0,-0.0);
  assertIntersectEquals(e1,e2,0.0,ymin,-0.0,ymax);
  verifyInvariants(e1);
  verifyInvariants(e2);
}
Program: 91675
Project: 91675
Buggy source:
/** 
 * Computes the latitude using equation 3-18 from Synder, followed by iterative resolution of Synder 3-16. In theory, the series expansion given by equation 3-18 (φ ≈ c₂⋅sin(2β) + c₄⋅sin(4β) + c₈⋅sin(8β)) should be used in replacement of the iterative method. However in practice the series expansion seems to not have a sufficient amount of terms for achieving the centimetric precision, so we "finish" it by the iterative method. The series expansion is nevertheless useful for reducing the number of iterations.
 * @param y  in the cylindrical case, this is northing on the normalized ellipsoid.
 * @return the latitude in radians.
 */
final double φ(final double y) throws ProjectionException {
}

Fixed version (ground truth):
/** 
 * Computes the latitude using equation 3-18 from Snyder, followed by iterative resolution of Snyder 3-16. In theory, the series expansion given by equation 3-18 (φ ≈ c₂⋅sin(2β) + c₄⋅sin(4β) + c₈⋅sin(8β)) should be used in replacement of the iterative method. However in practice the series expansion seems to not have a sufficient amount of terms for achieving the centimetric precision, so we "finish" it by the iterative method. The series expansion is nevertheless useful for reducing the number of iterations.
 * @param y  in the cylindrical case, this is northing on the normalized ellipsoid.
 * @return the latitude in radians.
 */
final double φ(final double y) throws ProjectionException {
}
Program: 91678
Project: 91678
Buggy source:
/** 
 * Finds the authority code for the given coordinate reference system. This method does not trust the code given by the user in its CRS - we verify it. This method may return a code even if the axis order does not match; it will be caller's responsibility to make necessary adjustments.
 */
private String findCode(final CoordinateReferenceSystem crs) throws FactoryException {
  if (codeFinder != null) {
    final Identifier identifier=IdentifiedObjects.getIdentifier(codeFinder.findSingleton(crs),null);
    if (identifier != null) {
      return identifier.getCode();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Finds the authority codes for the given coordinate reference system. This method does not trust the code given by the user in its CRS - we verify it. This method may return codes even if the axis order does not match; it will be caller's responsibility to make necessary adjustments.
 */
private List<String> findCode(final CoordinateReferenceSystem crs) throws FactoryException {
  final List<String> codes=new ArrayList<>();
  if (codeFinder != null) {
    for (    final IdentifiedObject candidate : codeFinder.find(crs)) {
      final Identifier identifier=IdentifiedObjects.getIdentifier(candidate,registry.getAuthority());
      if (identifier != null) {
        final String code=identifier.getCode();
        if (Utilities.deepEquals(candidate,crs,ComparisonMode.APPROXIMATIVE)) {
          codes.add(0,code);
        }
 else {
          codes.add(code);
        }
      }
    }
  }
  return codes;
}
Program: 91679
Project: 91679
Buggy source:
/** 
 * Creates a new test case.
 * @throws FactoryException if an error occurred while creating the factory to be tested.
 */
public CoordinateOperationRegistryTest() throws FactoryException {
  final CRSAuthorityFactory crsFactory=CRS.getAuthorityFactory("String_Node_Str");
  assumeTrue("String_Node_Str",crsFactory instanceof CoordinateOperationAuthorityFactory);
  registry=new CoordinateOperationRegistry((CoordinateOperationAuthorityFactory)crsFactory,factory,null);
}

Fixed version (ground truth):
/** 
 * Creates a new test case.
 * @throws FactoryException if an error occurred while creating the factory to be tested.
 */
public CoordinateOperationRegistryTest() throws FactoryException {
  crsFactory=CRS.getAuthorityFactory("String_Node_Str");
  assumeTrue("String_Node_Str",crsFactory instanceof CoordinateOperationAuthorityFactory);
  registry=new CoordinateOperationRegistry((CoordinateOperationAuthorityFactory)crsFactory,factory,null);
}
Program: 91680
Project: 91680
Buggy source:
/** 
 * Sets restrictions on the access and use of data.
 * @param newValues  the new metadata constraints.
 */
public void setMetadataConstraints(final Collection<? extends Constraints> newValues){
  metadataConstraints=writeCollection(newValues,metadataConstraints,Constraints.class);
}

Fixed version (ground truth):
/** 
 * Sets restrictions on the access and use of metadata.
 * @param newValues  the new metadata constraints.
 * @see org.apache.sis.metadata.iso.identification.AbstractIdentification#setResourceConstraints(Collection)
 */
public void setMetadataConstraints(final Collection<? extends Constraints> newValues){
  metadataConstraints=writeCollection(newValues,metadataConstraints,Constraints.class);
}
Program: 91681
Project: 91681
Buggy source:
/** 
 * Sets information about the frequency of metadata updates, and the scope of those updates.
 * @param newValue  the new metadata maintenance.
 */
public void setMetadataMaintenance(final MaintenanceInformation newValue){
  checkWritePermission();
  metadataMaintenance=newValue;
}

Fixed version (ground truth):
/** 
 * Sets information about the frequency of metadata updates, and the scope of those updates.
 * @param newValue  the new metadata maintenance.
 * @see org.apache.sis.metadata.iso.identification.AbstractIdentification#setResourceMaintenances(Collection)
 */
public void setMetadataMaintenance(final MaintenanceInformation newValue){
  checkWritePermission();
  metadataMaintenance=newValue;
}
Program: 91682
Project: 91682
Buggy source:
/** 
 * Returns restrictions on the access and use of data.
 * @return restrictions on the access and use of data.
 */
@Override @XmlElement(name="String_Node_Str") public Collection<Constraints> getMetadataConstraints(){
  return metadataConstraints=nonNullCollection(metadataConstraints,Constraints.class);
}

Fixed version (ground truth):
/** 
 * Returns restrictions on the access and use of metadata.
 * @return restrictions on the access and use of metadata.
 * @see org.apache.sis.metadata.iso.identification.AbstractIdentification#getResourceConstraints()
 */
@Override @XmlElement(name="String_Node_Str") public Collection<Constraints> getMetadataConstraints(){
  return metadataConstraints=nonNullCollection(metadataConstraints,Constraints.class);
}
Program: 91683
Project: 91683
Buggy source:
/** 
 * Returns information about the frequency of metadata updates, and the scope of those updates.
 * @return the frequency of metadata updates and their scope, or {@code null}.
 */
@Override @XmlElement(name="String_Node_Str") public MaintenanceInformation getMetadataMaintenance(){
  return metadataMaintenance;
}

Fixed version (ground truth):
/** 
 * Returns information about the frequency of metadata updates, and the scope of those updates.
 * @return the frequency of metadata updates and their scope, or {@code null}.
 * @see org.apache.sis.metadata.iso.identification.AbstractIdentification#getResourceMaintenances()
 */
@Override @XmlElement(name="String_Node_Str") public MaintenanceInformation getMetadataMaintenance(){
  return metadataMaintenance;
}
Program: 91684
Project: 91684
Buggy source:
/** 
 * Restrictions on the access and use of data.
 */
@Override public Collection<Constraints> getMetadataConstraints(){
  return Collections.emptyList();
}

Fixed version (ground truth):
/** 
 * Restrictions on the access and use of metadata.
 */
@Override public Collection<Constraints> getMetadataConstraints(){
  return Collections.emptyList();
}
Program: 91687
Project: 91687
Buggy source:
/** 
 * Creates a sub-type of the "city" type with only one additional property, a string giving the parliament name. The feature contains the following attribute: <ul> <li>  {@code city}       as a  {@link String}  (mandatory)</li><li> {@code population} as an {@link Integer} (mandatory)</li><li> {@code parliament} as a  {@link String}  (mandatory)</li></ul>
 * @return the feature for a capital.
 */
public static DefaultFeatureType capital(){
  return new DefaultFeatureType(singletonMap(DefaultFeatureType.NAME_KEY,"String_Node_Str"),false,new DefaultFeatureType[]{city()},DefaultAttributeTypeTest.parliament());
}

Fixed version (ground truth):
/** 
 * Creates a sub-type of the "city" type with only one additional property, a string giving the parliament name. The feature contains the following attribute: <ul> <li>  {@code city}       as a  {@link String}  (mandatory)</li><li> {@code population} as an {@link Integer} (mandatory)</li><li> {@code parliament} as a  {@link String}  (mandatory)</li></ul>
 * @return the feature for a capital.
 */
public static DefaultFeatureType capital(){
  return new DefaultFeatureType(name("String_Node_Str"),false,new DefaultFeatureType[]{city()},DefaultAttributeTypeTest.parliament());
}
Program: 91689
Project: 91689
Buggy source:
/** 
 * Creates a simple feature type without super-types. The feature contains the following attributes: <ul> <li>  {@code city}       as a  {@link String}  (mandatory)</li><li> {@code population} as an {@link Integer} (mandatory)</li></ul>
 * @return the feature for a city.
 */
public static DefaultFeatureType city(){
  final Map<String,Object> identification=new HashMap<>();
  final DefaultAttributeType<String> city=DefaultAttributeTypeTest.city(identification);
  final DefaultAttributeType<Integer> population=DefaultAttributeTypeTest.population(identification);
  identification.clear();
  assertNull(identification.put(DefaultFeatureType.NAME_KEY,"String_Node_Str"));
  return new DefaultFeatureType(identification,false,null,city,population);
}

Fixed version (ground truth):
/** 
 * Creates a simple feature type without super-types. The feature contains the following attributes: <ul> <li>  {@code city}       as a  {@link String}  (mandatory)</li><li> {@code population} as an {@link Integer} (mandatory)</li></ul>
 * @return the feature for a city.
 */
public static DefaultFeatureType city(){
  final Map<String,Object> identification=new HashMap<>();
  final DefaultAttributeType<String> city=DefaultAttributeTypeTest.city(identification);
  final DefaultAttributeType<Integer> population=DefaultAttributeTypeTest.population(identification);
  return new DefaultFeatureType(name("String_Node_Str"),false,null,city,population);
}
Program: 91690
Project: 91690
Buggy source:
/** 
 * Creates a sub-type of the "city" type with two additional properties. The feature contains the following attribute: <ul> <li>  {@code city}       as a  {@link String}       (mandatory)</li><li> {@code population} as an {@link Integer}      (mandatory)</li><li> {@code region}     as a  {@link CharSequence} (mandatory) — the region for which the city is a metropolis.</li><li> {@code isGlobal}   as a  {@link Boolean}      (mandatory) — whether the city has an effect on global affairs.</li></ul>
 * @return the feature for a metropolis.
 */
public static DefaultFeatureType metropolis(){
  final Map<String,Object> identification=new HashMap<>(4);
  assertNull(identification.put(DefaultFeatureType.NAME_KEY,"String_Node_Str"));
  assertNull(identification.put(DefaultFeatureType.NAME_KEY + "String_Node_Str","String_Node_Str"));
  return new DefaultFeatureType(identification,false,new DefaultFeatureType[]{city()},new DefaultAttributeType<>(singletonMap(DefaultAttributeType.NAME_KEY,"String_Node_Str"),CharSequence.class,1,1,null),new DefaultAttributeType<>(singletonMap(DefaultAttributeType.NAME_KEY,"String_Node_Str"),Boolean.class,1,1,null));
}

Fixed version (ground truth):
/** 
 * Creates a sub-type of the "city" type with two additional properties. The feature contains the following attribute: <ul> <li>  {@code city}       as a  {@link String}       (mandatory)</li><li> {@code population} as an {@link Integer}      (mandatory)</li><li> {@code region}     as a  {@link CharSequence} (mandatory) — the region for which the city is a metropolis.</li><li> {@code isGlobal}   as a  {@link Boolean}      (mandatory) — whether the city has an effect on global affairs.</li></ul>
 * @return the feature for a metropolis.
 */
public static DefaultFeatureType metropolis(){
  final Map<String,Object> identification=new HashMap<>(4);
  assertNull(identification.put(DefaultFeatureType.NAME_KEY,"String_Node_Str"));
  assertNull(identification.put(DefaultFeatureType.NAME_KEY + "String_Node_Str","String_Node_Str"));
  return new DefaultFeatureType(identification,false,new DefaultFeatureType[]{city()},new DefaultAttributeType<>(name("String_Node_Str"),CharSequence.class,1,1,null),new DefaultAttributeType<>(name("String_Node_Str"),Boolean.class,1,1,null));
}
Program: 91691
Project: 91691
Buggy source:
/** 
 * Creates a sub-type of the "metropolis" type with the "region" attribute overridden to the given type. The given type should be   {@link InternationalString}, but we allow other types for testing argument checks.
 */
private static DefaultFeatureType worldMetropolis(final DefaultFeatureType metropolis,final DefaultFeatureType universityCity,final DefaultAttributeType<?> temperature,final Class<?> regionType){
  return new DefaultFeatureType(singletonMap(DefaultFeatureType.NAME_KEY,"String_Node_Str"),false,new DefaultFeatureType[]{metropolis,universityCity},new DefaultAttributeType<?>[]{new DefaultAttributeType<>(singletonMap(DefaultAttributeType.NAME_KEY,"String_Node_Str"),regionType,1,1,null),temperature});
}

Fixed version (ground truth):
/** 
 * Creates a sub-type of the "metropolis" type with the "region" attribute overridden to the given type. The given type should be   {@link InternationalString}, but we allow other types for testing argument checks.
 */
private static DefaultFeatureType worldMetropolis(final DefaultFeatureType metropolis,final DefaultFeatureType universityCity,final DefaultAttributeType<?> temperature,final Class<?> regionType){
  return new DefaultFeatureType(name("String_Node_Str"),false,new DefaultFeatureType[]{metropolis,universityCity},new DefaultAttributeType<?>[]{new DefaultAttributeType<>(name("String_Node_Str"),regionType,1,1,null),temperature});
}
Program: 91692
Project: 91692
Buggy source:
/** 
 * Creates a sub-type of the "city" type with only one additional property, an arbitrary amount of strings. The feature contains the following attribute: <ul> <li>  {@code city}         as a  {@link String}  (mandatory)</li><li> {@code population}   as an {@link Integer} (mandatory)</li><li> {@code universities} as an arbitrary amount of {@link String}</li> </ul>
 * @return the feature for an university city.
 */
public static DefaultFeatureType universityCity(){
  return new DefaultFeatureType(singletonMap(DefaultFeatureType.NAME_KEY,"String_Node_Str"),false,new DefaultFeatureType[]{city()},DefaultAttributeTypeTest.universities());
}

Fixed version (ground truth):
/** 
 * Creates a sub-type of the "city" type with only one additional property, an arbitrary amount of strings. The feature contains the following attribute: <ul> <li>  {@code city}         as a  {@link String}  (mandatory)</li><li> {@code population}   as an {@link Integer} (mandatory)</li><li> {@code universities} as an arbitrary amount of {@link String}</li> </ul>
 * @return the feature for an university city.
 */
public static DefaultFeatureType universityCity(){
  return new DefaultFeatureType(name("String_Node_Str"),false,new DefaultFeatureType[]{city()},DefaultAttributeTypeTest.universities());
}
Program: 91693
Project: 91693
Buggy source:
/** 
 * Tests the ommission of a property that duplicate a property already declared in the parent. This is a little bit different than   {@link #testPropertyOverride()} since the duplicated propertyshould be completely omitted.
 */
@Test @DependsOnMethod("String_Node_Str") public void testPropertyDuplication(){
  DefaultFeatureType city=city();
  city=new DefaultFeatureType(singletonMap(DefaultFeatureType.NAME_KEY,"String_Node_Str"),false,new DefaultFeatureType[]{city()},city.getProperty("String_Node_Str"));
  assertPropertiesEquals(city,false);
  assertPropertiesEquals(city,true,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Tests the ommission of a property that duplicate a property already declared in the parent. This is a little bit different than   {@link #testPropertyOverride()} since the duplicated propertyshould be completely omitted.
 */
@Test @DependsOnMethod("String_Node_Str") public void testPropertyDuplication(){
  DefaultFeatureType city=city();
  city=new DefaultFeatureType(name("String_Node_Str"),false,new DefaultFeatureType[]{city()},city.getProperty("String_Node_Str"));
  assertPropertiesEquals(city,false);
  assertPropertiesEquals(city,true,"String_Node_Str","String_Node_Str");
}
Program: 91694
Project: 91694
Buggy source:
/** 
 * Tests inclusion of a property of kind operation.
 */
@Test public void testOperationProperty(){
  final Map<String,String> featureName=singletonMap(DefaultFeatureType.NAME_KEY,"String_Node_Str");
  final Map<String,String> identifierName=singletonMap(DefaultAttributeType.NAME_KEY,"String_Node_Str");
  final DefaultFeatureType[] parent={city()};
  final DefaultFeatureType city=new DefaultFeatureType(featureName,false,parent,new LinkOperation(identifierName,parent[0].getProperty("String_Node_Str")));
  assertPropertiesEquals(city,true,"String_Node_Str","String_Node_Str","String_Node_Str");
  final PropertyType parliament=new LinkOperation(identifierName,DefaultAttributeTypeTest.parliament());
  try {
    final DefaultFeatureType illegal=new DefaultFeatureType(featureName,false,parent,parliament);
    fail("String_Node_Str" + illegal);
  }
 catch (  IllegalArgumentException e) {
    final String message=e.getLocalizedMessage();
    assertTrue(message,message.contains("String_Node_Str"));
    assertTrue(message,message.contains("String_Node_Str"));
    assertTrue(message,message.contains("String_Node_Str"));
  }
}

Fixed version (ground truth):
/** 
 * Tests inclusion of a property of kind operation.
 */
@Test public void testOperationProperty(){
  final Map<String,?> featureName=name("String_Node_Str");
  final Map<String,?> identifierName=name("String_Node_Str");
  final DefaultFeatureType[] parent={city()};
  final DefaultFeatureType city=new DefaultFeatureType(featureName,false,parent,new LinkOperation(identifierName,parent[0].getProperty("String_Node_Str")));
  assertPropertiesEquals(city,true,"String_Node_Str","String_Node_Str","String_Node_Str");
  final PropertyType parliament=new LinkOperation(identifierName,DefaultAttributeTypeTest.parliament());
  try {
    final DefaultFeatureType illegal=new DefaultFeatureType(featureName,false,parent,parliament);
    fail("String_Node_Str" + illegal);
  }
 catch (  IllegalArgumentException e) {
    final String message=e.getLocalizedMessage();
    assertTrue(message,message.contains("String_Node_Str"));
    assertTrue(message,message.contains("String_Node_Str"));
    assertTrue(message,message.contains("String_Node_Str"));
  }
}
Program: 91696
Project: 91696
Buggy source:
/** 
 * Ensures that we can not use two properties with the same name.
 */
@Test @DependsOnMethod("String_Node_Str") public void testNameCollision(){
  final DefaultAttributeType<String> city=new DefaultAttributeType<>(singletonMap(DefaultAttributeType.NAME_KEY,"String_Node_Str"),String.class,1,1,null);
  final DefaultAttributeType<Integer> cityId=new DefaultAttributeType<>(singletonMap(DefaultAttributeType.NAME_KEY,"String_Node_Str"),Integer.class,1,1,null);
  final DefaultAttributeType<Integer> population=new DefaultAttributeType<>(singletonMap(DefaultAttributeType.NAME_KEY,"String_Node_Str"),Integer.class,1,1,null);
  final Map<String,String> identification=singletonMap(DefaultAttributeType.NAME_KEY,"String_Node_Str");
  try {
    final Object t=new DefaultFeatureType(identification,false,null,city,population,cityId);
    fail("String_Node_Str" + t);
  }
 catch (  IllegalArgumentException e) {
    final String message=e.getMessage();
    assertTrue(message,message.contains("String_Node_Str"));
    assertTrue(message,message.contains("String_Node_Str"));
  }
}

Fixed version (ground truth):
/** 
 * Ensures that we can not use two properties with the same name.
 */
@Test @DependsOnMethod("String_Node_Str") public void testNameCollision(){
  final DefaultAttributeType<String> city=new DefaultAttributeType<>(name("String_Node_Str"),String.class,1,1,null);
  final DefaultAttributeType<Integer> cityId=new DefaultAttributeType<>(name("String_Node_Str"),Integer.class,1,1,null);
  final DefaultAttributeType<Integer> population=new DefaultAttributeType<>(name("String_Node_Str"),Integer.class,1,1,null);
  try {
    final Object t=new DefaultFeatureType(name("String_Node_Str"),false,null,city,population,cityId);
    fail("String_Node_Str" + t);
  }
 catch (  IllegalArgumentException e) {
    final String message=e.getMessage();
    assertTrue(message,message.contains("String_Node_Str"));
    assertTrue(message,message.contains("String_Node_Str"));
  }
}
Program: 91698
Project: 91698
Buggy source:
/** 
 * Adds a value for the given name if none exist. If a previous value already exists for the given name, then an exception is thrown.
 * @param store  the data store for which to add a value, or {@code null} if unknown.
 * @param name   the name for which to add a value.
 * @param value  the value to add (can not be null).
 * @throws IllegalNameException if another element is already registered for the given name.
 */
public void add(final DataStore store,GenericName name,final E value) throws IllegalNameException {
  ArgumentChecks.ensureNonNull("String_Node_Str",name);
  ArgumentChecks.ensureNonNull("String_Node_Str",value);
  final String key=name.toString();
  if (values.putIfAbsent(key,value) != null) {
    throw new IllegalNameException(locale(store),Resources.Keys.FeatureAlreadyPresent_2,name(store),key);
  }
  while (name instanceof ScopedName) {
    name=((ScopedName)name).tail();
    final String alias=name.toString();
    if (CollectionsExt.addToMultiValuesMap(aliases,alias,key).size() > 1) {
      values.remove(alias);
    }
 else     if (values.put(alias,value) != null) {
      throw new ConcurrentModificationException(name(store).toString());
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds a value for the given name if none exist. If a previous value already exists for the given name, then an exception is thrown.
 * @param store  the data store for which to add a value, or {@code null} if unknown.
 * @param name   the name for which to add a value.
 * @param value  the value to add (can not be null).
 * @throws IllegalNameException if another element is already registered for the given name.
 */
public void add(final DataStore store,GenericName name,final E value) throws IllegalNameException {
}
Program: 91699
Project: 91699
Buggy source:
/** 
 * Constructs an operation from the given properties. The identification map is given unchanged to the   {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map) super-class constructor}. The following table is a reminder of main (not all) recognized map entries: <table class="sis"> <caption>Recognized map entries (non exhaustive list)</caption> <tr> <th>Map key</th> <th>Value type</th> <th>Returned by</th> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#NAME_KEY}</td> <td>  {@link GenericName} or {@link String}</td> <td>  {@link #getName()}</td> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#DEFINITION_KEY}</td> <td>  {@link InternationalString} or {@link String}</td> <td>  {@link #getDefinition()}</td> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#DESIGNATION_KEY}</td> <td>  {@link InternationalString} or {@link String}</td> <td>  {@link #getDesignation()}</td> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#DESCRIPTION_KEY}</td> <td>  {@link InternationalString} or {@link String}</td> <td>  {@link #getDescription()}</td> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#DEPRECATED_KEY}</td> <td>  {@link Boolean}</td> <td>  {@link #isDeprecated()}</td> </tr> </table>
 * @param identification  the name and other information to be given to this operation.
 */
public AbstractOperation(final Map<String,?> identification){
  super(identification);
}

Fixed version (ground truth):
/** 
 * Constructs an operation from the given properties. The identification map is given unchanged to the   {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map) super-class constructor}. The following table is a reminder of main (not all) recognized map entries: <table class="sis"> <caption>Recognized map entries (non exhaustive list)</caption> <tr> <th>Map key</th> <th>Value type</th> <th>Returned by</th> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#NAME_KEY}</td> <td>  {@link GenericName} or {@link String}</td> <td>  {@link #getName()}</td> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#DEFINITION_KEY}</td> <td>  {@link org.opengis.util.InternationalString} or {@link String}</td> <td>  {@link #getDefinition()}</td> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#DESIGNATION_KEY}</td> <td>  {@link org.opengis.util.InternationalString} or {@link String}</td> <td>  {@link #getDesignation()}</td> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#DESCRIPTION_KEY}</td> <td>  {@link org.opengis.util.InternationalString} or {@link String}</td> <td>  {@link #getDescription()}</td> </tr> <tr> <td>  {@value org.apache.sis.feature.AbstractIdentifiedType#DEPRECATED_KEY}</td> <td>  {@link Boolean}</td> <td>  {@link #isDeprecated()}</td> </tr> </table>
 * @param identification  the name and other information to be given to this operation.
 */
public AbstractOperation(final Map<String,?> identification){
  super(identification);
}
Program: 91702
Project: 91702
Buggy source:
/** 
 * Tests   {@link DefaultOperation#toString()}.
 */
@Test public void testToString(){
  assertEquals("String_Node_Str",foundCity().toString());
}

Fixed version (ground truth):
/** 
 * Tests   {@link AbstractOperation#toString()}.
 */
@Test public void testToString(){
  assertEquals("String_Node_Str",foundCity().toString());
}
Program: 91703
Project: 91703
Buggy source:
/** 
 * Tests serialization of   {@link DefaultOperation}.
 */
@Test public void testSerialization(){
  assertSerializedEquals(foundCity());
}

Fixed version (ground truth):
/** 
 * Tests serialization of   {@link AbstractOperation}.
 */
@Test public void testSerialization(){
  assertSerializedEquals(foundCity());
}
Program: 91704
Project: 91704
Buggy source:
/** 
 * Fix the spelling of words that changed between ISO 19115:2003 and ISO 19115:2014, then wraps the value into an adapter. <p>The spelling of "license" was changed to "licence" in latest standard, but XML marshalling shall use the previous spelling until XML schema are updated.</p>
 * @param value  the value version of {@link CodeList}, to be marshalled.
 * @return the wrapper for the code list value.
 */
@Override protected MD_RestrictionCode wrap(final CodeListUID value){
  if ("String_Node_Str".equals(value.codeListValue)) {
    value.codeListValue="String_Node_Str";
  }
  return new MD_RestrictionCode(value);
}

Fixed version (ground truth):
/** 
 * Fix the spelling of words that changed between ISO 19115:2003 and ISO 19115:2014, then wraps the value into an adapter. <p>The spelling of "license" was changed to "licence" in latest standard, but XML marshalling shall use the previous spelling until XML schema are updated.</p>
 * @param value  the value version of {@link org.opengis.util.CodeList}, to be marshalled.
 * @return the wrapper for the code list value.
 */
@Override protected MD_RestrictionCode wrap(final CodeListUID value){
  if ("String_Node_Str".equals(value.codeListValue)) {
    value.codeListValue="String_Node_Str";
  }
  return new MD_RestrictionCode(value);
}
Program: 91705
Project: 91705
Buggy source:
/** 
 * Returns information about the Apache SIS configuration to be reported in   {@link org.apache.sis.setup.About}. This method is invoked only for aspects that depends on other modules than   {@code sis-utility}. <p>Current keys are:</p> <ul> <li>  {@code "EPSG"}: version of EPSG database.</li> </ul>
 * @param key     a key identifying the information to return.
 * @param locale  language to use if possible.
 * @return the information, or {@code null} if none.
 * @see org.apache.sis.internal.util.MetadataServices#getInformation(String)
 * @since 0.7
 */
public String getInformation(String key,Locale locale){
  return null;
}

Fixed version (ground truth):
/** 
 * Returns information about the Apache SIS configuration to be reported in   {@link org.apache.sis.setup.About}. This method is invoked only for aspects that depends on other modules than   {@code sis-utility}. <p>Current keys are:</p> <ul> <li>  {@code "EPSG"}: version of EPSG database.</li> </ul>
 * @param key     a key identifying the information to return.
 * @param locale  language to use if possible.
 * @return the information, or {@code null} if none.
 * @see org.apache.sis.internal.util.MetadataServices#getInformation(String,Locale)
 * @since 0.7
 */
public String getInformation(String key,Locale locale){
  return null;
}
Program: 91706
Project: 91706
Buggy source:
/** 
 * For subclass only. This constructor registers this instance as a   {@link SystemListener}in order to force a new   {@code ReferencingServices} lookup if the classpath changes.
 */
protected ReferencingServices(){
  super(Modules.METADATA,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * For subclass only. This constructor registers this instance as a  {@link org.apache.sis.internal.system.SystemListener} in order toforce a new  {@code ReferencingServices} lookup if the classpath changes.
 */
protected ReferencingServices(){
  super(Modules.METADATA,"String_Node_Str");
}
Program: 91708
Project: 91708
Buggy source:
/** 
 * Declares this metadata and all its properties as unmodifiable. Any attempt to modify a property after this method call will throw an   {@link UnmodifiableMetadataException}. If this metadata is already unmodifiable, then this method does nothing. <p>Subclasses usually do not need to override this method since the default implementation performs most of its work using Java reflection.</p>
 */
@Override public void freeze(){
  if (isModifiable()) {
    final Collection<Identifier> p=identifiers;
    super.freeze();
    if (p == identifiers) {
      identifiers=CollectionsExt.unmodifiableOrCopy(p);
    }
  }
}

Fixed version (ground truth):
/** 
 * Declares this metadata and all its properties as unmodifiable. Any attempt to modify a property after this method call will throw an   {@link org.apache.sis.metadata.UnmodifiableMetadataException}. If this metadata is already unmodifiable, then this method does nothing. <p>Subclasses usually do not need to override this method since the default implementation performs most of its work using Java reflection.</p>
 */
@Override public void freeze(){
  if (isModifiable()) {
    final Collection<Identifier> p=identifiers;
    super.freeze();
    if (p == identifiers) {
      identifiers=CollectionsExt.unmodifiableOrCopy(p);
    }
  }
}
Program: 91709
Project: 91709
Buggy source:
/** 
 * Tests the   {@link VerticalDatumTypes#toLegacy(int)} method.
 */
@Test public void testToLegacy(){
  assertEquals(2002,VerticalDatumTypes.toLegacy(VerticalDatumTypes.ELLIPSOIDAL));
  assertEquals(2005,VerticalDatumTypes.toLegacy(VerticalDatumType.GEOIDAL));
  assertEquals(2006,VerticalDatumTypes.toLegacy(VerticalDatumType.DEPTH));
}

Fixed version (ground truth):
/** 
 * Tests the   {@link VerticalDatumTypes#toLegacy(VerticalDatumType)} method.
 */
@Test public void testToLegacy(){
  assertEquals(2002,VerticalDatumTypes.toLegacy(VerticalDatumTypes.ELLIPSOIDAL));
  assertEquals(2005,VerticalDatumTypes.toLegacy(VerticalDatumType.GEOIDAL));
  assertEquals(2006,VerticalDatumTypes.toLegacy(VerticalDatumType.DEPTH));
}