nus-yam/ex-repair huggingface dataset:
Program: 92296
Project: 92296
Buggy source:
/** 
 * Executes the mojo.
 * @throws MojoExecutionException if the plugin execution failed.
 */
@Override public void execute() throws MojoExecutionException {
  final boolean isIncremental=buildContext.isIncremental();
  declareOutputDirectory();
  int errors=0;
  for (  final String sourceDirectory : compileSourceRoots) {
    final File directory=new File(sourceDirectory);
    if (directory.getName().equals("String_Node_Str")) {
      if (!isIncremental) {
        Scanner scanner=buildContext.newScanner(directory);
        scanner.setIncludes(new String[]{"String_Node_Str"});
        scanner.scan();
        if (scanner.getIncludedFiles() == null) {
          continue;
        }
      }
      javaDirectoryFile=directory;
      errors+=processAllResourceDirectories(directory);
      buildContext.refresh(directory);
    }
  }
  if (errors != 0) {
    throw new ResourceCompilerException(String.valueOf(errors) + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Executes the mojo.
 * @throws MojoExecutionException if the plugin execution failed.
 */
@Override public void execute() throws MojoExecutionException {
  final boolean isIncremental=buildContext.isIncremental();
  declareOutputDirectory();
  int errors=0;
  for (  final String sourceDirectory : compileSourceRoots) {
    final File directory=new File(sourceDirectory);
    if (directory.getName().equals("String_Node_Str")) {
      if (isIncremental) {
        Scanner scanner=buildContext.newScanner(directory);
        scanner.setIncludes(PROPERTIES_PATTERN);
        scanner.scan();
        final String[] includedFiles=scanner.getIncludedFiles();
        if (includedFiles == null || includedFiles.length == 0) {
          continue;
        }
      }
      javaDirectoryFile=directory;
      errors+=processAllResourceDirectories(directory);
      buildContext.refresh(outputDirectory);
    }
  }
  if (errors != 0) {
    throw new ResourceCompilerException(String.valueOf(errors) + "String_Node_Str");
  }
}
Program: 92298
Project: 92298
Buggy source:
/** 
 * Creates the Pack200 files from the JAR files collected in the "<code>target/binaries</code>" directory.
 * @throws MojoExecutionException if the plugin execution failed.
 */
@Override public void execute() throws MojoExecutionException {
  final File targetDirectory=new File(rootDirectory,JarCollector.TARGET_DIRECTORY);
  if (!targetDirectory.isDirectory()) {
    throw new MojoExecutionException("String_Node_Str" + targetDirectory);
  }
  try {
    final String fullVersion=VERSION + '-' + BRANCH;
    final Packer packer=new Packer(targetDirectory,fullVersion);
    packer.addPack("String_Node_Str" + fullVersion + "String_Node_Str");
    try {
      packer.createJars();
    }
  finally {
      packer.close();
    }
    packer.pack();
  }
 catch (  IOException e) {
    throw new MojoExecutionException(e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Creates the Pack200 files from the JAR files collected in the "<code>target/binaries</code>" directory.
 * @throws MojoExecutionException if the plugin execution failed.
 */
@Override public void execute() throws MojoExecutionException {
  final File targetDirectory=new File(rootDirectory,JarCollector.TARGET_DIRECTORY);
  if (!targetDirectory.isDirectory()) {
    throw new MojoExecutionException("String_Node_Str" + targetDirectory);
  }
  try {
    final String fullVersion=VERSION + BRANCH;
    final Packer packer=new Packer(targetDirectory,fullVersion);
    packer.addPack("String_Node_Str" + fullVersion + "String_Node_Str");
    try {
      packer.createJars();
    }
  finally {
      packer.close();
    }
    packer.pack();
  }
 catch (  IOException e) {
    throw new MojoExecutionException(e.getLocalizedMessage(),e);
  }
}
Program: 92299
Project: 92299
Buggy source:
/** 
 * Given an array of   {@code Tag}s representing this custom tag, return its string representation.
 * @param tags The tags to format.
 * @return A string representation of the given tags.
 */
@Override public String toString(final Tag[] tags){
  if (tags == null || tags.length == 0) {
    return "String_Node_Str";
  }
  final StringBuilder buffer=new StringBuilder(128);
  buffer.append("String_Node_Str");
  for (int i=0; i < tags.length; i++) {
    final Tag tag=tags[i];
    File file=tag.position().file();
    module=file.getName();
    while (file != null) {
      file=file.getParentFile();
      if (file.getName().equals("String_Node_Str")) {
        file=file.getParentFile();
        if (file != null) {
          module=file.getName();
        }
        break;
      }
    }
    buffer.append("String_Node_Str").append(MAVEN_REPORTS_BASE_URL).append(module).append("String_Node_Str").append(module).append("String_Node_Str");
    buffer.append("String_Node_Str").append(MAVEN_REPOSITORY_BASE_URL).append("String_Node_Str").append(module).append('/').append(VERSION).append('/').append("String_Node_Str");
    final Doc holder=tag.holder();
    if (holder instanceof ClassDoc) {
      ClassDoc outer, doc=(ClassDoc)holder;
      while ((outer=doc.containingClass()) != null) {
        doc=outer;
      }
      final String className=doc.qualifiedName();
      buffer.append("String_Node_Str");
      for (int j=className.indexOf('.'); j >= 0; j=className.indexOf('.',j + 1)) {
        buffer.append("String_Node_Str");
      }
      buffer.append("String_Node_Str").append(className.replace('.','/')).append("String_Node_Str");
    }
  }
  return buffer.append("String_Node_Str").toString();
}

Fixed version (ground truth):
/** 
 * Given an array of   {@code Tag}s representing this custom tag, return its string representation.
 * @param tags The tags to format.
 * @return A string representation of the given tags.
 */
@Override public String toString(final Tag[] tags){
  if (tags == null || tags.length == 0) {
    return "String_Node_Str";
  }
  final StringBuilder buffer=new StringBuilder(128);
  buffer.append("String_Node_Str");
  for (int i=0; i < tags.length; i++) {
    final Tag tag=tags[i];
    File file=tag.position().file();
    module=file.getName();
    while (file != null) {
      file=file.getParentFile();
      if (file.getName().equals("String_Node_Str")) {
        file=file.getParentFile();
        if (file != null) {
          module=file.getName();
        }
        break;
      }
    }
    buffer.append("String_Node_Str").append(MAVEN_REPORTS_BASE_URL).append(module).append("String_Node_Str").append(module).append("String_Node_Str");
  }
  return buffer.append("String_Node_Str").toString();
}
Program: 92305
Project: 92305
Buggy source:
/** 
 * Tests   {@link ChannelDataInput#seek(long)} on a channel that do not implement{@link java.nio.channels.SeekableByteChannel}.
 * @throws IOException Should never happen.
 */
@Test public void testSeekOnForwardOnlyChannel() throws IOException {
  final Random random=TestUtilities.createRandomNumberGenerator("String_Node_Str");
  int length=random.nextInt(2048) + 1024;
  final byte[] array=createRandomArray(length,random);
  length-=(Long.SIZE / Byte.SIZE) - 1;
  final ByteBuffer buffer=ByteBuffer.wrap(array);
  final ChannelDataInput input=new ChannelDataInput("String_Node_Str",Channels.newChannel(new ByteArrayInputStream(array)),ByteBuffer.allocate(random.nextInt(64) + 16),false);
  int position=0;
  while (position <= length) {
    input.seek(position);
    assertEquals("String_Node_Str",position,input.getStreamPosition());
    assertEquals(buffer.getLong(position),input.readLong());
    position+=random.nextInt(128);
  }
}

Fixed version (ground truth):
/** 
 * Tests   {@link ChannelDataInput#seek(long)} on a channel that do not implement{@link java.nio.channels.SeekableByteChannel}.
 * @throws IOException Should never happen.
 */
@Test public void testSeekOnForwardOnlyChannel() throws IOException {
  final Random random=TestUtilities.createRandomNumberGenerator("String_Node_Str");
  int length=random.nextInt(2048) + 1024;
  final byte[] array=createRandomArray(length,random);
  length-=(Long.SIZE / Byte.SIZE);
  final ByteBuffer buffer=ByteBuffer.wrap(array);
  final ChannelDataInput input=new ChannelDataInput("String_Node_Str",Channels.newChannel(new ByteArrayInputStream(array)),ByteBuffer.allocate(random.nextInt(64) + 16),false);
  int position=0;
  while (position < length) {
    input.seek(position);
    assertEquals("String_Node_Str",position,input.getStreamPosition());
    assertEquals(buffer.getLong(position),input.readLong());
    position+=random.nextInt(128);
  }
}
Program: 92306
Project: 92306
Buggy source:
/** 
 * Adds a new child in the   {@linkplain #getChildren() children list}. The default implementation delegates to   {@link Node#Node(Node)}, which has the following implications: <ul> <li>The new node inherits the columns of this node, on the assumption that they are the same set of columns than other children nodes.</li> <li>The new node is appended at the end of the children list.</li> </ul> Subclasses may override this method with different behavior.
 */
@Override public Node newChild(){
  return new Node(this);
}

Fixed version (ground truth):
/** 
 * Adds a new child in the   {@linkplain #getChildren() children list}. The default implementation delegates to   {@code Node(Node)} constructor,which has the following implications: <ul> <li>The new node inherits the columns of this node, on the assumption that they are the same set of columns than other children nodes.</li> <li>The new node is appended at the end of the children list.</li> </ul> Subclasses may override this method with different behavior.
 */
@Override public Node newChild(){
  return new Node(this);
}
Program: 92307
Project: 92307
Buggy source:
/** 
 * Tests   {@link Classes#findCommonClass(Collection)}and   {@link Classes#findSpecializedClass(Collection)}.
 */
@Test public void testFindCommonParent(){
  final Set<Object> types=new HashSet<>();
  assertTrue(types.add(new NotSerializableException()));
  assertEquals(NotSerializableException.class,findCommonClass(types));
  assertEquals(NotSerializableException.class,findSpecializedClass(types));
  assertTrue(types.add(new InvalidObjectException(null)));
  assertEquals(ObjectStreamException.class,findCommonClass(types));
  assertEquals(ObjectStreamException.class,findSpecializedClass(types));
  assertTrue(types.add(new FileNotFoundException()));
  assertEquals(IOException.class,findCommonClass(types));
  assertEquals(IOException.class,findSpecializedClass(types));
  assertTrue(types.add(new IOException()));
  assertEquals(IOException.class,findCommonClass(types));
  assertEquals(IOException.class,findSpecializedClass(types));
  assertTrue(types.add(new Exception()));
  assertEquals(Exception.class,findCommonClass(types));
  assertEquals(IOException.class,findSpecializedClass(types));
}

Fixed version (ground truth):
/** 
 * Tests   {@link Classes#findCommonClass(Iterable)}and   {@link Classes#findSpecializedClass(Iterable)}.
 */
@Test public void testFindCommonParent(){
  final Set<Object> types=new HashSet<>();
  assertTrue(types.add(new NotSerializableException()));
  assertEquals(NotSerializableException.class,findCommonClass(types));
  assertEquals(NotSerializableException.class,findSpecializedClass(types));
  assertTrue(types.add(new InvalidObjectException(null)));
  assertEquals(ObjectStreamException.class,findCommonClass(types));
  assertEquals(ObjectStreamException.class,findSpecializedClass(types));
  assertTrue(types.add(new FileNotFoundException()));
  assertEquals(IOException.class,findCommonClass(types));
  assertEquals(IOException.class,findSpecializedClass(types));
  assertTrue(types.add(new IOException()));
  assertEquals(IOException.class,findCommonClass(types));
  assertEquals(IOException.class,findSpecializedClass(types));
  assertTrue(types.add(new Exception()));
  assertEquals(Exception.class,findCommonClass(types));
  assertEquals(IOException.class,findSpecializedClass(types));
}
Program: 92309
Project: 92309
Buggy source:
/** 
 * Tests the parsing method on ranges of numbers. This test fixes the type to  {@code Integer.class}.  A different test will let the parser determine the type itself.
 */
@Test public void testParseIntegers(){
  format=new RangeFormat(Locale.CANADA,Integer.class);
  parsePos=new ParsePosition(0);
  assertEquals(NumberRange.create(-10,true,20,true),parse("String_Node_Str"));
  assertEquals(NumberRange.create(-3,false,4,false),parse("String_Node_Str"));
  assertEquals(NumberRange.create(2,true,8,false),parse("String_Node_Str"));
  assertEquals(NumberRange.create(40,false,90,true),parse("String_Node_Str"));
  assertEquals(NumberRange.create(300,true,300,true),parse("String_Node_Str"));
  assertEquals(NumberRange.create(300,true,300,true),parse("String_Node_Str"));
  assertEquals(NumberRange.create(300,false,300,false),parse("String_Node_Str"));
  assertEquals(NumberRange.create(0,true,0,false),parse("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Tests the parsing method on ranges of numbers. This test fixes the type to  {@code Integer.class}.  A different test will let the parser determine the type itself.
 */
@Test public void testParseIntegers(){
  format=new RangeFormat(Locale.CANADA,Integer.class);
  parsePos=new ParsePosition(0);
  assertEquals(NumberRange.create(-10,true,20,true),parse("String_Node_Str"));
  assertEquals(NumberRange.create(-3,false,4,false),parse("String_Node_Str"));
  assertEquals(NumberRange.create(2,true,8,false),parse("String_Node_Str"));
  assertEquals(NumberRange.create(40,false,90,true),parse("String_Node_Str"));
  assertEquals(NumberRange.create(300,true,300,true),parse("String_Node_Str"));
  assertEquals(NumberRange.create(300,true,300,true),parse("String_Node_Str"));
  assertEquals(NumberRange.create(300,false,300,false),parse("String_Node_Str"));
  assertEquals(NumberRange.create(300,true,300,true),parse("String_Node_Str"));
  assertEquals(NumberRange.create(0,true,0,false),parse("String_Node_Str"));
  assertEquals(NumberRange.create(0,true,0,false),parse("String_Node_Str"));
}
Program: 92310
Project: 92310
Buggy source:
/** 
 * Writes pending non-white characters, discards trailing whitespaces, and resets column position to zero. This method does <strong>not</strong> write the line separator and does not modify the status of the   {@link #skipLF} flag; those tasks are caller'sresponsibility.
 */
private void endOfLine() throws IOException {
  buffer.setLength(printableLength);
  deleteSoftHyphen();
  transfer(printableLength);
  printableLength=0;
  codePointCount=0;
  isEscapeSequence=false;
  isNewLine=true;
}

Fixed version (ground truth):
/** 
 * Writes pending non-white characters, discards trailing whitespaces, and resets column position to zero. This method does <strong>not</strong> write the line separator and does not modify the status of the   {@link #skipLF} flag; those tasks are caller'sresponsibility.
 */
private void endOfLine() throws IOException {
  buffer.setLength(printableLength);
  deleteSoftHyphen(printableLength - 1);
  transfer(printableLength);
  printableLength=0;
  codePointCount=0;
  isEscapeSequence=false;
  isNewLine=true;
}
Program: 92311
Project: 92311
Buggy source:
/** 
 * Removes the soft hyphen characters from the given buffer. This is invoked when the buffer is about to be written without being split on two lines.
 */
private void deleteSoftHyphen(){
  for (int i=printableLength; --i >= 0; ) {
    if (buffer.charAt(i) == Characters.SOFT_HYPHEN) {
      buffer.deleteCharAt(i);
      printableLength--;
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes the soft hyphen characters from the given buffer. This is invoked when the buffer is about to be written without being split on two lines.
 * @param i Index after the last character to check. This is either {@link printableLength}for checking all characters, or   {@code printableLength-1} for preserving the lastsoft hyphen on the line (while removing all others).
 */
private void deleteSoftHyphen(int i){
  while (--i >= 0) {
    if (buffer.charAt(i) == Characters.SOFT_HYPHEN) {
      buffer.deleteCharAt(i);
      printableLength--;
    }
  }
}
Program: 92313
Project: 92313
Buggy source:
/** 
 * Run the test.
 * @param lineSeparator The line separator to use.
 * @throws IOException Should never happen.
 */
abstract void run(final String lineSeparator) throws IOException ;

Fixed version (ground truth):
/** 
 * Run the test. This method is where the test is actually performed. Implementations shall write in the   {@link #formatter}, then test the result with   {@link #assertOutputEquals(String)}.
 * @param lineSeparator The line separator to use.
 * @throws IOException Should never happen.
 */
abstract void run(final String lineSeparator) throws IOException ;
Program: 92315
Project: 92315
Buggy source:
/** 
 * Adds to the given collection every interfaces implemented by the given class or interface.
 */
private static void getAllInterfaces(final Class<?> type,final Set<Class<?>> interfaces){
  for (  final Class<?> i : type.getInterfaces()) {
    if (interfaces.add(i)) {
      getAllInterfaces(i,interfaces);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds to the given set every interfaces implemented by the given class or interface.
 * @param type  The type for which to add the interfaces in the given set.
 * @param addTo The set where to add interfaces, or {@code null} if not yet created.
 * @return The given set (may be {@code null}), or a new set if the given set was null and at least one interface has been found.
 */
private static Set<Class<?>> getAllInterfaces(final Class<?> type,Set<Class<?>> addTo){
  final Class<?>[] interfaces=type.getInterfaces();
  for (int i=0; i < interfaces.length; i++) {
    final Class<?> candidate=interfaces[i];
    if (addTo == null) {
      addTo=new LinkedHashSet<>(hashMapCapacity(interfaces.length - i));
    }
    if (addTo.add(candidate)) {
      getAllInterfaces(candidate,addTo);
    }
  }
  return addTo;
}
Program: 92318
Project: 92318
Buggy source:
/** 
 * If a test failed, lists the resource bundle content to the  {@linkplain System#err standard error stream}.
 * @throws IOException Should never happen.
 */
@After public void dumpResourcesOnError() throws IOException {
  if (testing != null) {
    final PrintStream err=System.err;
    err.print("String_Node_Str");
    err.print(testing.getLocale());
    err.println("String_Node_Str");
    testing.list(err);
    err.flush();
  }
}

Fixed version (ground truth):
/** 
 * If a test failed, lists the resource bundle content to the  {@linkplain System#err standard error stream}.
 * @throws IOException Should never happen.
 */
@After public void dumpResourcesOnError() throws IOException {
  if (testing != null) {
    final PrintStream err=System.err;
    err.print("String_Node_Str");
    err.print(testing);
    err.println("String_Node_Str");
    testing.list(err);
    err.flush();
  }
}
Program: 92319
Project: 92319
Buggy source:
/** 
 * Returns the line separator to be sent to the   {@linkplain #out underlying appendable}, or   {@code null} if EOL sequences are forwarded unchanged.
 * @return The current line separator, or {@code null} if EOL are forwarded <i>as-is</i>.
 */
public String getLineSeparator(){
  return isEndOfLineReplaced ? lineSeparator : null;
}

Fixed version (ground truth):
/** 
 * Returns the line separator to be sent to the underlying appendable, or   {@code null} if EOL sequences are forwarded unchanged.
 * @return The current line separator, or {@code null} if EOL are forwarded <i>as-is</i>.
 */
public String getLineSeparator(){
  return isEndOfLineReplaced ? lineSeparator : null;
}
Program: 92320
Project: 92320
Buggy source:
/** 
 * Changes the line separator to be sent to the   {@linkplain #out underlying appendable}. This is the string to insert in place of every occurrences of   {@code "\r"},   {@code "\n"},  {@code "\r\n"} or other {@linkplain Characters#isLineOrParagraphSeparator(int) line separators}. If   {@code null} (the default), then the line separators given to the {@code append}methods are forwarded unchanged.
 * @param lineSeparator The new line separator, or {@code null} for forwarding EOL <i>as-is</i>.
 * @see System#lineSeparator()
 * @see Characters#isLineOrParagraphSeparator(int)
 */
public void setLineSeparator(final String lineSeparator){
  this.lineSeparator=lineSeparator;
  isEndOfLineReplaced=(lineSeparator != null);
}

Fixed version (ground truth):
/** 
 * Changes the line separator to be sent to the underlying appendable. This is the string to insert in place of every occurrences of   {@code "\r"},   {@code "\n"},  {@code "\r\n"} or other {@linkplain Characters#isLineOrParagraphSeparator(int) line separators}. If   {@code null} (the default), then the line separators given to the {@code append}methods are forwarded unchanged.
 * @param lineSeparator The new line separator, or {@code null} for forwarding EOL <i>as-is</i>.
 * @see System#lineSeparator()
 * @see Characters#isLineOrParagraphSeparator(int)
 */
public void setLineSeparator(final String lineSeparator){
  this.lineSeparator=lineSeparator;
  isEndOfLineReplaced=(lineSeparator != null);
}
Program: 92321
Project: 92321
Buggy source:
/** 
 * Advances to the next non-null identifier, skips duplicated authorities, wraps the identifier in an entry if needed and stores the result in the   {@link #next} field. If we reach the iteration end, then this method set the   {@link #identifiers}iterator to   {@code null}.
 */
private void toNext(){
  final Iterator<? extends Identifier> it=identifiers;
  if (it != null) {
    while (it.hasNext()) {
      final Identifier identifier=it.next();
      if (identifier != null) {
        final Citation authority=identifier.getAuthority();
        final Boolean state=put(authority,Boolean.FALSE);
        if (state == null) {
          if (identifier instanceof IdentifierMapEntry) {
            next=(IdentifierMapEntry)identifier;
          }
 else {
            next=new IdentifierMapEntry.Immutable(authority,identifier.getCode());
          }
          this.authority=authority;
          return;
        }
        if (state == Boolean.TRUE) {
          it.remove();
        }
      }
    }
    identifiers=null;
  }
}

Fixed version (ground truth):
/** 
 * Advances to the next non-null identifier, skips duplicated authorities, wraps the identifier in an entry if needed and stores the result in the   {@link #next} field. If we reach the iteration end, then this method set the   {@link #identifiers}iterator to   {@code null}.
 */
private void toNext(){
  final Iterator<? extends Identifier> it=identifiers;
  if (it != null) {
    while (it.hasNext()) {
      final Identifier identifier=it.next();
      if (identifier != null) {
        final Citation authority=identifier.getAuthority();
        final Boolean state=put(authority,Boolean.FALSE);
        if (state == null) {
          if (identifier instanceof IdentifierMapEntry) {
            next=(IdentifierMapEntry)identifier;
          }
 else {
            next=new IdentifierMapEntry.Immutable(authority,identifier.getCode());
          }
          this.authority=authority;
          return;
        }
        if (state) {
          it.remove();
        }
      }
    }
    identifiers=null;
  }
}
Program: 92322
Project: 92322
Buggy source:
/** 
 * Invoked by   {@link org.apache.sis.internal.util.ReferenceQueueConsumer}for removing the reference from the enclosing collection.
 */
@Override public void dispose(){
  clear();
  removeEntry(this);
}

Fixed version (ground truth):
/** 
 * Invoked by   {@link org.apache.sis.internal.util.ReferenceQueueConsumer}for removing the reference from the enclosing collection.
 */
@Override public void dispose(){
  super.clear();
  removeEntry(this);
}
Program: 92323
Project: 92323
Buggy source:
/** 
 * Invoked by   {@link org.apache.sis.internal.util.ReferenceQueueConsumer}for removing the reference from the enclosing collection.
 */
@Override public void dispose(){
  clear();
  removeEntry(this);
}

Fixed version (ground truth):
/** 
 * Invoked by   {@link org.apache.sis.internal.util.ReferenceQueueConsumer}for removing the reference from the enclosing collection.
 */
@Override public void dispose(){
  super.clear();
  removeEntry(this);
}
Program: 92324
Project: 92324
Buggy source:
/** 
 * Instantiates a new resource bundle.
 * @param baseName  The fully qualified name of the base resource bundle.
 * @param locale    The locale for which the resource bundle should be instantiated.
 * @param format    Ignored since this loader supports only one format.
 * @param loader    The class loader to use.
 * @param reload    Ignored since this loader do not supports resource expiration.
 * @return The resource bundle instance, or null if none could be found.
 */
@Override public ResourceBundle newBundle(final String baseName,final Locale locale,final String format,final ClassLoader loader,final boolean reload) throws IllegalAccessException, InstantiationException, IOException {
  final Class<?> classe;
  try {
    classe=Class.forName(baseName,true,loader);
  }
 catch (  ClassNotFoundException e) {
    return null;
  }
  final String classname=classe.getSimpleName();
  String filename=toResourceName(toBundleName(classname,locale),EXTENSION);
  if (classe.getResource(filename) == null) {
    if (!Locale.ENGLISH.equals(locale)) {
      return null;
    }
    filename=toResourceName(classname,EXTENSION);
    if (classe.getResource(filename) == null) {
      return null;
    }
  }
  final Constructor<?> c;
  try {
    return (ResourceBundle)classe.getDeclaredConstructor(String.class).newInstance(filename);
  }
 catch (  NoSuchMethodException|InvocationTargetException e) {
    InstantiationException exception=new InstantiationException(Exceptions.getLocalizedMessage(e,locale));
    exception.initCause(e);
    throw exception;
  }
}

Fixed version (ground truth):
/** 
 * Instantiates a new resource bundle.
 * @param baseName  The fully qualified name of the base resource bundle.
 * @param locale    The locale for which the resource bundle should be instantiated.
 * @param format    Ignored since this loader supports only one format.
 * @param loader    The class loader to use.
 * @param reload    Ignored since this loader do not supports resource expiration.
 * @return The resource bundle instance, or null if none could be found.
 */
@Override public ResourceBundle newBundle(final String baseName,final Locale locale,final String format,final ClassLoader loader,final boolean reload) throws IllegalAccessException, InstantiationException, IOException {
  final Class<?> classe;
  try {
    classe=Class.forName(baseName,true,loader);
  }
 catch (  ClassNotFoundException e) {
    return null;
  }
  final String classname=classe.getSimpleName();
  String filename=toResourceName(toBundleName(classname,locale),EXTENSION);
  if (classe.getResource(filename) == null) {
    if (!Locale.ENGLISH.equals(locale)) {
      return null;
    }
    filename=toResourceName(classname,EXTENSION);
    if (classe.getResource(filename) == null) {
      return null;
    }
  }
  try {
    return (ResourceBundle)classe.getDeclaredConstructor(String.class).newInstance(filename);
  }
 catch (  NoSuchMethodException|InvocationTargetException e) {
    InstantiationException exception=new InstantiationException(Exceptions.getLocalizedMessage(e,locale));
    exception.initCause(e);
    throw exception;
  }
}
Program: 92326
Project: 92326
Buggy source:
/** 
 * Ensures that the given direct position has the expected number of dimensions. This method does nothing if the direct position is null.
 * @param name     The name of the argument to be checked. Used only in case an exception is thrown.
 * @param position The direct position to check for its dimension.
 * @param expected The expected number of dimensions.
 * @throws MismatchedDimensionException If the given direct position is non-null and doesnot have the expected number of dimensions.
 */
public static void ensureDimensionMatches(final String name,final DirectPosition position,final int expected) throws MismatchedDimensionException {
  if (position != null) {
    final int dimension=position.getDimension();
    if (dimension != expected) {
      throw new MismatchedDimensionException(Errors.format(Errors.Keys.UnexpectedArgumentDimension_3,name,dimension,expected));
    }
  }
}

Fixed version (ground truth):
/** 
 * Ensures that the given direct position has the expected number of dimensions. This method does nothing if the given direct position is null.
 * @param name     The name of the argument to be checked. Used only in case an exception is thrown.
 * @param position The direct position to check for its dimension.
 * @param expected The expected number of dimensions.
 * @throws MismatchedDimensionException If the given direct position is non-null and doesnot have the expected number of dimensions.
 */
public static void ensureDimensionMatches(final String name,final DirectPosition position,final int expected) throws MismatchedDimensionException {
  if (position != null) {
    final int dimension=position.getDimension();
    if (dimension != expected) {
      throw new MismatchedDimensionException(Errors.format(Errors.Keys.UnexpectedArgumentDimension_3,name,dimension,expected));
    }
  }
}
Program: 92327
Project: 92327
Buggy source:
/** 
 * Scans the classpath for logger factories. The fully qualified factory classname shall be declared in the following file:  {@preformat textMETA-INF/services/org.apache.sis.util.logging.LoggerFactory}The first factory found on the classpath is given to   {@link #setLoggerFactory(String)}. If it can't be used (for example because of missing dependency), then the second factory is tried, <i>etc.</i> until an acceptable factory is found. <p> This method usually doesn't need to be invoked explicitly, since it is automatically invoked on   {@code Logging} class initialization. However developers may invoke it ifnew  {@code LoggerFactory}s are added later on the classpath of a running JVM.
 */
@Configuration public void scanLoggerFactory(){
  LoggerFactory<?> factory=null;
  for (  final LoggerFactory<?> found : ServiceLoader.load(LoggerFactory.class)) {
    if (factory == null) {
      factory=found;
    }
 else {
      factory=new DualLoggerFactory(factory,found);
    }
  }
  setLoggerFactory(factory);
}

Fixed version (ground truth):
/** 
 * Scans the classpath for logger factories. The fully qualified factory classname shall be declared in the following file:  {@preformat textMETA-INF/services/org.apache.sis.util.logging.LoggerFactory}The factory found on the classpath is given to   {@link #setLoggerFactory(String)}. If more than one factory is found, then the log messages will be sent to the logging frameworks managed by all those factories. <p> This method usually doesn't need to be invoked explicitly, since it is automatically invoked on   {@code Logging} class initialization. However developers may invoke it ifnew  {@code LoggerFactory}s are added later on the classpath of a running JVM.
 */
@Configuration public void scanLoggerFactory(){
  LoggerFactory<?> factory=null;
  for (  final LoggerFactory<?> found : ServiceLoader.load(LoggerFactory.class)) {
    if (factory == null) {
      factory=found;
    }
 else {
      factory=new DualLoggerFactory(factory,found);
    }
  }
  setLoggerFactory(factory);
}
Program: 92328
Project: 92328
Buggy source:
/** 
 * Writes the entire quad tree index to file with each node in saved in a separate file.
 * @param tree
 * @param directory
 */
public static void writeTreeToFile(QuadTree tree,String directory){
  writeTreeConfigsToFile(tree,directory);
  writeNodeToFile(tree.getRoot(),directory);
}

Fixed version (ground truth):
/** 
 * Writes the entire quad tree index to file with each node in saved in a separate file.
 * @param tree
 * @param directory
 */
public static void writeTreeToFile(QuadTree tree,String directory){
  createIdxDir(directory);
  writeTreeConfigsToFile(tree,directory);
  writeNodeToFile(tree.getRoot(),directory);
}
Program: 92329
Project: 92329
Buggy source:
private static void writeTreeConfigsToFile(QuadTree tree,String directory){
  if (!new File(directory).exists())   new File(directory).mkdirs();
  try {
    BufferedWriter writer=new BufferedWriter(new FileWriter(directory + "String_Node_Str"));
    writer.write("String_Node_Str" + tree.getCapacity() + "String_Node_Str"+ tree.getDepth());
    writer.newLine();
    writer.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private static void writeTreeConfigsToFile(QuadTree tree,String directory){
  try {
    BufferedWriter writer=new BufferedWriter(new FileWriter(directory + "String_Node_Str"));
    writer.write("String_Node_Str" + tree.getCapacity() + "String_Node_Str"+ tree.getDepth());
    writer.newLine();
    writer.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 92330
Project: 92330
Buggy source:
@Override protected List<ScreenRegion> getUnorderedMatches(ScreenRegion screenRegion){
  Rectangle screenRegionBounds=screenRegion.getBounds();
  if (screenRegionBounds.width < targetImage.getWidth() || screenRegionBounds.height < targetImage.getHeight()) {
    return Lists.newArrayList();
  }
  List<RegionMatch> matches;
  List<Rectangle> rois=screenRegion.getROIs();
  if (rois.isEmpty()) {
    matches=TemplateMatcher.findMatchesByGrayscaleAtOriginalResolution(screenRegion.capture(),targetImage,getLimit(),getMinScore());
  }
 else {
    matches=TemplateMatcher.findMatchesByGrayscaleAtOriginalResolutionWithROIs(screenRegion.capture(),targetImage,getLimit(),getMinScore(),rois);
  }
  return convertToScreenRegions(screenRegion,matches);
}

Fixed version (ground truth):
@Override protected List<ScreenRegion> getUnorderedMatches(ScreenRegion screenRegion){
  Rectangle screenRegionBounds=screenRegion.getBounds();
  if (screenRegionBounds.width < targetImage.getWidth() || screenRegionBounds.height < targetImage.getHeight()) {
    return Lists.newArrayList();
  }
  List<RegionMatch> matches;
  BufferedImage screenImage=screenRegion.capture();
  List<Rectangle> rois=screenRegion.getROIs();
  if (rois.isEmpty()) {
    matches=TemplateMatcher.findMatchesByGrayscaleAtOriginalResolution(screenImage,targetImage,getLimit(),getMinScore());
  }
 else {
    matches=TemplateMatcher.findMatchesByGrayscaleAtOriginalResolutionWithROIs(screenImage,targetImage,getLimit(),getMinScore(),rois);
  }
  return convertToScreenRegions(screenRegion,matches);
}
Program: 92331
Project: 92331
Buggy source:
public void hide(){
  for (  ScreenDisplayable d : displayableList) {
    d.hideFromScreen();
  }
  displayableList.clear();
}

Fixed version (ground truth):
public void hide(){
  for (  ScreenDisplayable d : displayableList) {
    d.hideFromScreen();
    ScreenOverlayWindow w=(ScreenOverlayWindow)d;
    PCanvas canvas=w.getCanvas();
    canvas.removeAll();
  }
  displayableList.clear();
  System.gc();
}
Program: 92332
Project: 92332
Buggy source:
static private PNode addShadow(PNode contentNode){
  PNode contentNodeWithShadow=new PNode();
  double xoffset=contentNode.getXOffset();
  double yoffset=contentNode.getYOffset();
  int blurRadius=4;
  int tx=5;
  int ty=5;
  PShadow shadowNode=new PShadow(contentNode.toImage(),SHADOW_PAINT,blurRadius);
  contentNode.setOffset(tx,ty);
  shadowNode.setOffset(tx - (2 * blurRadius) + 1.0d,ty - (2 * blurRadius) + 1.0d);
  contentNodeWithShadow.addChild(shadowNode);
  contentNodeWithShadow.addChild(contentNode);
  contentNodeWithShadow.setOffset(xoffset - tx - blurRadius,yoffset - ty - blurRadius);
  contentNodeWithShadow.setBounds(0,0,contentNode.getWidth() + 2 * blurRadius + tx,contentNode.getHeight() + 2 * blurRadius + ty);
  return contentNodeWithShadow;
}

Fixed version (ground truth):
static private PNode addShadow(PNode contentNode){
  PNode contentNodeWithShadow=new PNode();
  double xoffset=contentNode.getXOffset();
  double yoffset=contentNode.getYOffset();
  int blurRadius=4;
  int tx=5;
  int ty=5;
  PShadow shadowNode=new PShadow(contentNode.toImage(),SHADOW_PAINT,blurRadius);
  contentNode.setOffset(tx,ty);
  shadowNode.setOffset(tx - (2 * blurRadius) + 1.0d,ty - (2 * blurRadius) + 1.0d);
  contentNodeWithShadow.addChild(shadowNode);
  contentNodeWithShadow.addChild(contentNode);
  contentNodeWithShadow.removeChild(shadowNode);
  contentNodeWithShadow.setOffset(xoffset - tx - blurRadius,yoffset - ty - blurRadius);
  contentNodeWithShadow.setBounds(0,0,contentNode.getWidth() + 2 * blurRadius + tx,contentNode.getHeight() + 2 * blurRadius + ty);
  return contentNodeWithShadow;
}
Program: 92333
Project: 92333
Buggy source:
@Override public BufferedImage getScreenshot(int x,int y,int width,int height){
  return fullScreenshot;
}

Fixed version (ground truth):
@Override public BufferedImage getScreenshot(int x,int y,int width,int height){
  return crop(fullScreenshot,x,y,width,height);
}
Program: 92334
Project: 92334
Buggy source:
public ScreenRegion snapshot(){
  Dimension size=screen.getSize();
  final BufferedImage fullScreenshot=screen.getScreenshot(0,0,size.width,size.height);
  ScreenRegion r=new ScreenRegion(this,0,0,width,height);
  r.setScreen(new Screen(){
    @Override public BufferedImage getScreenshot(    int x,    int y,    int width,    int height){
      return fullScreenshot;
    }
    @Override public Dimension getSize(){
      return screen.getSize();
    }
  }
);
  return r;
}

Fixed version (ground truth):
public ScreenRegion snapshot(){
  ScreenRegion r=new ScreenRegion(x,y,width,height);
  r.setScreen(new StaticScreen(this));
  return r;
}
Program: 92335
Project: 92335
Buggy source:
@Override public Dimension getSize(){
  return screen.getSize();
}

Fixed version (ground truth):
@Override public Dimension getSize(){
  return screenSize;
}
Program: 92336
Project: 92336
Buggy source:
static private List<Match> findCandidateMatches(ScreenRegion screenRegion,String word,double minScore,boolean firstMatchOnly){
  ScreenRegion snapshot=screenRegion.snapshot();
  TextMap map=TextMap.createFrom(snapshot.capture());
  List<Match> ret=Lists.newArrayList();
  for (  WeightedFontModel fontModel : fontModels) {
    logger.trace("String_Node_Str" + fontModel);
    BufferedImage img=TextImageGenerator.create(word,fontModel.getFont(),fontModel.getSize(),fontModel.getTracking());
    ImageTarget t=new ImageTarget(img);
    t.setMinScore(minScore);
    List<ScreenRegion> rs=snapshot.findAll(t);
    if (!rs.isEmpty()) {
      logger.trace("String_Node_Str" + rs.get(0).getScore());
      for (      ScreenRegion r : rs) {
        int localx=r.x - snapshot.x;
        int localy=r.y - snapshot.y;
        if (map.computeTextScore(localx,localy,r.width,r.height) > 0) {
          Match m=new Match(r,fontModel);
          ret.add(m);
          fontModel.maxScore=Math.max(fontModel.maxScore,r.getScore());
        }
      }
      double quickAcceptThreshold=Math.max(0.65,fontModel.maxScore * 0.85);
      if (firstMatchOnly && rs.get(0).getScore() >= quickAcceptThreshold) {
        return ret;
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
static private List<TextMatch> findCandidateMatches(ScreenRegion screenRegion,String word,double minScore,boolean firstMatchOnly){
  ScreenRegion snapshot=screenRegion.snapshot();
  TextMap map=TextMap.createFrom(snapshot.capture());
  List<TextMatch> ret=Lists.newArrayList();
  for (  WeightedFontModel fontModel : fontModels) {
    logger.trace("String_Node_Str" + fontModel);
    BufferedImage img=TextImageGenerator.create(word,fontModel.getFont(),fontModel.getSize(),fontModel.getTracking());
    ImageTarget t=new ImageTarget(img);
    t.setMinScore(minScore);
    List<ScreenRegion> rs=snapshot.findAll(t);
    if (!rs.isEmpty()) {
      logger.trace("String_Node_Str" + rs.get(0).getScore());
      for (      ScreenRegion r : rs) {
        int localx=r.x - snapshot.x;
        int localy=r.y - snapshot.y;
        if (map.computeTextScore(localx,localy,r.width,r.height) > 0) {
          TextMatch m=new TextMatch(r,fontModel);
          ret.add(m);
          fontModel.maxScore=Math.max(fontModel.maxScore,r.getScore());
        }
      }
      double quickAcceptThreshold=Math.max(0.65,fontModel.maxScore * 0.85);
      if (firstMatchOnly && rs.get(0).getScore() >= quickAcceptThreshold) {
        return ret;
      }
    }
  }
  return ret;
}
Program: 92337
Project: 92337
Buggy source:
@Override public int compare(Match m0,Match m1){
  return Double.compare(m1.screenRegion.getScore(),m0.screenRegion.getScore());
}

Fixed version (ground truth):
@Override public int compare(TextMatch m0,TextMatch m1){
  return Double.compare(m1.screenRegion.getScore(),m0.screenRegion.getScore());
}
Program: 92338
Project: 92338
Buggy source:
@Override public boolean apply(Match m2){
  ScreenRegion s2=m2.screenRegion;
  Rectangle r2=new Rectangle(s2.x,s2.y,s2.width,s2.height);
  return r1.intersects(r2);
}

Fixed version (ground truth):
@Override public boolean apply(TextMatch m2){
  ScreenRegion s2=m2.screenRegion;
  Rectangle r2=new Rectangle(s2.x,s2.y,s2.width,s2.height);
  return r1.intersects(r2);
}
Program: 92339
Project: 92339
Buggy source:
List<Match> findMatches(ScreenRegion screenRegion,String text){
  logger.debug("String_Node_Str" + text + "String_Node_Str");
  ScreenRegion snapshot=screenRegion.snapshot();
  List<Match> candidateMatches=findCandidateMatches(snapshot,text,getMinScore(),true);
  sortCandidateMatchesByScore(candidateMatches);
  candidateMatches=removeOverlappedMatches(candidateMatches);
  updateFontModelWeights(candidateMatches);
  sortFontModelsByWeight();
  explainer.step(visualize(snapshot.capture(),candidateMatches),"String_Node_Str" + text + "String_Node_Str");
  return candidateMatches;
}

Fixed version (ground truth):
List<TextMatch> findMatches(ScreenRegion screenRegion,String text){
  logger.debug("String_Node_Str" + text + "String_Node_Str");
  ScreenRegion snapshot=screenRegion.snapshot();
  List<TextMatch> candidateMatches=findCandidateMatches(snapshot,text,getMinScore(),true);
  sortCandidateMatchesByScore(candidateMatches);
  candidateMatches=removeOverlappedMatches(candidateMatches);
  updateFontModelWeights(candidateMatches);
  sortFontModelsByWeight();
  explainer.step(visualize(snapshot.capture(),candidateMatches),"String_Node_Str" + text + "String_Node_Str");
  return candidateMatches;
}
Program: 92340
Project: 92340
Buggy source:
static List<Match> removeOverlappedMatches(List<Match> candidateMatches){
  List<Match> filteredCandidateMatches=Lists.newArrayList();
  for (  Match m1 : candidateMatches) {
    final ScreenRegion s1=m1.screenRegion;
    final Rectangle r1=new Rectangle(s1.x,s1.y,s1.width,s1.height);
    boolean isOverlapping=Iterables.any(filteredCandidateMatches,new Predicate<Match>(){
      @Override public boolean apply(      Match m2){
        ScreenRegion s2=m2.screenRegion;
        Rectangle r2=new Rectangle(s2.x,s2.y,s2.width,s2.height);
        return r1.intersects(r2);
      }
    }
);
    if (!isOverlapping) {
      filteredCandidateMatches.add(m1);
    }
  }
  return filteredCandidateMatches;
}

Fixed version (ground truth):
static List<TextMatch> removeOverlappedMatches(List<TextMatch> candidateMatches){
  List<TextMatch> filteredCandidateMatches=Lists.newArrayList();
  for (  TextMatch m1 : candidateMatches) {
    final ScreenRegion s1=m1.screenRegion;
    final Rectangle r1=new Rectangle(s1.x,s1.y,s1.width,s1.height);
    boolean isOverlapping=Iterables.any(filteredCandidateMatches,new Predicate<TextMatch>(){
      @Override public boolean apply(      TextMatch m2){
        ScreenRegion s2=m2.screenRegion;
        Rectangle r2=new Rectangle(s2.x,s2.y,s2.width,s2.height);
        return r1.intersects(r2);
      }
    }
);
    if (!isOverlapping) {
      filteredCandidateMatches.add(m1);
    }
  }
  return filteredCandidateMatches;
}
Program: 92341
Project: 92341
Buggy source:
protected List<ScreenRegion> getUnordredMatches(ScreenRegion screenRegion){
  List<Match> matches=findMatches(screenRegion,text);
  return covertToScreenRegions(matches);
}

Fixed version (ground truth):
protected List<ScreenRegion> getUnordredMatches(ScreenRegion screenRegion){
  List<TextMatch> matches=findMatches(screenRegion,text);
  return covertToScreenRegions(screenRegion,matches);
}
Program: 92342
Project: 92342
Buggy source:
static ImageRenderer visualize(BufferedImage image,final List<Match> matches){
  ImageRenderer a=new PiccoloImageRenderer(image){
    @Override protected void addContent(    PLayer layer){
      for (int i=0; i < matches.size(); ++i) {
        if (i > 1)         continue;
        ScreenRegion r=matches.get(i).screenRegion;
        PPath p=PPath.createRectangle(r.x,r.y,r.width,r.height);
        if (i == 0)         p.setStrokePaint(Color.red);
 else         p.setStrokePaint(Color.blue);
        p.setPaint(null);
        PText t=new PText("String_Node_Str" + i);
        t.setOffset(r.x,r.y);
        layer.addChild(p);
        layer.addChild(t);
      }
    }
  }
;
  return a;
}

Fixed version (ground truth):
static ImageRenderer visualize(BufferedImage image,final List<TextMatch> matches){
  ImageRenderer a=new PiccoloImageRenderer(image){
    @Override protected void addContent(    PLayer layer){
      for (int i=0; i < matches.size(); ++i) {
        if (i > 1)         continue;
        ScreenRegion r=matches.get(i).screenRegion;
        PPath p=PPath.createRectangle(r.x,r.y,r.width,r.height);
        if (i == 0)         p.setStrokePaint(Color.red);
 else         p.setStrokePaint(Color.blue);
        p.setPaint(null);
        PText t=new PText("String_Node_Str" + i);
        t.setOffset(r.x,r.y);
        layer.addChild(p);
        layer.addChild(t);
      }
    }
  }
;
  return a;
}
Program: 92343
Project: 92343
Buggy source:
static private void sortCandidateMatchesByScore(List<Match> candidateMatches){
  Collections.sort(candidateMatches,new Comparator<Match>(){
    @Override public int compare(    Match m0,    Match m1){
      return Double.compare(m1.screenRegion.getScore(),m0.screenRegion.getScore());
    }
  }
);
}

Fixed version (ground truth):
static private void sortCandidateMatchesByScore(List<TextMatch> candidateMatches){
  Collections.sort(candidateMatches,new Comparator<TextMatch>(){
    @Override public int compare(    TextMatch m0,    TextMatch m1){
      return Double.compare(m1.screenRegion.getScore(),m0.screenRegion.getScore());
    }
  }
);
}
Program: 92344
Project: 92344
Buggy source:
static private void updateFontModelWeights(List<Match> candidateMatches){
  int w=candidateMatches.size();
  for (  Match m : candidateMatches) {
    m.fontModel.weight+=w;
    w--;
  }
}

Fixed version (ground truth):
static private void updateFontModelWeights(List<TextMatch> candidateMatches){
  int w=candidateMatches.size();
  for (  TextMatch m : candidateMatches) {
    m.fontModel.weight+=w;
    w--;
  }
}
Program: 92345
Project: 92345
Buggy source:
static public List<ScreenRegion> covertToScreenRegions(List<Match> matches){
  List<ScreenRegion> ret=Lists.newArrayList();
  for (  Match m : matches) {
    ret.add(m.screenRegion);
  }
  return ret;
}

Fixed version (ground truth):
static private List<ScreenRegion> covertToScreenRegions(ScreenRegion parent,List<TextMatch> matches){
  List<ScreenRegion> ret=Lists.newArrayList();
  for (  TextMatch m : matches) {
    ScreenRegion rm=m.screenRegion;
    rm.setScreen(parent.getScreen());
    ret.add(rm);
  }
  return ret;
}
Program: 92346
Project: 92346
Buggy source:
@Override protected void createDefaultActions(){
  updateDataSourceSelectionRunnable=new UpdateDataSourceSelectionRunnable();
  myOKAction=new MyOkAction(updateDataSourceSelectionRunnable);
  myCancelAction=new MyCancelAction();
}

Fixed version (ground truth):
@Override protected void createDefaultActions(){
  super.createDefaultActions();
  updateDataSourceSelectionRunnable=new UpdateDataSourceSelectionRunnable();
  myOKAction=new MyOkAction(updateDataSourceSelectionRunnable);
  myCancelAction=new MyCancelAction();
}
Program: 92347
Project: 92347
Buggy source:
@Nullable @Override public WordsScanner getWordsScanner(){
  return WORDS_SCANNER;
}

Fixed version (ground truth):
@Nullable @Override public WordsScanner getWordsScanner(){
  return new DefaultWordsScanner(new XQueryLexer(),TokenSet.EMPTY,XQueryParserDefinition.COMMENTS,XQueryParserDefinition.STRINGS);
}