nus-yam/ex-repair huggingface dataset:
Program: 91810
Project: 91810
Buggy source:
/** 
 * Invoked when the data source associated to   {@code "jdbc/SpatialMetadata"} changed.This method clears the  {@link Initializer#source}, unregisters this listener and notifies other SIS modules.
 * @param event Ignored. May be null.
 */
@Override public void objectChanged(NamingEvent event){
  try {
synchronized (Initializer.class) {
      source=null;
      Shutdown.unregister(this);
      context.removeNamingListener(this);
    }
  }
 catch (  NamingException e) {
    Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM),Listener.class,"String_Node_Str",e);
  }
  for (  Initializer init : DefaultFactories.createServiceLoader(Initializer.class)) {
    init.dataSourceChanged();
  }
}

Fixed version (ground truth):
/** 
 * Invoked when the data source associated to   {@code "jdbc/SpatialMetadata"} changed.This method clears the  {@link Initializer#source}, unregisters this listener and notifies other SIS modules.
 * @param event  ignored. Can be null.
 */
@Override public void objectChanged(NamingEvent event){
  try {
synchronized (Initializer.class) {
      source=null;
      connected=false;
      Shutdown.unregister(this);
      context.removeNamingListener(this);
    }
  }
 catch (  NamingException e) {
    Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM),Listener.class,"String_Node_Str",e);
  }
  for (  Initializer init : DefaultFactories.createServiceLoader(Initializer.class)) {
    init.dataSourceChanged();
  }
}
Program: 91811
Project: 91811
Buggy source:
/** 
 * Invoked when the JVM is shutting down, or when the Servlet or OSGi bundle is uninstalled. This method shutdowns the Derby database.
 * @throws ReflectiveOperationException if an error occurred whilesetting the shutdown property on the Derby data source.
 */
private static synchronized void shutdown() throws ReflectiveOperationException {
  final DataSource ds=source;
  if (ds != null) {
    source=null;
    ds.getClass().getMethod("String_Node_Str",String.class).invoke(ds,"String_Node_Str");
    try {
      ds.getConnection().close();
    }
 catch (    SQLException e) {
      final LogRecord record=new LogRecord(Level.FINE,e.getLocalizedMessage());
      if (!isSuccessfulShutdown(e)) {
        record.setLevel(Level.WARNING);
        record.setThrown(e);
      }
      record.setLoggerName(Loggers.SQL);
      Logging.log(Initializer.class,"String_Node_Str",record);
    }
  }
}

Fixed version (ground truth):
/** 
 * Invoked when the JVM is shutting down, or when the Servlet or OSGi bundle is uninstalled. This method shutdowns the Derby database.
 * @throws ReflectiveOperationException if an error occurred whilesetting the shutdown property on the Derby data source.
 */
private static synchronized void shutdown() throws ReflectiveOperationException {
  final DataSource ds=source;
  if (ds != null) {
    source=null;
    connected=false;
    ds.getClass().getMethod("String_Node_Str",String.class).invoke(ds,"String_Node_Str");
    try {
      ds.getConnection().close();
    }
 catch (    SQLException e) {
      final LogRecord record=new LogRecord(Level.FINE,e.getLocalizedMessage());
      if (!isSuccessfulShutdown(e)) {
        record.setLevel(Level.WARNING);
        record.setThrown(e);
      }
      record.setLoggerName(Loggers.SQL);
      Logging.log(Initializer.class,"String_Node_Str",record);
    }
  }
}
Program: 91812
Project: 91812
Buggy source:
/** 
 * Returns a string like the given string but with all characters that are not letter or digit replaced by the wildcard % character. <p>This method avoid to put a % symbol as the first character, since it prevent some databases to use their index.</p>
 * @param identifier The identifier to get as a SQL LIKE pattern.
 * @return The given identifier as a SQL LIKE pattern.
 */
public static String toLikePattern(final String identifier){
  boolean isLetterOrDigit=false;
  final StringBuilder buffer=new StringBuilder(identifier.length());
  for (int c, i=0; i < identifier.length(); i+=Character.charCount(c)) {
    c=identifier.codePointAt(i);
    if (Character.isLetterOrDigit(c)) {
      buffer.appendCodePoint(c);
      isLetterOrDigit=true;
    }
 else     if (isLetterOrDigit) {
      isLetterOrDigit=false;
      buffer.append('%');
    }
 else {
      final int p=buffer.length();
      if (p == 0 || buffer.charAt(p - 1) != '%') {
        buffer.appendCodePoint(c != '%' ? c : '_');
      }
    }
  }
  return buffer.toString();
}

Fixed version (ground truth):
/** 
 * Returns a string like the given string but with all characters that are not letter or digit replaced by the wildcard % character. <p>This method avoid to put a % symbol as the first character, since it prevent some databases to use their index.</p>
 * @param identifier the identifier to get as a SQL LIKE pattern.
 * @return the given identifier as a SQL LIKE pattern.
 */
public static String toLikePattern(final String identifier){
  boolean isLetterOrDigit=false;
  final StringBuilder buffer=new StringBuilder(identifier.length());
  for (int c, i=0; i < identifier.length(); i+=Character.charCount(c)) {
    c=identifier.codePointAt(i);
    if (Character.isLetterOrDigit(c)) {
      buffer.appendCodePoint(c);
      isLetterOrDigit=true;
    }
 else     if (isLetterOrDigit) {
      isLetterOrDigit=false;
      buffer.append('%');
    }
 else {
      final int p=buffer.length();
      if (p == 0 || buffer.charAt(p - 1) != '%') {
        buffer.appendCodePoint(c != '%' ? c : '_');
      }
    }
  }
  return buffer.toString();
}
Program: 91813
Project: 91813
Buggy source:
/** 
 * Returns a simplified form of the URL (truncated before the first   {@code ?} or {@code ;} character),for logging or informative purpose only.
 * @param metadata The metadata of the database.
 * @return A simplified version of database URL.
 * @throws SQLException if an error occurred while fetching the URL.
 */
