nus-yam/ex-repair huggingface dataset:
Program: 36714
Project: 36714
Buggy source:
/** 
 * Defines a package by name in this <tt>ClassLoader</tt>.  This allows class loaders to define the packages for their classes. Packages must be created before the class is defined, and package names must be unique within a class loader and cannot be redefined or changed once created.  </p>
 * @param name The package name
 * @param specTitle The specification title
 * @param specVersion The specification version
 * @param specVendor The specification vendor
 * @param implTitle The implementation title
 * @param implVersion The implementation version
 * @param implVendor The implementation vendor
 * @param sealBase If not <tt>null</tt>, then this package is sealed with respect to the given code source  {@link java.net.URL <tt>URL</tt>}  object.  Otherwise, the package is not sealed.
 * @return  The newly defined <tt>Package</tt> object
 * @throws IllegalArgumentException If package name duplicates an existing package either in this class loader or one of its ancestors
 * @since  1.2
 */
protected Package definePackage(String name,String specTitle,String specVersion,String specVendor,String implTitle,String implVersion,String implVendor,URL sealBase) throws IllegalArgumentException {
synchronized (packages) {
    Package pkg=getPackage(name);
    if (pkg != null) {
      throw new IllegalArgumentException(name);
    }
    pkg=new Package(name,specTitle,specVersion,specVendor,implTitle,implVersion,implVendor,sealBase,this);
    packages.put(name,pkg);
    return pkg;
  }
}

Fixed version (ground truth):
/** 
 * Defines a package by name in this <tt>ClassLoader</tt>.  This allows class loaders to define the packages for their classes. Packages must be created before the class is defined, and package names must be unique within a class loader and cannot be redefined or changed once created.
 * @param name The package name
 * @param specTitle The specification title
 * @param specVersion The specification version
 * @param specVendor The specification vendor
 * @param implTitle The implementation title
 * @param implVersion The implementation version
 * @param implVendor The implementation vendor
 * @param sealBase If not <tt>null</tt>, then this package is sealed with respect to the given code source  {@link java.net.URL <tt>URL</tt>}  object.  Otherwise, the package is not sealed.
 * @return  The newly defined <tt>Package</tt> object
 * @throws IllegalArgumentException If package name duplicates an existing package either in this class loader or one of its ancestors
 * @since  1.2
 */
protected Package definePackage(String name,String specTitle,String specVersion,String specVendor,String implTitle,String implVersion,String implVendor,URL sealBase) throws IllegalArgumentException {
synchronized (packages) {
    Package pkg=getPackage(name);
    if (pkg != null) {
      throw new IllegalArgumentException(name);
    }
    pkg=new Package(name,specTitle,specVersion,specVendor,implTitle,implVersion,implVendor,sealBase,this);
    packages.put(name,pkg);
    return pkg;
  }
}
Program: 36716
Project: 36716
Buggy source:
/** 
 * Returns the class with the given <a href="#name">binary name</a> if this loader has been recorded by the Java virtual machine as an initiating loader of a class with that <a href="#name">binary name</a>.  Otherwise <tt>null</tt> is returned.  </p>
 * @param name The <a href="#name">binary name</a> of the class
 * @return  The <tt>Class</tt> object, or <tt>null</tt> if the class hasnot been loaded
 * @since  1.1
 */
protected final Class<?> findLoadedClass(String name){
  if (!checkName(name))   return null;
  return findLoadedClass0(name);
}

Fixed version (ground truth):
/** 
 * Returns the class with the given <a href="#name">binary name</a> if this loader has been recorded by the Java virtual machine as an initiating loader of a class with that <a href="#name">binary name</a>.  Otherwise <tt>null</tt> is returned.
 * @param name The <a href="#name">binary name</a> of the class
 * @return  The <tt>Class</tt> object, or <tt>null</tt> if the class hasnot been loaded
 * @since  1.1
 */
protected final Class<?> findLoadedClass(String name){
  if (!checkName(name))   return null;
  return findLoadedClass0(name);
}
Program: 36717
Project: 36717
Buggy source:
/** 
 * Find a resource of the specified name from the search path used to load classes.  This method locates the resource through the system class loader (see   {@link #getSystemClassLoader()}).  </p>
 * @param name The resource name
 * @return  A {@link java.net.URL <tt>URL</tt>} object for reading theresource, or <tt>null</tt> if the resource could not be found
 * @since  1.1
 */
public static URL getSystemResource(String name){
  ClassLoader system=getSystemClassLoader();
  if (system == null) {
    return getBootstrapResource(name);
  }
  return system.getResource(name);
}

Fixed version (ground truth):
/** 
 * Find a resource of the specified name from the search path used to load classes.  This method locates the resource through the system class loader (see   {@link #getSystemClassLoader()}).
 * @param name The resource name
 * @return  A {@link java.net.URL <tt>URL</tt>} object for reading theresource, or <tt>null</tt> if the resource could not be found
 * @since  1.1
 */
public static URL getSystemResource(String name){
  ClassLoader system=getSystemClassLoader();
  if (system == null) {
    return getBootstrapResource(name);
  }
  return system.getResource(name);
}
Program: 36718
Project: 36718
Buggy source:
/** 
 * Sets the signers of a class.  This should be invoked after defining a class.  </p>
 * @param c The <tt>Class</tt> object
 * @param signers The signers for the class
 * @since  1.1
 */
protected final void setSigners(Class<?> c,Object[] signers){
  c.setSigners(signers);
}

Fixed version (ground truth):
/** 
 * Sets the signers of a class.  This should be invoked after defining a class.
 * @param c The <tt>Class</tt> object
 * @param signers The signers for the class
 * @since  1.1
 */