public static String getSimplifiedURL(final DatabaseMetaData metadata) throws SQLException {
  String url=metadata.getURL();
  int s1=url.indexOf('?');
  if (s1 < 0)   s1=url.length();
  int s2=url.indexOf(';');
  if (s2 < 0)   s2=url.length();
  return url.substring(0,Math.min(s1,s2));
}

Fixed version (ground truth):
/** 
 * Returns a simplified form of the URL (truncated before the first   {@code ?} or {@code ;} character),for logging or informative purpose only.
 * @param metadata  the metadata of the database.
 * @return a simplified version of database URL.
 * @throws SQLException if an error occurred while fetching the URL.
 */
public static String getSimplifiedURL(final DatabaseMetaData metadata) throws SQLException {
  String url=metadata.getURL();
  int s1=url.indexOf('?');
  if (s1 < 0)   s1=url.length();
  int s2=url.indexOf(';');
  if (s2 < 0)   s2=url.length();
  return url.substring(0,Math.min(s1,s2));
}
Program: 91814
Project: 91814
Buggy source:
/** 
 * Workaround for what seems to be a Derby 10.11 bug, which seems to behave as if the LIKE pattern had a trailing % wildcard. This can be verified with the following query on the EPSG database:  {@preformat sqlSELECT COORD_REF_SYS_CODE, COORD_REF_SYS_NAME FROM EPSG."Coordinate Reference System" WHERE COORD_REF_SYS_NAME LIKE 'NTF%Paris%Lambert%zone%I'}which returns "NTF (Paris) / Lambert zone I" as expected but also zones II and III.
 * @param expected The string to search.
 * @param actual The string found in the database.
 * @return {@code true} if the given string can be accepted.
 */
@Workaround(library="String_Node_Str",version="String_Node_Str") public static boolean filterFalsePositive(final String expected,final String actual){
  return CharSequences.equalsFiltered(expected,actual,Characters.Filter.LETTERS_AND_DIGITS,false);
}

Fixed version (ground truth):
/** 
 * Workaround for what seems to be a Derby 10.11 bug, which seems to behave as if the LIKE pattern had a trailing % wildcard. This can be verified with the following query on the EPSG database:  {@preformat sqlSELECT COORD_REF_SYS_CODE, COORD_REF_SYS_NAME FROM EPSG."Coordinate Reference System" WHERE COORD_REF_SYS_NAME LIKE 'NTF%Paris%Lambert%zone%I'}which returns "NTF (Paris) / Lambert zone I" as expected but also zones II and III.
 * @param expected  the string to search.
 * @param actual    the string found in the database.
 * @return {@code true} if the given string can be accepted.
 */
@Workaround(library="String_Node_Str",version="String_Node_Str") public static boolean filterFalsePositive(final String expected,final String actual){
  return CharSequences.equalsFiltered(expected,actual,Characters.Filter.LETTERS_AND_DIGITS,false);
}
Program: 91815
Project: 91815
Buggy source:
/** 
 * Invoked on deserialization for returning a unique instance of   {@code UnitDimension}.
 */
Object readResolve() throws ObjectStreamException {
  final UnitDimension dim=POOL.putIfAbsent(components,this);
  return (dim != null) ? dim : this;
}

Fixed version (ground truth):
/** 
 * Invoked on deserialization for returning a unique instance of   {@code UnitDimension}.
 */
Object readResolve() throws ObjectStreamException {
  if (isDimensionless())   return NONE;
  final UnitDimension dim=POOL.putIfAbsent(components,this);
  return (dim != null) ? dim : this;
}
Program: 91816
Project: 91816
Buggy source:
/** 
 * Compares this dimension with the given object for equality.
 */
@Override public boolean equals(final Object other){
  if (other == this) {
    return true;
  }
  if (other instanceof UnitDimension) {
    final UnitDimension that=(UnitDimension)other;
    if (symbol == that.symbol) {
      return (symbol == 0) || components.equals(that.components);
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Compares this dimension with the given object for equality.
 */
@Override public boolean equals(final Object other){
  if (other == this) {
    return true;
  }
  if (other instanceof UnitDimension) {
    final UnitDimension that=(UnitDimension)other;
    if (symbol == that.symbol) {
      return (symbol != 0) || components.equals(that.components);
    }
  }
  return false;
}
Program: 91817
Project: 91817
Buggy source:
/** 
 * Creates a new derived dimension from the given product of base dimensions with their power. This method returns a shared instance if possible.
 * @param components  the product of base dimensions together with their power.
 */
private static UnitDimension create(Map<UnitDimension,Fraction> components){
switch (components.size()) {
case 0:
    return NONE;
case 1:
{
    final Map.Entry<UnitDimension,Fraction> entry=components.entrySet().iterator().next();
    final UnitDimension base=entry.getKey();
    final Fraction power=entry.getValue();
    if (power.numerator == 1 && power.denominator == 1) {
      return base;
    }
    break;
  }
}
UnitDimension dim=POOL.get(components);
if (dim == null) {
components.replaceAll((c,power) -> power.unique());
components=CollectionsExt.unmodifiableOrCopy(components);
dim=new UnitDimension(components);
final UnitDimension c=POOL.putIfAbsent(components,dim);
if (c != null) {
  return c;
}
}
return dim;
}

Fixed version (ground truth):
/** 
 * Creates a new derived dimension from the given product of base dimensions with their power. This method returns a shared instance if possible.
 * @param components  the product of base dimensions together with their power.
 */
private static UnitDimension create(Map<UnitDimension,Fraction> components){
switch (components.size()) {
case 0:
    return NONE;
case 1:
{
    final Map.Entry<UnitDimension,Fraction> entry=components.entrySet().iterator().next();
    final Fraction power=entry.getValue();
    if (power.numerator == 1 && power.denominator == 1) {
      return entry.getKey();
    }
    break;
  }
}
UnitDimension dim=POOL.get(components);
if (dim == null) {
components.replaceAll((c,power) -> power.unique());
components=CollectionsExt.unmodifiableOrCopy(components);
dim=new UnitDimension(components);
final UnitDimension c=POOL.putIfAbsent(components,dim);
if (c != null) {
  return c;
}
}
return dim;
}
Program: 91818
Project: 91818
Buggy source:
/** 
 * Creates a new derived dimension. This constructor shall never be invoked directly; use   {@link #create(Map)} instead.
 * @param components  the product of base dimensions together with their power.
 */
private UnitDimension(final Map<UnitDimension,Fraction> components){
  this.components=components;
  this.symbol=0;
}

Fixed version (ground truth):
/** 
 * Creates a new derived dimension. This constructor shall never be invoked directly (except for   {@link #NONE}); use   {@link #create(Map)} instead.
 * @param components  the product of base dimensions together with their power.
 */
private UnitDimension(final Map<UnitDimension,Fraction> components){
  this.components=components;
  this.symbol=0;
}
Program: 91819
Project: 91819
Buggy source:
/** 
 * Formats a single unit or dimension raised to the given power.
 * @param entry    the base unit or base dimension to format, together with its power.
 * @param inverse  {@code true} for inverting the power sign.
 */
private static void formatComponent(final Map.Entry<?,? extends Number> entry,final boolean inverse,final Appendable toAppendTo) throws IOException {
  formatSymbol(entry.getKey(),toAppendTo);
  final Number power=entry.getValue();
  int n;
  if (power instanceof Fraction) {
    Fraction f=(Fraction)power;
    if (f.denominator != 1) {
      if (inverse) {
        f=f.negate();
      }
      final String t=f.toString();
      if (t.length() == 1) {
        toAppendTo.append('^').append(t);
      }
 else {
        toAppendTo.append("String_Node_Str").append(t).append(')');
      }
    }
    n=f.numerator;
  }
 else {
    n=power.intValue();
  }
  if (inverse)   n=-n;
  if (n != 1) {
    final String t=String.valueOf(n);
    for (int i=0; i < t.length(); i++) {
      toAppendTo.append(Characters.toSuperScript(t.charAt(i)));
    }
  }
}

Fixed version (ground truth):
/** 
 * Formats a single unit or dimension raised to the given power.
 * @param entry    the base unit or base dimension to format, together with its power.
 * @param inverse  {@code true} for inverting the power sign.
 */
private static void formatComponent(final Map.Entry<?,? extends Number> entry,final boolean inverse,final Appendable toAppendTo) throws IOException {
  formatSymbol(entry.getKey(),toAppendTo);
  final Number power=entry.getValue();
  int n;
  if (power instanceof Fraction) {
    Fraction f=(Fraction)power;
    if (f.denominator != 1) {
      if (inverse) {
        f=f.negate();
      }
      final String t=f.toString();
      if (t.length() == 1) {
        toAppendTo.append('^').append(t);
      }
 else {
        toAppendTo.append("String_Node_Str").append(t).append(')');
      }
      return;
    }
    n=f.numerator;
  }
 else {
    n=power.intValue();
  }
  if (inverse)   n=-n;
  if (n != 1) {
    final String t=String.valueOf(n);
    for (int i=0; i < t.length(); i++) {
      toAppendTo.append(Characters.toSuperScript(t.charAt(i)));
    }
  }
}
Program: 91821
Project: 91821
Buggy source:
/** 
 * Creates a new   {@code FeatureAssociationRole} builder initialized to the values of an existing association.
 * @param owner  the builder of the {@code FeatureType} for which to add this property.
 */
AssociationRoleBuilder(final FeatureTypeBuilder owner,final FeatureAssociationRole template){
  super(owner,template);
  minimumOccurs=template.getMinimumOccurs();
  maximumOccurs=template.getMaximumOccurs();
  type=template.getValueType();
  typeName=type.getName();
}

Fixed version (ground truth):
/** 
 * Creates a new   {@code FeatureAssociationRole} builder initialized to the values of an existing association.
 * @param owner  the builder of the {@code FeatureType} for which to add this property.
 */
AssociationRoleBuilder(final FeatureTypeBuilder owner,final FeatureAssociationRole template){
  super(owner,template);
  property=template;
  minimumOccurs=template.getMinimumOccurs();
  maximumOccurs=template.getMaximumOccurs();
  type=template.getValueType();
  typeName=type.getName();
}
Program: 91822
Project: 91822
Buggy source:
/** 
 * Creates a new   {@code AttributeType} builder initialized to the values of an existing attribute.
 * @param owner  the builder of the {@code FeatureType} for which to add the attribute.
 */
AttributeTypeBuilder(final FeatureTypeBuilder owner,final AttributeType<V> template){
  super(owner,template);
  minimumOccurs=template.getMinimumOccurs();
  maximumOccurs=template.getMaximumOccurs();
  valueClass=template.getValueClass();
  defaultValue=template.getDefaultValue();
  final Map<String,AttributeType<?>> tc=template.characteristics();
  characteristics=new ArrayList<>(tc.size());
  for (  final AttributeType<?> c : tc.values()) {
    characteristics.add(new CharacteristicTypeBuilder<>(this,c));
  }
}

Fixed version (ground truth):
/** 
 * Creates a new   {@code AttributeType} builder initialized to the values of an existing attribute.
 * @param owner  the builder of the {@code FeatureType} for which to add the attribute.
 */
AttributeTypeBuilder(final FeatureTypeBuilder owner,final AttributeType<V> template){
  super(owner,template);
  property=template;
  minimumOccurs=template.getMinimumOccurs();
  maximumOccurs=template.getMaximumOccurs();
  valueClass=template.getValueClass();
  defaultValue=template.getDefaultValue();
  final Map<String,AttributeType<?>> tc=template.characteristics();
  characteristics=new ArrayList<>(tc.size());
  for (  final AttributeType<?> c : tc.values()) {
    characteristics.add(new CharacteristicTypeBuilder<>(this,c));
  }
}
Program: 91823
Project: 91823
Buggy source:
/** 
 * Sets the class of attribute values. Callers <strong>must</strong> use the builder returned by this method instead of   {@code this} builder after this method call, since the returned builder may be a new instance.
 * @param < N >   the compile-time value of the {@code type} argument.
 * @param type  the new class of attribute values.
 * @return the attribute builder — <em>not necessarily this instance.</em>
 * @throws UnconvertibleObjectException if the {@linkplain #getDefaultValue() default value}can not be converted to the given   {@code <N>} class.
 * @see #getValueClass()
 */
@SuppressWarnings("String_Node_Str") public <N>AttributeTypeBuilder<N> setValueClass(final Class<N> type) throws UnconvertibleObjectException {
  final FeatureTypeBuilder owner=owner();
  ensureNonNull("String_Node_Str",type);
  if (type == valueClass) {
    return (AttributeTypeBuilder<N>)this;
  }
  final AttributeTypeBuilder<N> newb=new AttributeTypeBuilder<>(this,type);
  for (  final CharacteristicTypeBuilder<?> c : characteristics) {
    c.owner(newb);
  }
  owner.properties.set(owner.properties.lastIndexOf(this),newb);
  dispose();
  return newb;
}

Fixed version (ground truth):
/** 
 * Sets the class of attribute values. Callers <strong>must</strong> use the builder returned by this method instead of   {@code this} builder after this method call, since the returned builder may be a new instance.
 * @param < N >   the compile-time value of the {@code type} argument.
 * @param type  the new class of attribute values.
 * @return the attribute builder — <em>not necessarily this instance.</em>
 * @throws UnconvertibleObjectException if the {@linkplain #getDefaultValue() default value}can not be converted to the given   {@code <N>} class.
 * @see #getValueClass()
 */
@SuppressWarnings("String_Node_Str") public <N>AttributeTypeBuilder<N> setValueClass(final Class<N> type) throws UnconvertibleObjectException {
  final FeatureTypeBuilder owner=owner();
  ensureNonNull("String_Node_Str",type);
  if (type == valueClass) {
    return (AttributeTypeBuilder<N>)this;
  }
  final AttributeTypeBuilder<N> newb=new AttributeTypeBuilder<>(this,type);
  for (  final CharacteristicTypeBuilder<?> c : characteristics) {
    c.owner(newb);
  }
  owner.replace(this,newb);
  dispose();
  return newb;
}
Program: 91824
Project: 91824
Buggy source:
/** 
 * Creates a new characteristic builder initialized to the values of an existing attribute.
 * @param owner  the builder of the {@code AttributeType} for which to add this property.
 */
CharacteristicTypeBuilder(final AttributeTypeBuilder<?> owner,final AttributeType<V> template){
  super(template,owner.getLocale());
  this.owner=owner;
  valueClass=template.getValueClass();
  defaultValue=template.getDefaultValue();
  characteristic=template;
}

Fixed version (ground truth):
/** 
 * Creates a new characteristic builder initialized to the values of an existing attribute.
 * @param owner  the builder of the {@code AttributeType} for which to add this property.
 */
CharacteristicTypeBuilder(final AttributeTypeBuilder<?> owner,final AttributeType<V> template){
  super(template,owner.getLocale());
  this.owner=owner;
  characteristic=template;
  valueClass=template.getValueClass();
  defaultValue=template.getDefaultValue();
}
Program: 91825
Project: 91825
Buggy source:
/** 
 * Creates a new characteristic from the current setting.
 */
final AttributeType<V> build(){
  if (characteristic == null) {
    characteristic=new DefaultAttributeType<>(identification(),valueClass,0,1,defaultValue);
  }
  return characteristic;
}

Fixed version (ground truth):
/** 
 * Builds the characteristic type from the information specified to this builder. If a type has already been built and this builder state has not changed since the type creation, then the previously created   {@code AttributeType} instance is returned.
 * @return the characteristic type.
 */
@Override public AttributeType<V> build(){
  if (characteristic == null) {
    characteristic=new DefaultAttributeType<>(identification(),valueClass,0,1,defaultValue);
  }
  return characteristic;
}
Program: 91827
Project: 91827
Buggy source:
/** 
 * Helper method for creating identification info of synthetic attributes.
 */
static Map<String,?> name(final GenericName name){
  return Collections.singletonMap(AbstractOperation.NAME_KEY,name);
}

Fixed version (ground truth):
/** 
 * Helper method for creating identification info of synthetic attributes.
 */
private static Map<String,?> name(final GenericName name){
  return Collections.singletonMap(AbstractOperation.NAME_KEY,name);
}
Program: 91828
Project: 91828
Buggy source:
/** 
 * Creates a new   {@code PropertyType} builder initialized to the values of an existing property.
 * @param owner     the builder of the {@code FeatureType} for which to add this property.
 * @param template  an existing property to use as a template, or {@code null} if none.
 */
PropertyTypeBuilder(final FeatureTypeBuilder owner,final PropertyType template){
  super(template,owner.getLocale());
  this.owner=owner;
  minimumOccurs=owner.defaultMinimumOccurs;
  maximumOccurs=owner.defaultMaximumOccurs;
  property=template;
}

Fixed version (ground truth):
/** 
 * Creates a new   {@code PropertyType} builder initialized to the values of an existing property.
 * @param owner     the builder of the {@code FeatureType} for which to add this property.
 * @param template  an existing property to use as a template, or {@code null} if none.
 */
PropertyTypeBuilder(final FeatureTypeBuilder owner,final PropertyType template){
  super(template,owner.getLocale());
  this.owner=owner;
  minimumOccurs=owner.defaultMinimumOccurs;
  maximumOccurs=owner.defaultMaximumOccurs;
}
Program: 91829
Project: 91829
Buggy source:
/** 
 * Returns the property type from the current setting. This method may return an existing property if it was already created.
 */
final PropertyType build(){
  if (property == null) {
    property=create();
  }
  return property;
}

Fixed version (ground truth):
/** 
 * Builds the property type from the information specified to this builder. If a type has already been built and this builder state has not changed since the type creation, then the previously created   {@code PropertyType} instance is returned(see  {@link AttributeTypeBuilder#build()} for more information).
 * @return the property type.
 * @throws IllegalStateException if the builder contains inconsistent information.
 */
@Override public abstract PropertyType build() throws IllegalStateException ;
Program: 91830
Project: 91830
Buggy source:
/** 
 * If the   {@code PropertyType} created by the last call to {@link #build()} has been cached,clears that cache. This method must be invoked every time that a setter method is invoked.
 */
@Override final void clearCache(){
  property=null;
  ensureAlive(owner);
  owner.clearCache();
}

Fixed version (ground truth):
/** 
 * If the   {@code PropertyType} created by the last call to {@link #build()} has been cached,clears that cache. This method must be invoked every time that a setter method is invoked.
 */
@Override void clearCache(){
  ensureAlive(owner);
  owner.clearCache();
}
Program: 91831
Project: 91831
Buggy source:
/** 
 * Removes this property from the   {@code FeatureTypeBuilder}. After this method has been invoked, this   {@code PropertyTypeBuilder} instanceis no longer in the list returned by  {@link FeatureTypeBuilder#properties()}and attempts to invoke any setter method on   {@code this} will cause an{@link IllegalStateException} to be thrown.
 */
public void remove(){
  if (owner != null) {
    owner.properties.remove(owner.properties.lastIndexOf(this));
    dispose();
  }
}

Fixed version (ground truth):
/** 
 * Removes this property from the   {@code FeatureTypeBuilder}. After this method has been invoked, this   {@code PropertyTypeBuilder} instanceis no longer in the list returned by  {@link FeatureTypeBuilder#properties()}and attempts to invoke any setter method on   {@code this} will cause an{@link IllegalStateException} to be thrown.
 */
public void remove(){
  if (owner != null) {
    owner.replace(this,null);
    dispose();
  }
}
Program: 91832
Project: 91832
Buggy source:
/** 
 * Computes a hash code value for this transform.
 */
@Override protected int computeHashCode(){
  return super.hashCode() ^ Arrays.hashCode(values);
}

Fixed version (ground truth):
/** 
 * Computes a hash code value for this transform.
 */
@Override protected int computeHashCode(){
  return super.computeHashCode() ^ Arrays.hashCode(values);
}
Program: 91833
Project: 91833
Buggy source:
/** 
 * Adds the specified range to the specified sequence.
 * @param sequence  The {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
 * @param lower     The lower value of the range to add, inclusive.
 * @param upper     The upper value of the range to add, exclusive.
 * @param max       The maximal value allowed, exclusive.
 * @throws IllegalArgumentException if the {@code lower} or {@code upper} value does not meet the conditions.
 */
private static int[] add(int[] sequence,final int lower,final int upper,final int max) throws IllegalArgumentException {
}

Fixed version (ground truth):
/** 
 * Adds the specified range to the specified sequence.
 * @param sequence  the {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
 * @param lower     the lower value of the range to add, inclusive.
 * @param upper     the upper value of the range to add, exclusive.
 * @param max       the maximal value allowed, exclusive.
 * @throws IllegalArgumentException if the {@code lower} or {@code upper} value does not meet the conditions.
 */
private static int[] add(int[] sequence,final int lower,final int upper,final int max) throws IllegalArgumentException {
}
Program: 91834
Project: 91834
Buggy source:
/** 
 * Adds a range of input dimensions to keep in the separated transform. The   {@code lower} and {@code upper} values define a range of  <em>source</em> dimension indicesof the transform given to the constructor.
 * @param lower The lower dimension, inclusive. Shall not be smaller than 0.
 * @param upper The upper dimension, exclusive. Shall be smaller than {@link MathTransform#getSourceDimensions()}.
 * @throws IllegalArgumentException if {@code lower} or {@code upper} are out of bounds.
 */
public void addSourceDimensionRange(final int lower,final int upper) throws IllegalArgumentException {
  sourceDimensions=add(sourceDimensions,lower,upper,transform.getSourceDimensions());
}

Fixed version (ground truth):
/** 
 * Adds a range of input dimensions to keep in the separated transform. The   {@code lower} and {@code upper} values define a range of  <em>source</em> dimension indicesof the transform given to the constructor.
 * @param lower  the lower dimension, inclusive. Shall not be smaller than 0.
 * @param upper  the upper dimension, exclusive. Shall be smaller than {@link MathTransform#getSourceDimensions()}.
 * @throws IllegalArgumentException if {@code lower} or {@code upper} are out of bounds.
 */
public void addSourceDimensionRange(final int lower,final int upper) throws IllegalArgumentException {
  sourceDimensions=add(sourceDimensions,lower,upper,transform.getSourceDimensions());
}
Program: 91835
Project: 91835
Buggy source:
/** 
 * Adds output dimensions to keep in the separated transform. The given values are <em>target</em> dimension indices of the transform given to the constructor. <p>Constraints:</p> <ul> <li>All numbers shall be in the range 0 inclusive to   {@link MathTransform#getTargetDimensions()} exclusive.</li><li>The  {@code dimensions} values shall be in strictly increasing order.</li><li>The  {@code dimensions} values shall be greater than all values specified by all previous callsof this method since construction or since the last call to  {@link #clear()}.</li> </ul>
 * @param dimensions A sequence of target dimensions to keep, in strictly increasing order.
 * @throws IllegalArgumentException if {@code dimensions} contains negative valuesor if values are not in a strictly increasing order.
 */
public void addTargetDimensions(final int... dimensions) throws IllegalArgumentException {
  ArgumentChecks.ensureNonNull("String_Node_Str",dimensions);
  targetDimensions=add(targetDimensions,dimensions,transform.getTargetDimensions());
}

Fixed version (ground truth):
/** 
 * Adds output dimensions to keep in the separated transform. The given values are <em>target</em> dimension indices of the transform given to the constructor. <p>Constraints:</p> <ul> <li>All numbers shall be in the range 0 inclusive to   {@link MathTransform#getTargetDimensions()} exclusive.</li><li>The  {@code dimensions} values shall be in strictly increasing order.</li><li>The  {@code dimensions} values shall be greater than all values specified by all previous callsof this method since construction or since the last call to  {@link #clear()}.</li> </ul>
 * @param dimensions  a sequence of target dimensions to keep, in strictly increasing order.
 * @throws IllegalArgumentException if {@code dimensions} contains negative valuesor if values are not in a strictly increasing order.
 */
public void addTargetDimensions(final int... dimensions) throws IllegalArgumentException {
  ArgumentChecks.ensureNonNull("String_Node_Str",dimensions);
  targetDimensions=add(targetDimensions,dimensions,transform.getTargetDimensions());
}
Program: 91836
Project: 91836
Buggy source:
/** 
 * Separates the math transform specified at construction time for given dimension indices. This method creates a math transform that use only the   {@linkplain #addSourceDimensions(int) specifiedsource dimensions} and return only the {@linkplain #addTargetDimensions(int) specified target dimensions}. If the source or target dimensions were not specified, then they will be inferred as below: <ul class="verbose"> <li>If source dimensions were unspecified, then the returned transform will keep at least all source dimensions needed for computing the specified target dimensions. In many cases the returned transform unconditionally keep all source dimensions, but not necessarily. If all source dimensions need to be kept, it is better to   {@linkplain #addSourceDimensionRange(int,int) specify that explicitely}.</li> <li>If target dimensions were unspecified, then the returned transform will expect only the specified source dimensions as inputs, and the target dimensions will be inferred automatically.</li> </ul> The source and target dimensions actually used can be queried by calls to   {@link #getSourceDimensions()}or   {@link #getTargetDimensions()} after this {@code separate()} method.
 * @return The separated math transform.
 * @throws FactoryException if the transform can not be separated.
 */
public MathTransform separate() throws FactoryException {
}

Fixed version (ground truth):
/** 
 * Separates the math transform specified at construction time for given dimension indices. This method creates a math transform that use only the   {@linkplain #addSourceDimensions(int) specifiedsource dimensions} and return only the {@linkplain #addTargetDimensions(int) specified target dimensions}. If the source or target dimensions were not specified, then they will be inferred as below: <ul class="verbose"> <li>If source dimensions were unspecified, then the returned transform will keep at least all source dimensions needed for computing the specified target dimensions. In many cases the returned transform unconditionally keep all source dimensions, but not necessarily. If all source dimensions need to be kept, it is better to   {@linkplain #addSourceDimensionRange(int,int) specify that explicitely}.</li> <li>If target dimensions were unspecified, then the returned transform will expect only the specified source dimensions as inputs, and the target dimensions will be inferred automatically.</li> </ul> The source and target dimensions actually used can be queried by calls to   {@link #getSourceDimensions()}or   {@link #getTargetDimensions()} after this {@code separate()} method.
 * @return the separated math transform.
 * @throws FactoryException if the transform can not be separated.
 */
public MathTransform separate() throws FactoryException {
}
Program: 91837
Project: 91837
Buggy source:
/** 
 * Returns   {@code true} if the given sequence contains all index in the range {@code lower} inclusiveto  {@code upper} exclusive.
 * @param sequence The {@link #sourceDimensions} or {@link #targetDimensions} sequence to test.
 * @param lower    The lower value, inclusive.
 * @param upper    The upper value, exclusive.
 * @return {@code true} if the full range was found in the sequence.
 */
private static boolean containsAll(final int[] sequence,final int lower,int upper){
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if the given sequence contains all index in the range {@code lower} inclusiveto  {@code upper} exclusive.
 * @param sequence  the {@link #sourceDimensions} or {@link #targetDimensions} sequence to test.
 * @param lower     the lower value, inclusive.
 * @param upper     the upper value, exclusive.
 * @return {@code true} if the full range was found in the sequence.
 */
private static boolean containsAll(final int[] sequence,final int lower,int upper){
}
Program: 91839
Project: 91839
Buggy source:
/** 
 * Returns   {@code true} if the given sequence contains any value in the given range.
 * @param sequence The {@link #sourceDimensions} or {@link #targetDimensions} sequence to test.
 * @param lower    The lower value, inclusive.
 * @param upper    The upper value, exclusive.
 * @return {@code true} if the sequence contains at least one value in the given range.
 */
private static boolean containsAny(final int[] sequence,final int lower,final int upper){
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if the given sequence contains any value in the given range.
 * @param sequence  the {@link #sourceDimensions} or {@link #targetDimensions} sequence to test.
 * @param lower     the lower value, inclusive.
 * @param upper     the upper value, exclusive.
 * @return {@code true} if the sequence contains at least one value in the given range.
 */
private static boolean containsAny(final int[] sequence,final int lower,final int upper){
}
Program: 91840
Project: 91840
Buggy source:
/** 
 * Inserts the specified   {@code dimension} in the specified sequence at a position that preserve increasing order.This method does nothing if the given dimension already exists in the given array. <div class="note"><b>Note:</b> we do not provide public API for this method because we rather encourage bulk operations (adding many values at once), and because the public API does not allow to specify values in random order (for avoiding risk of confusion as some users could expect the separated transform to use the dimensions in the order he specified them).</div>
 * @param sequence   The {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
 * @param dimension  The value to add to the given sequence.
 */
private static int[] insert(int[] sequence,int dimension) throws IllegalArgumentException {
}

Fixed version (ground truth):
/** 
 * Inserts the specified   {@code dimension} in the specified sequence at a position that preserve increasing order.This method does nothing if the given dimension already exists in the given array. <div class="note"><b>Note:</b> we do not provide public API for this method because we rather encourage bulk operations (adding many values at once), and because the public API does not allow to specify values in random order (for avoiding risk of confusion as some users could expect the separated transform to use the dimensions in the order he specified them).</div>
 * @param sequence   the {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
 * @param dimension  the value to add to the given sequence.
 */
private static int[] insert(int[] sequence,int dimension) throws IllegalArgumentException {
}
Program: 91841
Project: 91841
Buggy source:
/** 
 * Adds a range of output dimensions to keep in the separated transform. The   {@code lower} and {@code upper} values define a range of <em>target</em> dimension indicesof the transform given to the constructor.
 * @param lower The lower dimension, inclusive. Shall not be smaller than 0.
 * @param upper The upper dimension, exclusive. Shall be smaller than {@link MathTransform#getTargetDimensions()}.
 * @throws IllegalArgumentException if {@code lower} or {@code upper} are out of bounds.
 */
public void addTargetDimensionRange(final int lower,final int upper) throws IllegalArgumentException {
  targetDimensions=add(targetDimensions,lower,upper,transform.getTargetDimensions());
}

Fixed version (ground truth):
/** 
 * Adds a range of output dimensions to keep in the separated transform. The   {@code lower} and {@code upper} values define a range of <em>target</em> dimension indicesof the transform given to the constructor.
 * @param lower  the lower dimension, inclusive. Shall not be smaller than 0.
 * @param upper  the upper dimension, exclusive. Shall be smaller than {@link MathTransform#getTargetDimensions()}.
 * @throws IllegalArgumentException if {@code lower} or {@code upper} are out of bounds.
 */
public void addTargetDimensionRange(final int lower,final int upper) throws IllegalArgumentException {
  targetDimensions=add(targetDimensions,lower,upper,transform.getTargetDimensions());
}
Program: 91842
Project: 91842
Buggy source:
/** 
 * Adds input dimensions to keep in the separated transform. The given values are <em>source</em> dimension indices of the transform given to the constructor. <p>Constraints:</p> <ul> <li>All numbers shall be in the range 0 inclusive to   {@link MathTransform#getSourceDimensions()} exclusive.</li><li>The  {@code dimensions} values shall be in strictly increasing order.</li><li>The  {@code dimensions} values shall be greater than all values specified by all previous callsof this method since construction or since the last call to  {@link #clear()}.</li> </ul>
 * @param dimensions A sequence of source dimensions to keep, in strictly increasing order.
 * @throws IllegalArgumentException if {@code dimensions} contains negative valuesor if values are not in a strictly increasing order.
 */
public void addSourceDimensions(final int... dimensions) throws IllegalArgumentException {
  ArgumentChecks.ensureNonNull("String_Node_Str",dimensions);
  sourceDimensions=add(sourceDimensions,dimensions,transform.getSourceDimensions());
}

Fixed version (ground truth):
/** 
 * Adds input dimensions to keep in the separated transform. The given values are <em>source</em> dimension indices of the transform given to the constructor. <p>Constraints:</p> <ul> <li>All numbers shall be in the range 0 inclusive to   {@link MathTransform#getSourceDimensions()} exclusive.</li><li>The  {@code dimensions} values shall be in strictly increasing order.</li><li>The  {@code dimensions} values shall be greater than all values specified by all previous callsof this method since construction or since the last call to  {@link #clear()}.</li> </ul>
 * @param dimensions  a sequence of source dimensions to keep, in strictly increasing order.
 * @throws IllegalArgumentException if {@code dimensions} contains negative valuesor if values are not in a strictly increasing order.
 */
public void addSourceDimensions(final int... dimensions) throws IllegalArgumentException {
  ArgumentChecks.ensureNonNull("String_Node_Str",dimensions);
  sourceDimensions=add(sourceDimensions,dimensions,transform.getSourceDimensions());
}
Program: 91843
Project: 91843
Buggy source:
/** 
 * Returns the input dimensions to keep or kept in the separated transform. This method performs the first applicable action in the following list: <ol class="verbose"> <li>Source dimensions have been explicitly set by at least one call to   {@link #addSourceDimensions(int)}or   {@link #addSourceDimensionRange(int,int)} since construction or since last call to {@link #clear()}. In such case, this method returns all specified source dimensions.</li> <li>No source dimensions were set but   {@link #separate()} has been invoked.In such case, this method returns the sequence of source dimensions that  {@code separate()} chooses to retain.It is often, but not necessarily, all source dimensions of the transform given at construction time.</li> <li>Otherwise an exception is thrown.</li> </ol>
 * @return The input dimension as a sequence of strictly increasing values.
 * @throws IllegalStateException if input dimensions have not been set and{@link #separate()} has not yet been invoked.
 */
public int[] getSourceDimensions() throws IllegalStateException {
  if (sourceDimensions != null) {
    return sourceDimensions.clone();
  }
  throw new IllegalStateException(Errors.format(Errors.Keys.UnspecifiedDimensions));
}

Fixed version (ground truth):
/** 
 * Returns the input dimensions to keep or kept in the separated transform. This method performs the first applicable action in the following list: <ol class="verbose"> <li>Source dimensions have been explicitly set by at least one call to   {@link #addSourceDimensions(int)}or   {@link #addSourceDimensionRange(int,int)} since construction or since last call to {@link #clear()}. In such case, this method returns all specified source dimensions.</li> <li>No source dimensions were set but   {@link #separate()} has been invoked.In such case, this method returns the sequence of source dimensions that  {@code separate()} chooses to retain.It is often, but not necessarily, all source dimensions of the transform given at construction time.</li> <li>Otherwise an exception is thrown.</li> </ol>
 * @return the input dimension as a sequence of strictly increasing values.
 * @throws IllegalStateException if input dimensions have not been set and{@link #separate()} has not yet been invoked.
 */
public int[] getSourceDimensions() throws IllegalStateException {
  if (sourceDimensions != null) {
    return sourceDimensions.clone();
  }
  throw new IllegalStateException(Errors.format(Errors.Keys.UnspecifiedDimensions));
}
Program: 91844
Project: 91844
Buggy source:
/** 
 * Constructs a separator for the given transform and using the given factory.
 * @param transform The transform to separate.
 * @param factory The factory to use for creating new math transforms.
 */
public TransformSeparator(final MathTransform transform,final MathTransformFactory factory){
  ArgumentChecks.ensureNonNull("String_Node_Str",transform);
  ArgumentChecks.ensureNonNull("String_Node_Str",factory);
  this.transform=transform;
  this.factory=factory;
}

Fixed version (ground truth):
/** 
 * Constructs a separator for the given transform and using the given factory.
 * @param transform  the transform to separate.
 * @param factory    the factory to use for creating new math transforms.
 */
public TransformSeparator(final MathTransform transform,final MathTransformFactory factory){
  ArgumentChecks.ensureNonNull("String_Node_Str",transform);
  ArgumentChecks.ensureNonNull("String_Node_Str",factory);
  this.transform=transform;
  this.factory=factory;
}
Program: 91845
Project: 91845
Buggy source:
/** 
 * Returns the output dimensions to keep or kept in the separated transform. This method performs the first applicable action in the following list: <ol class="verbose"> <li>Target dimensions have been explicitly set by at least one call to   {@link #addTargetDimensions(int)}or   {@link #addTargetDimensionRange(int,int)} since construction or since last call to {@link #clear()}. In such case, this method returns all specified target dimensions.</li> <li>No target dimensions were set but   {@link #separate()} has been invoked.In such case, the target dimensions are inferred automatically from the  {@linkplain #getSourceDimensions() source dimensions} and the transform.</li><li>Otherwise an exception is thrown.</li> </ol>
 * @return The output dimension as a sequence of strictly increasing values.
 * @throws IllegalStateException if output dimensions have not been set and{@link #separate()} has not yet been invoked.
 */
public int[] getTargetDimensions() throws IllegalStateException {
  if (targetDimensions != null) {
    return targetDimensions.clone();
  }
  throw new IllegalStateException(Errors.format(Errors.Keys.UnspecifiedDimensions));
}

Fixed version (ground truth):
/** 
 * Returns the output dimensions to keep or kept in the separated transform. This method performs the first applicable action in the following list: <ol class="verbose"> <li>Target dimensions have been explicitly set by at least one call to   {@link #addTargetDimensions(int)}or   {@link #addTargetDimensionRange(int,int)} since construction or since last call to {@link #clear()}. In such case, this method returns all specified target dimensions.</li> <li>No target dimensions were set but   {@link #separate()} has been invoked.In such case, the target dimensions are inferred automatically from the  {@linkplain #getSourceDimensions() source dimensions} and the transform.</li><li>Otherwise an exception is thrown.</li> </ol>
 * @return the output dimension as a sequence of strictly increasing values.
 * @throws IllegalStateException if output dimensions have not been set and{@link #separate()} has not yet been invoked.
 */
public int[] getTargetDimensions() throws IllegalStateException {
  if (targetDimensions != null) {
    return targetDimensions.clone();
  }
  throw new IllegalStateException(Errors.format(Errors.Keys.UnspecifiedDimensions));
}
Program: 91848
Project: 91848
Buggy source:
/** 
 * Returns   {@code true} if the {@link CoordinateOperation} for the specified code is a {@link Projection}. The caller must have verified that the designed operation is a   {@link Conversion} before to invoke this method.
 * @throws SQLException If an error occurred while querying the database.
 */
final boolean isProjection(final Integer code) throws SQLException {
  Boolean projection=isProjection.get(code);
  if (projection == null) {
    try (ResultSet result=executeQuery("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",code)){
      projection=result.next();
    }
     isProjection.put(code,projection);
  }
  return projection;
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if the {@link CoordinateOperation} for the specified code is a {@link Projection}. The caller must have verified that the designed operation is a   {@link Conversion} before to invoke this method.
 * @throws SQLException If an error occurred while querying the database.
 */
final boolean isProjection(final Integer code) throws SQLException {
  Boolean projection=isProjection.get(code);
  if (projection == null) {
    try (ResultSet result=executeQuery("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str" + TableInfo.ENUM_REPLACEMENT + "String_Node_Str",code)){
      projection=result.next();
    }
     isProjection.put(code,projection);
  }
  return projection;
}