protected final void setSigners(Class<?> c,Object[] signers){
  c.setSigners(signers);
}
Program: 36719
Project: 36719
Buggy source:
/** 
 * Returns all of the <tt>Packages</tt> defined by this class loader and its ancestors.  </p>
 * @return  The array of <tt>Package</tt> objects defined by this<tt>ClassLoader</tt>
 * @since  1.2
 */
protected Package[] getPackages(){
  Map<String,Package> map;
synchronized (packages) {
    map=new HashMap<>(packages);
  }
  Package[] pkgs;
  if (parent != null) {
    pkgs=parent.getPackages();
  }
 else {
    pkgs=Package.getSystemPackages();
  }
  if (pkgs != null) {
    for (int i=0; i < pkgs.length; i++) {
      String pkgName=pkgs[i].getName();
      if (map.get(pkgName) == null) {
        map.put(pkgName,pkgs[i]);
      }
    }
  }
  return map.values().toArray(new Package[map.size()]);
}

Fixed version (ground truth):
/** 
 * Returns all of the <tt>Packages</tt> defined by this class loader and its ancestors.
 * @return  The array of <tt>Package</tt> objects defined by this<tt>ClassLoader</tt>
 * @since  1.2
 */
protected Package[] getPackages(){
  Map<String,Package> map;
synchronized (packages) {
    map=new HashMap<>(packages);
  }
  Package[] pkgs;
  if (parent != null) {
    pkgs=parent.getPackages();
  }
 else {
    pkgs=Package.getSystemPackages();
  }
  if (pkgs != null) {
    for (int i=0; i < pkgs.length; i++) {
      String pkgName=pkgs[i].getName();
      if (map.get(pkgName) == null) {
        map.put(pkgName,pkgs[i]);
      }
    }
  }
  return map.values().toArray(new Package[map.size()]);
}
Program: 36720
Project: 36720
Buggy source:
/** 
 * Returns the lock object for class loading operations. For backward compatibility, the default implementation of this method behaves as follows. If this ClassLoader object is registered as parallel capable, the method returns a dedicated object associated with the specified class name. Otherwise, the method returns this ClassLoader object. </p>
 * @param className The name of the to-be-loaded class
 * @return the lock for class loading operations
 * @throws NullPointerException If registered as parallel capable and <tt>className</tt> is null
 * @see #loadClass(String,boolean)
 * @since  1.7
 */
protected Object getClassLoadingLock(String className){
  Object lock=this;
  if (parallelLockMap != null) {
    Object newLock=new Object();
    lock=parallelLockMap.putIfAbsent(className,newLock);
    if (lock == null) {
      lock=newLock;
    }
  }
  return lock;
}

Fixed version (ground truth):
/** 
 * Returns the lock object for class loading operations. For backward compatibility, the default implementation of this method behaves as follows. If this ClassLoader object is registered as parallel capable, the method returns a dedicated object associated with the specified class name. Otherwise, the method returns this ClassLoader object.
 * @param className The name of the to-be-loaded class
 * @return the lock for class loading operations
 * @throws NullPointerException If registered as parallel capable and <tt>className</tt> is null
 * @see #loadClass(String,boolean)
 * @since  1.7
 */
protected Object getClassLoadingLock(String className){
  Object lock=this;
  if (parallelLockMap != null) {
    Object newLock=new Object();
    lock=parallelLockMap.putIfAbsent(className,newLock);
    if (lock == null) {
      lock=newLock;
    }
  }
  return lock;
}
Program: 36721
Project: 36721
Buggy source:
/** 
 * Returns the absolute path name of a native library.  The VM invokes this method to locate the native libraries that belong to classes loaded with this class loader. If this method returns <tt>null</tt>, the VM searches the library along the path specified as the "<tt>java.library.path</tt>" property.  </p>
 * @param libname The library name
 * @return  The absolute path of the native library
 * @see System#loadLibrary(String)
 * @see System#mapLibraryName(String)
 * @since  1.2
 */
protected String findLibrary(String libname){
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the absolute path name of a native library.  The VM invokes this method to locate the native libraries that belong to classes loaded with this class loader. If this method returns <tt>null</tt>, the VM searches the library along the path specified as the "<tt>java.library.path</tt>" property.
 * @param libname The library name
 * @return  The absolute path of the native library
 * @see System#loadLibrary(String)
 * @see System#mapLibraryName(String)
 * @since  1.2
 */
protected String findLibrary(String libname){
  return null;
}
Program: 36724
Project: 36724
Buggy source:
/** 
 * Returns a redirect to append to the specified file. Each write operation first advances the position to the end of the file and then writes the requested data. Whether the advancement of the position and the writing of the data are done in a single atomic operation is system-dependent and therefore unspecified. <p>It will always be true that <pre>   {@code Redirect.appendTo(file).file() == file && Redirect.appendTo(file).type() == Redirect.Type.APPEND}</pre>
 * @throws NullPointerException if the specified file is null
 * @return a redirect to append to the specified file
 */
public static Redirect appendTo(final File file){
  if (file == null)   throw new NullPointerException();
  return new Redirect(){
    public Type type(){
      return Type.APPEND;
    }
    public File file(){
      return file;
    }
    public String toString(){
      return "String_Node_Str" + file + "String_Node_Str";
    }
    boolean append(){
      return true;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a redirect to append to the specified file. Each write operation first advances the position to the end of the file and then writes the requested data. Whether the advancement of the position and the writing of the data are done in a single atomic operation is system-dependent and therefore unspecified. <p>It will always be true that <pre>   {@code Redirect.appendTo(file).file() == file && Redirect.appendTo(file).type() == Redirect.Type.APPEND}</pre>
 * @param file The {@code File} for the {@code Redirect}.
 * @throws NullPointerException if the specified file is null
 * @return a redirect to append to the specified file
 */
public static Redirect appendTo(final File file){
  if (file == null)   throw new NullPointerException();
  return new Redirect(){
    public Type type(){
      return Type.APPEND;
    }
    public File file(){
      return file;
    }
    public String toString(){
      return "String_Node_Str" + file + "String_Node_Str";
    }
    boolean append(){
      return true;
    }
  }
;
}
Program: 36725
Project: 36725
Buggy source:
/** 
 * Returns a redirect to read from the specified file. <p>It will always be true that <pre>   {@code Redirect.from(file).file() == file && Redirect.from(file).type() == Redirect.Type.READ}</pre>
 * @throws NullPointerException if the specified file is null
 * @return a redirect to read from the specified file
 */
public static Redirect from(final File file){
  if (file == null)   throw new NullPointerException();
  return new Redirect(){
    public Type type(){
      return Type.READ;
    }
    public File file(){
      return file;
    }
    public String toString(){
      return "String_Node_Str" + file + "String_Node_Str";
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a redirect to read from the specified file. <p>It will always be true that <pre>   {@code Redirect.from(file).file() == file && Redirect.from(file).type() == Redirect.Type.READ}</pre>
 * @param file The {@code File} for the {@code Redirect}.
 * @throws NullPointerException if the specified file is null
 * @return a redirect to read from the specified file
 */
public static Redirect from(final File file){
  if (file == null)   throw new NullPointerException();
  return new Redirect(){
    public Type type(){
      return Type.READ;
    }
    public File file(){
      return file;
    }
    public String toString(){
      return "String_Node_Str" + file + "String_Node_Str";
    }
  }
;
}
Program: 36726
Project: 36726
Buggy source:
/** 
 * Returns a redirect to write to the specified file. If the specified file exists when the subprocess is started, its previous contents will be discarded. <p>It will always be true that <pre>   {@code Redirect.to(file).file() == file && Redirect.to(file).type() == Redirect.Type.WRITE}</pre>
 * @throws NullPointerException if the specified file is null
 * @return a redirect to write to the specified file
 */
public static Redirect to(final File file){
  if (file == null)   throw new NullPointerException();
  return new Redirect(){
    public Type type(){
      return Type.WRITE;
    }
    public File file(){
      return file;
    }
    public String toString(){
      return "String_Node_Str" + file + "String_Node_Str";
    }
    boolean append(){
      return false;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a redirect to write to the specified file. If the specified file exists when the subprocess is started, its previous contents will be discarded. <p>It will always be true that <pre>   {@code Redirect.to(file).file() == file && Redirect.to(file).type() == Redirect.Type.WRITE}</pre>
 * @param file The {@code File} for the {@code Redirect}.
 * @throws NullPointerException if the specified file is null
 * @return a redirect to write to the specified file
 */
public static Redirect to(final File file){
  if (file == null)   throw new NullPointerException();
  return new Redirect(){
    public Type type(){
      return Type.WRITE;
    }
    public File file(){
      return file;
    }
    public String toString(){
      return "String_Node_Str" + file + "String_Node_Str";
    }
    boolean append(){
      return false;
    }
  }
;
}
Program: 36727
Project: 36727
Buggy source:
/** 
 * Returns the maximum amount of memory that the Java virtual machine will attempt to use.  If there is no inherent limit then the value   {@link java.lang.Long#MAX_VALUE} will be returned. </p>
 * @return  the maximum amount of memory that the virtual machine willattempt to use, measured in bytes
 * @since 1.4
 */
public native long maxMemory();

Fixed version (ground truth):
/** 
 * Returns the maximum amount of memory that the Java virtual machine will attempt to use.  If there is no inherent limit then the value   {@link java.lang.Long#MAX_VALUE} will be returned.
 * @return  the maximum amount of memory that the virtual machine willattempt to use, measured in bytes
 * @since 1.4
 */
public native long maxMemory();
Program: 36729
Project: 36729
Buggy source:
/** 
 * Returns the default handler invoked when a thread abruptly terminates due to an uncaught exception. If the returned value is <tt>null</tt>, there is no default.
 * @since 1.5
 * @see #setDefaultUncaughtExceptionHandler
 */
public static UncaughtExceptionHandler getDefaultUncaughtExceptionHandler(){
  return defaultUncaughtExceptionHandler;
}

Fixed version (ground truth):
/** 
 * Returns the default handler invoked when a thread abruptly terminates due to an uncaught exception. If the returned value is <tt>null</tt>, there is no default.
 * @since 1.5
 * @see #setDefaultUncaughtExceptionHandler
 * @return the default uncaught exception handler for all threads
 */
public static UncaughtExceptionHandler getDefaultUncaughtExceptionHandler(){
  return defaultUncaughtExceptionHandler;
}
Program: 36730
Project: 36730
Buggy source:
/** 
 * Returns the handler invoked when this thread abruptly terminates due to an uncaught exception. If this thread has not had an uncaught exception handler explicitly set then this thread's <tt>ThreadGroup</tt> object is returned, unless this thread has terminated, in which case <tt>null</tt> is returned.
 * @since 1.5
 */
public UncaughtExceptionHandler getUncaughtExceptionHandler(){
  return uncaughtExceptionHandler != null ? uncaughtExceptionHandler : group;
}

Fixed version (ground truth):
/** 
 * Returns the handler invoked when this thread abruptly terminates due to an uncaught exception. If this thread has not had an uncaught exception handler explicitly set then this thread's <tt>ThreadGroup</tt> object is returned, unless this thread has terminated, in which case <tt>null</tt> is returned.
 * @since 1.5
 * @return the uncaught exception handler for this thread
 */
public UncaughtExceptionHandler getUncaughtExceptionHandler(){
  return uncaughtExceptionHandler != null ? uncaughtExceptionHandler : group;
}
Program: 36731
Project: 36731
Buggy source:
/** 
 * Creates a thread local variable. The initial value of the variable is determined by invoking the   {@code get} method on the {@code Supplier}.
 * @param supplier the supplier to be used to determine the initial value
 * @return a new thread local variable
 * @throws NullPointerException if the specified supplier is null
 * @since 1.8
 */
public static <T>ThreadLocal<T> withInitial(Supplier<? extends T> supplier){
  return new SuppliedThreadLocal<>(supplier);
}

Fixed version (ground truth):
/** 
 * Creates a thread local variable. The initial value of the variable is determined by invoking the   {@code get} method on the {@code Supplier}.
 * @param < S > the type of the thread local's value
 * @param supplier the supplier to be used to determine the initial value
 * @return a new thread local variable
 * @throws NullPointerException if the specified supplier is null
 * @since 1.8
 */
public static <S>ThreadLocal<S> withInitial(Supplier<? extends S> supplier){
  return new SuppliedThreadLocal<>(supplier);
}
Program: 36732
Project: 36732
Buggy source:
/** 
 * Returns the length of this character sequence.  The length is the number of 16-bit <code>char</code>s in the sequence.</p>
 * @return  the number of <code>char</code>s in this sequence
 */
int length();

Fixed version (ground truth):
/** 
 * Returns the length of this character sequence.  The length is the number of 16-bit <code>char</code>s in the sequence.
 * @return  the number of <code>char</code>s in this sequence
 */
int length();
Program: 36733
Project: 36733
Buggy source:
/** 
 * Returns a string containing the characters in this sequence in the same order as this sequence.  The length of the string will be the length of this sequence. </p>
 * @return  a string consisting of exactly this sequence of characters
 */
public String toString();

Fixed version (ground truth):
/** 
 * Returns a string containing the characters in this sequence in the same order as this sequence.  The length of the string will be the length of this sequence.
 * @return  a string consisting of exactly this sequence of characters
 */
public String toString();
Program: 36734
Project: 36734
Buggy source:
/** 
 * Returns a new <code>CharSequence</code> that is a subsequence of this sequence. The subsequence starts with the <code>char</code> value at the specified index and ends with the <code>char</code> value at index <tt>end - 1</tt>.  The length (in <code>char</code>s) of the returned sequence is <tt>end - start</tt>, so if <tt>start == end</tt> then an empty sequence is returned. </p>
 * @param start   the start index, inclusive
 * @param end     the end index, exclusive
 * @return  the specified subsequence
 * @throws IndexOutOfBoundsException if <tt>start</tt> or <tt>end</tt> are negative, if <tt>end</tt> is greater than <tt>length()</tt>, or if <tt>start</tt> is greater than <tt>end</tt>
 */
CharSequence subSequence(int start,int end);

Fixed version (ground truth):
/** 
 * Returns a new <code>CharSequence</code> that is a subsequence of this sequence. The subsequence starts with the <code>char</code> value at the specified index and ends with the <code>char</code> value at index <tt>end - 1</tt>.  The length (in <code>char</code>s) of the returned sequence is <tt>end - start</tt>, so if <tt>start == end</tt> then an empty sequence is returned.
 * @param start   the start index, inclusive
 * @param end     the end index, exclusive
 * @return  the specified subsequence
 * @throws IndexOutOfBoundsException if <tt>start</tt> or <tt>end</tt> are negative, if <tt>end</tt> is greater than <tt>length()</tt>, or if <tt>start</tt> is greater than <tt>end</tt>
 */
CharSequence subSequence(int start,int end);
Program: 36735
Project: 36735
Buggy source:
/** 
 * Returns the <code>char</code> value at the specified index.  An index ranges from zero to <tt>length() - 1</tt>.  The first <code>char</code> value of the sequence is at index zero, the next at index one, and so on, as for array indexing. </p> <p>If the <code>char</code> value specified by the index is a <a href="  {@docRoot}/java/lang/Character.html#unicode">surrogate</a>, the surrogate value is returned.
 * @param index   the index of the <code>char</code> value to be returned
 * @return  the specified <code>char</code> value
 * @throws IndexOutOfBoundsException if the <tt>index</tt> argument is negative or not less than <tt>length()</tt>
 */
char charAt(int index);

Fixed version (ground truth):
/** 
 * Returns the <code>char</code> value at the specified index.  An index ranges from zero to <tt>length() - 1</tt>.  The first <code>char</code> value of the sequence is at index zero, the next at index one, and so on, as for array indexing. <p>If the <code>char</code> value specified by the index is a <a href="  {@docRoot}/java/lang/Character.html#unicode">surrogate</a>, the surrogate value is returned.
 * @param index   the index of the <code>char</code> value to be returned
 * @return  the specified <code>char</code> value
 * @throws IndexOutOfBoundsException if the <tt>index</tt> argument is negative or not less than <tt>length()</tt>
 */
char charAt(int index);
Program: 36736
Project: 36736
Buggy source:
/** 
 * Determines if the specified character is ISO-LATIN-1 white space. This method returns   {@code true} for the following fivecharacters only: <table> <tr><td> {@code '\t'}</td>            <td>  {@code U+0009}</td> <td>  {@code HORIZONTAL TABULATION}</td></tr> <tr><td>  {@code '\n'}</td>            <td>  {@code U+000A}</td> <td>  {@code NEW LINE}</td></tr> <tr><td>  {@code '\f'}</td>            <td>  {@code U+000C}</td> <td>  {@code FORM FEED}</td></tr> <tr><td>  {@code '\r'}</td>            <td>  {@code U+000D}</td> <td>  {@code CARRIAGE RETURN}</td></tr> <tr><td>  {@code '&nbsp;'}</td>  <td>  {@code U+0020}</td> <td>  {@code SPACE}</td></tr> </table>
 * @param ch   the character to be tested.
 * @return     {@code true} if the character is ISO-LATIN-1 whitespace;  {@code false} otherwise.
 * @see Character#isSpaceChar(char)
 * @see Character#isWhitespace(char)
 * @deprecated Replaced by isWhitespace(char).
 */
@Deprecated public static boolean isSpace(char ch){
  return (ch <= 0x0020) && (((((1L << 0x0009) | (1L << 0x000A) | (1L << 0x000C)| (1L << 0x000D)| (1L << 0x0020)) >> ch) & 1L) != 0);
}

Fixed version (ground truth):
/** 
 * Determines if the specified character is ISO-LATIN-1 white space. This method returns   {@code true} for the following fivecharacters only: <table summary="truechars"> <tr><td> {@code '\t'}</td>            <td>  {@code U+0009}</td> <td>  {@code HORIZONTAL TABULATION}</td></tr> <tr><td>  {@code '\n'}</td>            <td>  {@code U+000A}</td> <td>  {@code NEW LINE}</td></tr> <tr><td>  {@code '\f'}</td>            <td>  {@code U+000C}</td> <td>  {@code FORM FEED}</td></tr> <tr><td>  {@code '\r'}</td>            <td>  {@code U+000D}</td> <td>  {@code CARRIAGE RETURN}</td></tr> <tr><td>  {@code '&nbsp;'}</td>  <td>  {@code U+0020}</td> <td>  {@code SPACE}</td></tr> </table>
 * @param ch   the character to be tested.
 * @return     {@code true} if the character is ISO-LATIN-1 whitespace;  {@code false} otherwise.
 * @see Character#isSpaceChar(char)
 * @see Character#isWhitespace(char)
 * @deprecated Replaced by isWhitespace(char).
 */
@Deprecated public static boolean isSpace(char ch){
  return (ch <= 0x0020) && (((((1L << 0x0009) | (1L << 0x000A) | (1L << 0x000C)| (1L << 0x000D)| (1L << 0x0020)) >> ch) & 1L) != 0);
}
Program: 36737
Project: 36737
Buggy source:
/** 
 * Returns the value obtained by reversing the order of the bytes in the specified <tt>char</tt> value.
 * @return the value obtained by reversing (or, equivalently, swapping)the bytes in the specified <tt>char</tt> value.
 * @since 1.5
 */
public static char reverseBytes(char ch){
  return (char)(((ch & 0xFF00) >> 8) | (ch << 8));
}

Fixed version (ground truth):
/** 
 * Returns the value obtained by reversing the order of the bytes in the specified <tt>char</tt> value.
 * @param ch The {@code char} of which to reverse the byte order.
 * @return the value obtained by reversing (or, equivalently, swapping)the bytes in the specified <tt>char</tt> value.
 * @since 1.5
 */
public static char reverseBytes(char ch){
  return (char)(((ch & 0xFF00) >> 8) | (ch << 8));
}
Program: 36738
Project: 36738
Buggy source:
/** 
 * Returns a hash code for a   {@code char} value; compatible with{@code Character.hashCode()}.
 * @since 1.8
 * @return a hash code value for a {@code char} value.
 */
public static int hashCode(char value){
  return (int)value;
}

Fixed version (ground truth):
/** 
 * Returns a hash code for a   {@code char} value; compatible with{@code Character.hashCode()}.
 * @since 1.8
 * @param value The {@code char} for which to return a hash code.
 * @return a hash code value for a {@code char} value.
 */
public static int hashCode(char value){
  return (int)value;
}
Program: 36739
Project: 36739
Buggy source:
/** 
 * Finds the resource with the given name. Class loader implementations should override this method to specify where to find resources.  </p>
 * @param name The resource name
 * @return  A <tt>URL</tt> object for reading the resource, or<tt>null</tt> if the resource could not be found
 * @since  1.2
 */
protected URL findResource(String name){
  return null;
}

Fixed version (ground truth):
/** 
 * Finds the resource with the given name. Class loader implementations should override this method to specify where to find resources.
 * @param name The resource name
 * @return  A <tt>URL</tt> object for reading the resource, or<tt>null</tt> if the resource could not be found
 * @since  1.2
 */
protected URL findResource(String name){
  return null;
}
Program: 36740
Project: 36740
Buggy source:
/** 
 * Sets the default assertion status for this class loader to <tt>false</tt> and discards any package defaults or class assertion status settings associated with the class loader.  This method is provided so that class loaders can be made to ignore any command line or persistent assertion status settings and "start with a clean slate." </p>
 * @since  1.4
 */
public void clearAssertionStatus(){
synchronized (assertionLock) {
    classAssertionStatus=new HashMap<>();
    packageAssertionStatus=new HashMap<>();
    defaultAssertionStatus=false;
  }
}

Fixed version (ground truth):
/** 
 * Sets the default assertion status for this class loader to <tt>false</tt> and discards any package defaults or class assertion status settings associated with the class loader.  This method is provided so that class loaders can be made to ignore any command line or persistent assertion status settings and "start with a clean slate."
 * @since  1.4
 */
public void clearAssertionStatus(){
synchronized (assertionLock) {
    classAssertionStatus=new HashMap<>();
    packageAssertionStatus=new HashMap<>();
    defaultAssertionStatus=false;
  }
}
Program: 36741
Project: 36741
Buggy source:
/** 
 * Registers the caller as parallel capable.</p> The registration succeeds if and only if all of the following conditions are met: <br> 1. no instance of the caller has been created</p> 2. all of the super classes (except class Object) of the caller are registered as parallel capable</p> Note that once a class loader is registered as parallel capable, there is no way to change it back. </p>
 * @return  true if the caller is successfully registered asparallel capable and false if otherwise.
 * @since   1.7
 */
@CallerSensitive protected static boolean registerAsParallelCapable(){
  Class<? extends ClassLoader> callerClass=Reflection.getCallerClass().asSubclass(ClassLoader.class);
  return ParallelLoaders.register(callerClass);
}

Fixed version (ground truth):
/** 
 * Registers the caller as parallel capable. The registration succeeds if and only if all of the following conditions are met: <ol> <li> no instance of the caller has been created</li> <li> all of the super classes (except class Object) of the caller are registered as parallel capable</li> </ol> <p>Note that once a class loader is registered as parallel capable, there is no way to change it back.</p>
 * @return  true if the caller is successfully registered asparallel capable and false if otherwise.
 * @since   1.7
 */
@CallerSensitive protected static boolean registerAsParallelCapable(){
  Class<? extends ClassLoader> callerClass=Reflection.getCallerClass().asSubclass(ClassLoader.class);
  return ParallelLoaders.register(callerClass);
}
Program: 36742
Project: 36742
Buggy source:
/** 
 * Returns a <tt>Package</tt> that has been defined by this class loader or any of its ancestors.  </p>
 * @param name The package name
 * @return  The <tt>Package</tt> corresponding to the given name, or<tt>null</tt> if not found
 * @since  1.2
 */
protected Package getPackage(String name){
  Package pkg;
synchronized (packages) {
    pkg=packages.get(name);
  }
  if (pkg == null) {
    if (parent != null) {
      pkg=parent.getPackage(name);
    }
 else {
      pkg=Package.getSystemPackage(name);
    }
    if (pkg != null) {
synchronized (packages) {
        Package pkg2=packages.get(name);
        if (pkg2 == null) {
          packages.put(name,pkg);
        }
 else {
          pkg=pkg2;
        }
      }
    }
  }
  return pkg;
}

Fixed version (ground truth):
/** 
 * Returns a <tt>Package</tt> that has been defined by this class loader or any of its ancestors.
 * @param name The package name
 * @return  The <tt>Package</tt> corresponding to the given name, or<tt>null</tt> if not found
 * @since  1.2
 */
protected Package getPackage(String name){
  Package pkg;
synchronized (packages) {
    pkg=packages.get(name);
  }
  if (pkg == null) {
    if (parent != null) {
      pkg=parent.getPackage(name);
    }
 else {
      pkg=Package.getSystemPackage(name);
    }
    if (pkg != null) {
synchronized (packages) {
        Package pkg2=packages.get(name);
        if (pkg2 == null) {
          packages.put(name,pkg);
        }
 else {
          pkg=pkg2;
        }
      }
    }
  }
  return pkg;
}
Program: 36743
Project: 36743
Buggy source:
/** 
 * Returns an enumeration of   {@link java.net.URL <tt>URL</tt>} objectsrepresenting all the resources with the given name. Class loader implementations should override this method to specify where to load resources from.  </p>
 * @param name The resource name
 * @return  An enumeration of {@link java.net.URL <tt>URL</tt>} objects forthe resources
 * @throws IOException If I/O errors occur
 * @since  1.2
 */
protected Enumeration<URL> findResources(String name) throws IOException {
  return java.util.Collections.emptyEnumeration();
}

Fixed version (ground truth):
/** 
 * Returns an enumeration of   {@link java.net.URL <tt>URL</tt>} objectsrepresenting all the resources with the given name. Class loader implementations should override this method to specify where to load resources from.
 * @param name The resource name
 * @return  An enumeration of {@link java.net.URL <tt>URL</tt>} objects forthe resources
 * @throws IOException If I/O errors occur
 * @since  1.2
 */
protected Enumeration<URL> findResources(String name) throws IOException {
  return java.util.Collections.emptyEnumeration();
}
Program: 36744
Project: 36744
Buggy source:
/** 
 * Finds the class with the specified <a href="#name">binary name</a>. This method should be overridden by class loader implementations that follow the delegation model for loading classes, and will be invoked by the   {@link #loadClass <tt>loadClass</tt>} method after checking theparent class loader for the requested class.  The default implementation throws a <tt>ClassNotFoundException</tt>.  </p>
 * @param name The <a href="#name">binary name</a> of the class
 * @return  The resulting <tt>Class</tt> object
 * @throws ClassNotFoundException If the class could not be found
 * @since  1.2
 */
protected Class<?> findClass(String name) throws ClassNotFoundException {
  throw new ClassNotFoundException(name);
}

Fixed version (ground truth):
/** 
 * Finds the class with the specified <a href="#name">binary name</a>. This method should be overridden by class loader implementations that follow the delegation model for loading classes, and will be invoked by the   {@link #loadClass <tt>loadClass</tt>} method after checking theparent class loader for the requested class.  The default implementation throws a <tt>ClassNotFoundException</tt>.
 * @param name The <a href="#name">binary name</a> of the class
 * @return  The resulting <tt>Class</tt> object
 * @throws ClassNotFoundException If the class could not be found
 * @since  1.2
 */
protected Class<?> findClass(String name) throws ClassNotFoundException {
  throw new ClassNotFoundException(name);
}
Program: 36745
Project: 36745
Buggy source:
/** 
 * Open for reading, a resource of the specified name from the search path used to load classes.  This method locates the resource through the system class loader (see   {@link #getSystemClassLoader()}).  </p>
 * @param name The resource name
 * @return  An input stream for reading the resource, or <tt>null</tt>if the resource could not be found
 * @since  1.1
 */
public static InputStream getSystemResourceAsStream(String name){
  URL url=getSystemResource(name);
  try {
    return url != null ? url.openStream() : null;
  }
 catch (  IOException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Open for reading, a resource of the specified name from the search path used to load classes.  This method locates the resource through the system class loader (see   {@link #getSystemClassLoader()}).
 * @param name The resource name
 * @return  An input stream for reading the resource, or <tt>null</tt>if the resource could not be found
 * @since  1.1
 */
public static InputStream getSystemResourceAsStream(String name){
  URL url=getSystemResource(name);
  try {
    return url != null ? url.openStream() : null;
  }
 catch (  IOException e) {
    return null;
  }
}
Program: 36746
Project: 36746
Buggy source:
/** 
 * Links the specified class.  This (misleadingly named) method may be used by a class loader to link a class.  If the class <tt>c</tt> has already been linked, then this method simply returns. Otherwise, the class is linked as described in the "Execution" chapter of <cite>The Java&trade; Language Specification</cite>. </p>
 * @param c The class to link
 * @throws NullPointerException If <tt>c</tt> is <tt>null</tt>.
 * @see #defineClass(String,byte[],int,int)
 */
protected final void resolveClass(Class<?> c){
  resolveClass0(c);
}

Fixed version (ground truth):
/** 
 * Links the specified class.  This (misleadingly named) method may be used by a class loader to link a class.  If the class <tt>c</tt> has already been linked, then this method simply returns. Otherwise, the class is linked as described in the "Execution" chapter of <cite>The Java&trade; Language Specification</cite>.
 * @param c The class to link
 * @throws NullPointerException If <tt>c</tt> is <tt>null</tt>.
 * @see #defineClass(String,byte[],int,int)
 */
protected final void resolveClass(Class<?> c){
  resolveClass0(c);
}
Program: 36747
Project: 36747
Buggy source:
/** 
 * Sets the default assertion status for this class loader.  This setting determines whether classes loaded by this class loader and initialized in the future will have assertions enabled or disabled by default. This setting may be overridden on a per-package or per-class basis by invoking   {@link #setPackageAssertionStatus(String,boolean)} or {@link #setClassAssertionStatus(String,boolean)}.  </p>
 * @param enabled <tt>true</tt> if classes loaded by this class loader will henceforth have assertions enabled by default, <tt>false</tt> if they will have assertions disabled by default.
 * @since  1.4
 */
public void setDefaultAssertionStatus(boolean enabled){
synchronized (assertionLock) {
    if (classAssertionStatus == null)     initializeJavaAssertionMaps();
    defaultAssertionStatus=enabled;
  }
}

Fixed version (ground truth):
/** 
 * Sets the default assertion status for this class loader.  This setting determines whether classes loaded by this class loader and initialized in the future will have assertions enabled or disabled by default. This setting may be overridden on a per-package or per-class basis by invoking   {@link #setPackageAssertionStatus(String,boolean)} or {@link #setClassAssertionStatus(String,boolean)}.
 * @param enabled <tt>true</tt> if classes loaded by this class loader will henceforth have assertions enabled by default, <tt>false</tt> if they will have assertions disabled by default.
 * @since  1.4
 */
public void setDefaultAssertionStatus(boolean enabled){
synchronized (assertionLock) {
    if (classAssertionStatus == null)     initializeJavaAssertionMaps();
    defaultAssertionStatus=enabled;
  }
}
Program: 36748
Project: 36748
Buggy source:
/** 
 * Defines a package by name in this <tt>ClassLoader</tt>.  This allows class loaders to define the packages for their classes. Packages must be created before the class is defined, and package names must be unique within a class loader and cannot be redefined or changed once created.  </p>
 * @param name The package name
 * @param specTitle The specification title
 * @param specVersion The specification version
 * @param specVendor The specification vendor
 * @param implTitle The implementation title
 * @param implVersion The implementation version
 * @param implVendor The implementation vendor
 * @param sealBase If not <tt>null</tt>, then this package is sealed with respect to the given code source  {@link java.net.URL <tt>URL</tt>}  object.  Otherwise, the package is not sealed.
 * @return  The newly defined <tt>Package</tt> object
 * @throws IllegalArgumentException If package name duplicates an existing package either in this class loader or one of its ancestors
 * @since  1.2
 */
protected Package definePackage(String name,String specTitle,String specVersion,String specVendor,String implTitle,String implVersion,String implVendor,URL sealBase) throws IllegalArgumentException {
synchronized (packages) {
    Package pkg=getPackage(name);
    if (pkg != null) {
      throw new IllegalArgumentException(name);
    }
    pkg=new Package(name,specTitle,specVersion,specVendor,implTitle,implVersion,implVendor,sealBase,this);
    packages.put(name,pkg);
    return pkg;
  }
}

Fixed version (ground truth):
/** 
 * Defines a package by name in this <tt>ClassLoader</tt>.  This allows class loaders to define the packages for their classes. Packages must be created before the class is defined, and package names must be unique within a class loader and cannot be redefined or changed once created.
 * @param name The package name
 * @param specTitle The specification title
 * @param specVersion The specification version
 * @param specVendor The specification vendor
 * @param implTitle The implementation title
 * @param implVersion The implementation version
 * @param implVendor The implementation vendor
 * @param sealBase If not <tt>null</tt>, then this package is sealed with respect to the given code source  {@link java.net.URL <tt>URL</tt>}  object.  Otherwise, the package is not sealed.
 * @return  The newly defined <tt>Package</tt> object
 * @throws IllegalArgumentException If package name duplicates an existing package either in this class loader or one of its ancestors
 * @since  1.2
 */
protected Package definePackage(String name,String specTitle,String specVersion,String specVendor,String implTitle,String implVersion,String implVendor,URL sealBase) throws IllegalArgumentException {
synchronized (packages) {
    Package pkg=getPackage(name);
    if (pkg != null) {
      throw new IllegalArgumentException(name);
    }
    pkg=new Package(name,specTitle,specVersion,specVendor,implTitle,implVersion,implVendor,sealBase,this);
    packages.put(name,pkg);
    return pkg;
  }
}
Program: 36750
Project: 36750
Buggy source:
/** 
 * Returns the class with the given <a href="#name">binary name</a> if this loader has been recorded by the Java virtual machine as an initiating loader of a class with that <a href="#name">binary name</a>.  Otherwise <tt>null</tt> is returned.  </p>
 * @param name The <a href="#name">binary name</a> of the class
 * @return  The <tt>Class</tt> object, or <tt>null</tt> if the class hasnot been loaded
 * @since  1.1
 */
protected final Class<?> findLoadedClass(String name){
  if (!checkName(name))   return null;
  return findLoadedClass0(name);
}

Fixed version (ground truth):
/** 
 * Returns the class with the given <a href="#name">binary name</a> if this loader has been recorded by the Java virtual machine as an initiating loader of a class with that <a href="#name">binary name</a>.  Otherwise <tt>null</tt> is returned.
 * @param name The <a href="#name">binary name</a> of the class
 * @return  The <tt>Class</tt> object, or <tt>null</tt> if the class hasnot been loaded
 * @since  1.1
 */
protected final Class<?> findLoadedClass(String name){
  if (!checkName(name))   return null;
  return findLoadedClass0(name);
}
Program: 36751
Project: 36751
Buggy source:
/** 
 * Find a resource of the specified name from the search path used to load classes.  This method locates the resource through the system class loader (see   {@link #getSystemClassLoader()}).  </p>
 * @param name The resource name
 * @return  A {@link java.net.URL <tt>URL</tt>} object for reading theresource, or <tt>null</tt> if the resource could not be found
 * @since  1.1
 */
public static URL getSystemResource(String name){
  ClassLoader system=getSystemClassLoader();
  if (system == null) {
    return getBootstrapResource(name);
  }
  return system.getResource(name);
}

Fixed version (ground truth):
/** 
 * Find a resource of the specified name from the search path used to load classes.  This method locates the resource through the system class loader (see   {@link #getSystemClassLoader()}).
 * @param name The resource name
 * @return  A {@link java.net.URL <tt>URL</tt>} object for reading theresource, or <tt>null</tt> if the resource could not be found
 * @since  1.1
 */
public static URL getSystemResource(String name){
  ClassLoader system=getSystemClassLoader();
  if (system == null) {
    return getBootstrapResource(name);
  }
  return system.getResource(name);
}
Program: 36752
Project: 36752
Buggy source:
/** 
 * Sets the signers of a class.  This should be invoked after defining a class.  </p>
 * @param c The <tt>Class</tt> object
 * @param signers The signers for the class
 * @since  1.1
 */
protected final void setSigners(Class<?> c,Object[] signers){
  c.setSigners(signers);
}

Fixed version (ground truth):
/** 
 * Sets the signers of a class.  This should be invoked after defining a class.
 * @param c The <tt>Class</tt> object
 * @param signers The signers for the class
 * @since  1.1
 */
protected final void setSigners(Class<?> c,Object[] signers){
  c.setSigners(signers);
}
Program: 36753
Project: 36753
Buggy source:
/** 
 * Returns all of the <tt>Packages</tt> defined by this class loader and its ancestors.  </p>
 * @return  The array of <tt>Package</tt> objects defined by this<tt>ClassLoader</tt>
 * @since  1.2
 */
protected Package[] getPackages(){
  Map<String,Package> map;
synchronized (packages) {
    map=new HashMap<>(packages);
  }
  Package[] pkgs;
  if (parent != null) {
    pkgs=parent.getPackages();
  }
 else {
    pkgs=Package.getSystemPackages();
  }
  if (pkgs != null) {
    for (int i=0; i < pkgs.length; i++) {
      String pkgName=pkgs[i].getName();
      if (map.get(pkgName) == null) {
        map.put(pkgName,pkgs[i]);
      }
    }
  }
  return map.values().toArray(new Package[map.size()]);
}

Fixed version (ground truth):
/** 
 * Returns all of the <tt>Packages</tt> defined by this class loader and its ancestors.
 * @return  The array of <tt>Package</tt> objects defined by this<tt>ClassLoader</tt>
 * @since  1.2
 */
protected Package[] getPackages(){
  Map<String,Package> map;
synchronized (packages) {
    map=new HashMap<>(packages);
  }
  Package[] pkgs;
  if (parent != null) {
    pkgs=parent.getPackages();
  }
 else {
    pkgs=Package.getSystemPackages();
  }
  if (pkgs != null) {
    for (int i=0; i < pkgs.length; i++) {
      String pkgName=pkgs[i].getName();
      if (map.get(pkgName) == null) {
        map.put(pkgName,pkgs[i]);
      }
    }
  }
  return map.values().toArray(new Package[map.size()]);
}
Program: 36754
Project: 36754
Buggy source:
/** 
 * Returns the lock object for class loading operations. For backward compatibility, the default implementation of this method behaves as follows. If this ClassLoader object is registered as parallel capable, the method returns a dedicated object associated with the specified class name. Otherwise, the method returns this ClassLoader object. </p>
 * @param className The name of the to-be-loaded class
 * @return the lock for class loading operations
 * @throws NullPointerException If registered as parallel capable and <tt>className</tt> is null
 * @see #loadClass(String,boolean)
 * @since  1.7
 */
protected Object getClassLoadingLock(String className){
  Object lock=this;
  if (parallelLockMap != null) {
    Object newLock=new Object();
    lock=parallelLockMap.putIfAbsent(className,newLock);
    if (lock == null) {
      lock=newLock;
    }
  }
  return lock;
}

Fixed version (ground truth):
/** 
 * Returns the lock object for class loading operations. For backward compatibility, the default implementation of this method behaves as follows. If this ClassLoader object is registered as parallel capable, the method returns a dedicated object associated with the specified class name. Otherwise, the method returns this ClassLoader object.
 * @param className The name of the to-be-loaded class
 * @return the lock for class loading operations
 * @throws NullPointerException If registered as parallel capable and <tt>className</tt> is null
 * @see #loadClass(String,boolean)
 * @since  1.7
 */
protected Object getClassLoadingLock(String className){
  Object lock=this;
  if (parallelLockMap != null) {
    Object newLock=new Object();
    lock=parallelLockMap.putIfAbsent(className,newLock);
    if (lock == null) {
      lock=newLock;
    }
  }
  return lock;
}