nus-yam/ex-repair huggingface dataset:
Program: 79111
Project: 79111
Buggy source:
/** 
 * Receives data into an array of bytes.  This method will block until some input is available.
 * @param b the buffer into which the data is received
 * @param off the start offset of the data
 * @param len the maximum number of bytes received
 * @exception IOException If the pipe is <a href=#BROKEN> broken</a>,{@link #connect(java.io.PipedOutputStream) unconnected}, closed,or if an I/O error occurs.
 */
synchronized void receive(byte b[],int off,int len) throws IOException {
  checkStateForReceive();
  writeSide=Thread.currentThread();
  int bytesToTransfer=len;
  while (bytesToTransfer > 0) {
    if (in == out)     awaitSpace();
    int nextTransferAmount=0;
    if (out < in) {
      nextTransferAmount=buffer.length - in;
    }
 else     if (in < out) {
      if (in == -1) {
        in=out=0;
        nextTransferAmount=buffer.length - in;
      }
 else {
        nextTransferAmount=out - in;
      }
    }
    if (nextTransferAmount > bytesToTransfer)     nextTransferAmount=bytesToTransfer;
    assert(nextTransferAmount > 0);
    System.arraycopy(b,off,buffer,in,nextTransferAmount);
    bytesToTransfer-=nextTransferAmount;
    off+=nextTransferAmount;
    in+=nextTransferAmount;
    if (in >= buffer.length) {
      in=0;
    }
  }
}

Fixed version (ground truth):
/** 
 * Receives data into an array of bytes.  This method will block until some input is available.
 * @param b the buffer into which the data is received
 * @param off the start offset of the data
 * @param len the maximum number of bytes received
 * @exception IOException If the pipe is <a href="#BROKEN"> broken</a>,{@link #connect(java.io.PipedOutputStream) unconnected}, closed,or if an I/O error occurs.
 */
synchronized void receive(byte b[],int off,int len) throws IOException {
  checkStateForReceive();
  writeSide=Thread.currentThread();
  int bytesToTransfer=len;
  while (bytesToTransfer > 0) {
    if (in == out)     awaitSpace();
    int nextTransferAmount=0;
    if (out < in) {
      nextTransferAmount=buffer.length - in;
    }
 else     if (in < out) {
      if (in == -1) {
        in=out=0;
        nextTransferAmount=buffer.length - in;
      }
 else {
        nextTransferAmount=out - in;
      }
    }
    if (nextTransferAmount > bytesToTransfer)     nextTransferAmount=bytesToTransfer;
    assert(nextTransferAmount > 0);
    System.arraycopy(b,off,buffer,in,nextTransferAmount);
    bytesToTransfer-=nextTransferAmount;
    off+=nextTransferAmount;
    in+=nextTransferAmount;
    if (in >= buffer.length) {
      in=0;
    }
  }
}
Program: 79113
Project: 79113
Buggy source:
/** 
 * Returns the number of bytes that can be read from this input stream without blocking.
 * @return the number of bytes that can be read from this input streamwithout blocking, or  {@code 0} if this input stream has beenclosed by invoking its  {@link #close()} method, or if the pipeis  {@link #connect(java.io.PipedOutputStream) unconnected}, or <a href=#BROKEN> <code>broken</code></a>.
 * @exception IOException  if an I/O error occurs.
 * @since   JDK1.0.2
 */
public synchronized int available() throws IOException {
  if (in < 0)   return 0;
 else   if (in == out)   return buffer.length;
 else   if (in > out)   return in - out;
 else   return in + buffer.length - out;
}

Fixed version (ground truth):
/** 
 * Returns the number of bytes that can be read from this input stream without blocking.
 * @return the number of bytes that can be read from this input streamwithout blocking, or  {@code 0} if this input stream has beenclosed by invoking its  {@link #close()} method, or if the pipeis  {@link #connect(java.io.PipedOutputStream) unconnected}, or <a href="#BROKEN"> <code>broken</code></a>.
 * @exception IOException  if an I/O error occurs.
 * @since   JDK1.0.2
 */
public synchronized int available() throws IOException {
  if (in < 0)   return 0;
 else   if (in == out)   return buffer.length;
 else   if (in > out)   return in - out;
 else   return in + buffer.length - out;
}
Program: 79114
Project: 79114
Buggy source:
/** 
 * Returns the opaque file descriptor object associated with this stream. </p>
 * @return     the file descriptor object associated with this stream.
 * @exception IOException  if an I/O error occurs.
 * @see java.io.FileDescriptor
 */
public final FileDescriptor getFD() throws IOException {
  if (fd != null) {
    return fd;
  }
  throw new IOException();
}

Fixed version (ground truth):
/** 
 * Returns the opaque file descriptor object associated with this stream.
 * @return     the file descriptor object associated with this stream.
 * @exception IOException  if an I/O error occurs.
 * @see java.io.FileDescriptor
 */
public final FileDescriptor getFD() throws IOException {
  if (fd != null) {
    return fd;
  }
  throw new IOException();
}
Program: 79116
Project: 79116
Buggy source:
/** 
 * Returns a   {@code LockInfo} object represented by thegiven  {@code CompositeData}. The given   {@code CompositeData} must contain the following attributes:<blockquote> <table border> <tr> <th align=left>Attribute Name</th> <th align=left>Type</th> </tr> <tr> <td>className</td> <td><tt>java.lang.String</tt></td> </tr> <tr> <td>identityHashCode</td> <td><tt>java.lang.Integer</tt></td> </tr> </table> </blockquote>
 * @param cd {@code CompositeData} representing a {@code LockInfo}
 * @throws IllegalArgumentException if {@code cd} does notrepresent a  {@code LockInfo} with the attributes describedabove.
 * @return a {@code LockInfo} object representedby  {@code cd} if {@code cd} is not {@code null};  {@code null} otherwise.
 * @since 1.8
 */
public static LockInfo from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof LockInfoCompositeData) {
    return ((LockInfoCompositeData)cd).getLockInfo();
  }
 else {
    return LockInfoCompositeData.toLockInfo(cd);
  }
}

Fixed version (ground truth):
/** 
 * Returns a   {@code LockInfo} object represented by thegiven  {@code CompositeData}. The given   {@code CompositeData} must contain the following attributes:<blockquote> <table border summary="The attributes and the types the given CompositeData contains"> <tr> <th align=left>Attribute Name</th> <th align=left>Type</th> </tr> <tr> <td>className</td> <td><tt>java.lang.String</tt></td> </tr> <tr> <td>identityHashCode</td> <td><tt>java.lang.Integer</tt></td> </tr> </table> </blockquote>
 * @param cd {@code CompositeData} representing a {@code LockInfo}
 * @throws IllegalArgumentException if {@code cd} does notrepresent a  {@code LockInfo} with the attributes describedabove.
 * @return a {@code LockInfo} object representedby  {@code cd} if {@code cd} is not {@code null};  {@code null} otherwise.
 * @since 1.8
 */
public static LockInfo from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof LockInfoCompositeData) {
    return ((LockInfoCompositeData)cd).getLockInfo();
  }
 else {
    return LockInfoCompositeData.toLockInfo(cd);
  }
}
Program: 79117
Project: 79117
Buggy source:
/** 
 * Returns the list of the platform MXBean proxies for forwarding the method calls of the   {@code mxbeanInterface}through the given   {@code MBeanServerConnection}. The returned list may contain zero, one, or more instances. The number of instances in the returned list is defined in the specification of the given management interface. The order is undefined and there is no guarantee that the list returned is in the same order as previous invocations.
 * @param connection the {@code MBeanServerConnection} to forward to.
 * @param mxbeanInterface a management interface for a platformMXBean
 * @return the list of platform MXBean proxies forforwarding the method calls of the  {@code mxbeanInterface}through the given   {@code MBeanServerConnection}.
 * @throws IllegalArgumentException if {@code mxbeanInterface}is not a platform management interface.
 * @throws java.io.IOException if a communication problemoccurred when accessing the  {@code MBeanServerConnection}.
 * @see #newPlatformMXBeanProxy
 * @since 1.7
 */
public static <T extends PlatformManagedObject>List<T> getPlatformMXBeans(MBeanServerConnection connection,Class<T> mxbeanInterface) throws java.io.IOException {
  PlatformComponent pc=PlatformComponent.getPlatformComponent(mxbeanInterface);
  if (pc == null) {
    throw new IllegalArgumentException(mxbeanInterface.getName() + "String_Node_Str");
  }
  return Collections.unmodifiableList(pc.getMXBeans(connection,mxbeanInterface));
}

Fixed version (ground truth):
/** 
 * Returns the list of the platform MXBean proxies for forwarding the method calls of the   {@code mxbeanInterface}through the given   {@code MBeanServerConnection}. The returned list may contain zero, one, or more instances. The number of instances in the returned list is defined in the specification of the given management interface. The order is undefined and there is no guarantee that the list returned is in the same order as previous invocations.
 * @param connection the {@code MBeanServerConnection} to forward to.
 * @param mxbeanInterface a management interface for a platformMXBean
 * @param < T > an {@code mxbeanInterface} type parameter
 * @return the list of platform MXBean proxies forforwarding the method calls of the  {@code mxbeanInterface}through the given   {@code MBeanServerConnection}.
 * @throws IllegalArgumentException if {@code mxbeanInterface}is not a platform management interface.
 * @throws java.io.IOException if a communication problemoccurred when accessing the  {@code MBeanServerConnection}.
 * @see #newPlatformMXBeanProxy
 * @since 1.7
 */
public static <T extends PlatformManagedObject>List<T> getPlatformMXBeans(MBeanServerConnection connection,Class<T> mxbeanInterface) throws java.io.IOException {
  PlatformComponent pc=PlatformComponent.getPlatformComponent(mxbeanInterface);
  if (pc == null) {
    throw new IllegalArgumentException(mxbeanInterface.getName() + "String_Node_Str");
  }
  return Collections.unmodifiableList(pc.getMXBeans(connection,mxbeanInterface));
}
Program: 79120
Project: 79120
Buggy source:
/** 
 * Returns a <tt>MemoryNotificationInfo</tt> object represented by the given <tt>CompositeData</tt>. The given <tt>CompositeData</tt> must contain the following attributes: <blockquote> <table border> <tr> <th align=left>Attribute Name</th> <th align=left>Type</th> </tr> <tr> <td>poolName</td> <td><tt>java.lang.String</tt></td> </tr> <tr> <td>usage</td> <td><tt>javax.management.openmbean.CompositeData</tt></td> </tr> <tr> <td>count</td> <td><tt>java.lang.Long</tt></td> </tr> </table> </blockquote>
 * @param cd <tt>CompositeData</tt> representing a<tt>MemoryNotificationInfo</tt>
 * @throws IllegalArgumentException if <tt>cd</tt> does notrepresent a <tt>MemoryNotificationInfo</tt> object.
 * @return a <tt>MemoryNotificationInfo</tt> object representedby <tt>cd</tt> if <tt>cd</tt> is not <tt>null</tt>; <tt>null</tt> otherwise.
 */
public static MemoryNotificationInfo from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof MemoryNotifInfoCompositeData) {
    return ((MemoryNotifInfoCompositeData)cd).getMemoryNotifInfo();
  }
 else {
    return new MemoryNotificationInfo(cd);
  }
}

Fixed version (ground truth):
/** 
 * Returns a <tt>MemoryNotificationInfo</tt> object represented by the given <tt>CompositeData</tt>. The given <tt>CompositeData</tt> must contain the following attributes: <blockquote> <table border summary="The attributes and the types the given CompositeData contains"> <tr> <th align=left>Attribute Name</th> <th align=left>Type</th> </tr> <tr> <td>poolName</td> <td><tt>java.lang.String</tt></td> </tr> <tr> <td>usage</td> <td><tt>javax.management.openmbean.CompositeData</tt></td> </tr> <tr> <td>count</td> <td><tt>java.lang.Long</tt></td> </tr> </table> </blockquote>
 * @param cd <tt>CompositeData</tt> representing a<tt>MemoryNotificationInfo</tt>
 * @throws IllegalArgumentException if <tt>cd</tt> does notrepresent a <tt>MemoryNotificationInfo</tt> object.
 * @return a <tt>MemoryNotificationInfo</tt> object representedby <tt>cd</tt> if <tt>cd</tt> is not <tt>null</tt>; <tt>null</tt> otherwise.
 */
public static MemoryNotificationInfo from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof MemoryNotifInfoCompositeData) {
    return ((MemoryNotifInfoCompositeData)cd).getMemoryNotifInfo();
  }
 else {
    return new MemoryNotificationInfo(cd);
  }
}
Program: 79121
Project: 79121
Buggy source:
/** 
 * Returns a <tt>MemoryUsage</tt> object represented by the given <tt>CompositeData</tt>. The given <tt>CompositeData</tt> must contain the following attributes: <p> <blockquote> <table border> <tr> <th align=left>Attribute Name</th> <th align=left>Type</th> </tr> <tr> <td>init</td> <td><tt>java.lang.Long</tt></td> </tr> <tr> <td>used</td> <td><tt>java.lang.Long</tt></td> </tr> <tr> <td>committed</td> <td><tt>java.lang.Long</tt></td> </tr> <tr> <td>max</td> <td><tt>java.lang.Long</tt></td> </tr> </table> </blockquote>
 * @param cd <tt>CompositeData</tt> representing a <tt>MemoryUsage</tt>
 * @throws IllegalArgumentException if <tt>cd</tt> does notrepresent a <tt>MemoryUsage</tt> with the attributes described above.
 * @return a <tt>MemoryUsage</tt> object represented by <tt>cd</tt>if <tt>cd</tt> is not <tt>null</tt>; <tt>null</tt> otherwise.
 */
public static MemoryUsage from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof MemoryUsageCompositeData) {
    return ((MemoryUsageCompositeData)cd).getMemoryUsage();
  }
 else {
    return new MemoryUsage(cd);
  }
}

Fixed version (ground truth):
/** 
 * Returns a <tt>MemoryUsage</tt> object represented by the given <tt>CompositeData</tt>. The given <tt>CompositeData</tt> must contain the following attributes: <p> <blockquote> <table border summary="The attributes and the types the given CompositeData contains"> <tr> <th align=left>Attribute Name</th> <th align=left>Type</th> </tr> <tr> <td>init</td> <td><tt>java.lang.Long</tt></td> </tr> <tr> <td>used</td> <td><tt>java.lang.Long</tt></td> </tr> <tr> <td>committed</td> <td><tt>java.lang.Long</tt></td> </tr> <tr> <td>max</td> <td><tt>java.lang.Long</tt></td> </tr> </table> </blockquote>
 * @param cd <tt>CompositeData</tt> representing a <tt>MemoryUsage</tt>
 * @throws IllegalArgumentException if <tt>cd</tt> does notrepresent a <tt>MemoryUsage</tt> with the attributes described above.
 * @return a <tt>MemoryUsage</tt> object represented by <tt>cd</tt>if <tt>cd</tt> is not <tt>null</tt>; <tt>null</tt> otherwise.
 */
public static MemoryUsage from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof MemoryUsageCompositeData) {
    return ((MemoryUsageCompositeData)cd).getMemoryUsage();
  }
 else {
    return new MemoryUsage(cd);
  }
}
Program: 79123
Project: 79123
Buggy source:
/** 
 * Returns the input arguments passed to the Java virtual machine which does not include the arguments to the <tt>main</tt> method. This method returns an empty list if there is no input argument to the Java virtual machine. <p> Some Java virtual machine implementations may take input arguments from multiple different sources: for examples, arguments passed from the application that launches the Java virtual machine such as the 'java' command, environment variables, configuration files, etc. <p> Typically, not all command-line options to the 'java' command are passed to the Java virtual machine. Thus, the returned input arguments may not include all command-line options. <p> <b>MBeanServer access</b>:<br> The mapped type of <tt>List<String></tt> is <tt>String[]</tt>.
 * @return a list of <tt>String</tt> objects; each elementis an argument passed to the Java virtual machine.
 * @throws java.lang.SecurityException if a security manager exists and the caller does not have ManagementPermission("monitor").
 */
public java.util.List<String> getInputArguments();

Fixed version (ground truth):
/** 
 * Returns the input arguments passed to the Java virtual machine which does not include the arguments to the <tt>main</tt> method. This method returns an empty list if there is no input argument to the Java virtual machine. <p> Some Java virtual machine implementations may take input arguments from multiple different sources: for examples, arguments passed from the application that launches the Java virtual machine such as the 'java' command, environment variables, configuration files, etc. <p> Typically, not all command-line options to the 'java' command are passed to the Java virtual machine. Thus, the returned input arguments may not include all command-line options. <p> <b>MBeanServer access</b>:<br> The mapped type of   {@code List<String>} is <tt>String[]</tt>.
 * @return a list of <tt>String</tt> objects; each elementis an argument passed to the Java virtual machine.
 * @throws java.lang.SecurityException if a security manager exists and the caller does not have ManagementPermission("monitor").
 */
public java.util.List<String> getInputArguments();
Program: 79124
Project: 79124
Buggy source:
/** 
 * Returns a map of names and values of all system properties. This method calls   {@link System#getProperties} to get allsystem properties.  Properties whose name or value is not a <tt>String</tt> are omitted. <p> <b>MBeanServer access</b>:<br> The mapped type of  {@code Map<String,String>} is{@link javax.management.openmbean.TabularData TabularData}with two items in each row as follows: <blockquote> <table border> <tr> <th>Item Name</th> <th>Item Type</th> </tr> <tr> <td><tt>key</tt></td> <td><tt>String</tt></td> </tr> <tr> <td><tt>value</tt></td> <td><tt>String</tt></td> </tr> </table> </blockquote>
 * @return a map of names and values of all system properties.
 * @throws java.lang.SecurityException if a security manager exists and its <code>checkPropertiesAccess</code> method doesn't allow access to the system properties.
 */
public java.util.Map<String,String> getSystemProperties();

Fixed version (ground truth):
/** 
 * Returns a map of names and values of all system properties. This method calls   {@link System#getProperties} to get allsystem properties.  Properties whose name or value is not a <tt>String</tt> are omitted. <p> <b>MBeanServer access</b>:<br> The mapped type of  {@code Map<String,String>} is{@link javax.management.openmbean.TabularData TabularData}with two items in each row as follows: <blockquote> <table border summary="Name and Type for each item"> <tr> <th>Item Name</th> <th>Item Type</th> </tr> <tr> <td><tt>key</tt></td> <td><tt>String</tt></td> </tr> <tr> <td><tt>value</tt></td> <td><tt>String</tt></td> </tr> </table> </blockquote>
 * @return a map of names and values of all system properties.
 * @throws java.lang.SecurityException if a security manager exists and its <code>checkPropertiesAccess</code> method doesn't allow access to the system properties.
 */
public java.util.Map<String,String> getSystemProperties();
Program: 79126
Project: 79126
Buggy source:
/** 
 * Returns   {@code true} if this Spliterator's {@link #characteristics} contain all of the given characteristics.
 * @implSpec The default implementation returns true if the corresponding bits of the given characteristics are set.
 * @return {@code true} if all the specified characteristics are present,else  {@code false}
 */
default boolean hasCharacteristics(int characteristics){
  return (characteristics() & characteristics) == characteristics;
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if this Spliterator's {@link #characteristics} contain all of the given characteristics.
 * @implSpec The default implementation returns true if the corresponding bits of the given characteristics are set.
 * @param characteristics the characteristics to check for
 * @return {@code true} if all the specified characteristics are present,else  {@code false}
 */
default boolean hasCharacteristics(int characteristics){
  return (characteristics() & characteristics) == characteristics;
}
Program: 79127
Project: 79127
Buggy source:
/** 
 * Skips <code>n</code> bytes of input from the bytes that can be read from this input stream without blocking. <p>Fewer bytes than requested might be skipped. The actual number of bytes skipped is equal to <code>n</code> or the result of a call to  {@link #available() <code>available</code>}, whichever is smaller. If <code>n</code> is less than zero, no bytes are skipped. <p>The actual number of bytes skipped is returned.
 * @param n the number of bytes to be skipped.
 * @return     the actual number of bytes skipped.
 * @exception IOException  if an I/O error occurs.
 * @since JCE1.2
 */
public long skip(long n) throws IOException {
  int available=ofinish - ostart;
  if (n > available) {
    n=available;
  }
  if (n < 0) {
    return 0;
  }
  ostart+=n;
  return n;
}

Fixed version (ground truth):
/** 
 * Skips <code>n</code> bytes of input from the bytes that can be read from this input stream without blocking. <p>Fewer bytes than requested might be skipped. The actual number of bytes skipped is equal to <code>n</code> or the result of a call to  {@link #available() available}, whichever is smaller. If <code>n</code> is less than zero, no bytes are skipped. <p>The actual number of bytes skipped is returned.
 * @param n the number of bytes to be skipped.
 * @return     the actual number of bytes skipped.
 * @exception IOException  if an I/O error occurs.
 * @since JCE1.2
 */
public long skip(long n) throws IOException {
  int available=ofinish - ostart;
  if (n > available) {
    n=available;
  }
  if (n < 0) {
    return 0;
  }
  ostart+=n;
  return n;
}
Program: 79128
Project: 79128
Buggy source:
/** 
 * Returns an <code>ExemptionMechanism</code> object that implements the specified exemption mechanism algorithm. <p> A new ExemptionMechanism object encapsulating the ExemptionMechanismSpi implementation from the specified Provider object is returned.  Note that the specified Provider object does not have to be registered in the provider list.
 * @param algorithm the standard name of the requested exemption mechanism.See the ExemptionMechanism section in the <a href= "{docRoot}/../technotes/guides/security/StandardNames.html#Exemption"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard exemption mechanism names.
 * @param provider the provider.
 * @return the new <code>ExemptionMechanism</code> object.
 * @exception NullPointerException if <code>algorithm</code>is null.
 * @exception NoSuchAlgorithmException if an ExemptionMechanismSpiimplementation for the specified algorithm is not available from the specified Provider object.
 * @exception IllegalArgumentException if the <code>provider</code>is null.
 * @see java.security.Provider
 */
public static final ExemptionMechanism getInstance(String algorithm,Provider provider) throws NoSuchAlgorithmException {
  Instance instance=JceSecurity.getInstance("String_Node_Str",ExemptionMechanismSpi.class,algorithm,provider);
  return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,instance.provider,algorithm);
}

Fixed version (ground truth):
/** 
 * Returns an <code>ExemptionMechanism</code> object that implements the specified exemption mechanism algorithm. <p> A new ExemptionMechanism object encapsulating the ExemptionMechanismSpi implementation from the specified Provider object is returned.  Note that the specified Provider object does not have to be registered in the provider list.
 * @param algorithm the standard name of the requested exemption mechanism.See the ExemptionMechanism section in the <a href= " {@docRoot}/../technotes/guides/security/StandardNames.html#Exemption"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard exemption mechanism names.
 * @param provider the provider.
 * @return the new <code>ExemptionMechanism</code> object.
 * @exception NullPointerException if <code>algorithm</code>is null.
 * @exception NoSuchAlgorithmException if an ExemptionMechanismSpiimplementation for the specified algorithm is not available from the specified Provider object.
 * @exception IllegalArgumentException if the <code>provider</code>is null.
 * @see java.security.Provider
 */
public static final ExemptionMechanism getInstance(String algorithm,Provider provider) throws NoSuchAlgorithmException {
  Instance instance=JceSecurity.getInstance("String_Node_Str",ExemptionMechanismSpi.class,algorithm,provider);
  return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,instance.provider,algorithm);
}
Program: 79129
Project: 79129
Buggy source:
/** 
 * Returns a <code>KeyAgreement</code> object that implements the specified key agreement algorithm. <p> A new KeyAgreement object encapsulating the KeyAgreementSpi implementation from the specified Provider object is returned.  Note that the specified Provider object does not have to be registered in the provider list.
 * @param algorithm the standard name of the requested key agreementalgorithm. See the KeyAgreement section in the <a href= " {@docRoot}/../technotes/guides/security/StandardNames.html#KeyAgreement"> Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names.
 * @param provider the provider.
 * @return the new <code>KeyAgreement</code> object.
 * @exception NullPointerException if the specified algorithmis null.
 * @exception NoSuchAlgorithmException if a KeyAgreementSpiimplementation for the specified algorithm is not available from the specified Provider object.
 * @exception IllegalArgumentException if the <code>provider</code>is null.
 * @see java.security.Provider
 */
public static final KeyAgreement getInstance(String algorithm,Provider provider) throws NoSuchAlgorithmException {
  Instance instance=JceSecurity.getInstance("String_Node_Str",KeyAgreementSpi.class,algorithm,provider);
  return new KeyAgreement((KeyAgreementSpi)instance.impl,instance.provider,algorithm);
}

Fixed version (ground truth):
/** 
 * Returns a <code>KeyAgreement</code> object that implements the specified key agreement algorithm. <p> A new KeyAgreement object encapsulating the KeyAgreementSpi implementation from the specified Provider object is returned.  Note that the specified Provider object does not have to be registered in the provider list.
 * @param algorithm the standard name of the requested key agreementalgorithm. See the KeyAgreement section in the <a href= " {@docRoot}/../technotes/guides/security/StandardNames.html#KeyAgreement"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard algorithm names.
 * @param provider the provider.
 * @return the new <code>KeyAgreement</code> object.
 * @exception NullPointerException if the specified algorithmis null.
 * @exception NoSuchAlgorithmException if a KeyAgreementSpiimplementation for the specified algorithm is not available from the specified Provider object.
 * @exception IllegalArgumentException if the <code>provider</code>is null.
 * @see java.security.Provider
 */
public static final KeyAgreement getInstance(String algorithm,Provider provider) throws NoSuchAlgorithmException {
  Instance instance=JceSecurity.getInstance("String_Node_Str",KeyAgreementSpi.class,algorithm,provider);
  return new KeyAgreement((KeyAgreementSpi)instance.impl,instance.provider,algorithm);
}
Program: 79130
Project: 79130
Buggy source:
public NullCipher(){
  super(new NullCipherSpi(),null);
}

Fixed version (ground truth):
/** 
 * Creates a NullCipher object.
 */
public NullCipher(){
  super(new NullCipherSpi(),null);
}
Program: 79131
Project: 79131
Buggy source:
/** 
 * Return a <code>Set</code> of private credentials associated with this <code>Subject</code> that are instances or subclasses of the specified <code>Class</code>. <p> The caller must have permission to access all of the requested Credentials, or a <code>SecurityException</code> will be thrown. <p> The returned <code>Set</code> is not backed by this Subject's internal private Credential <code>Set</code>.  A new <code>Set</code> is created and returned for each method invocation. Modifications to the returned <code>Set</code> will not affect the internal private Credential <code>Set</code>. <p>
 * @param c the returned <code>Set</code> of private credentials will all beinstances of this class.
 * @return a <code>Set</code> of private credentials that are instancesof the  specified <code>Class</code>.
 * @exception NullPointerException if the specified <code>Class</code>is <code>null</code>.
 */
public <T>Set<T> getPrivateCredentials(Class<T> c){
  if (c == null)   throw new NullPointerException(ResourcesMgr.getString("String_Node_Str"));
  return new ClassSet<T>(PRIV_CREDENTIAL_SET,c);
}

Fixed version (ground truth):
/** 
 * Return a <code>Set</code> of private credentials associated with this <code>Subject</code> that are instances or subclasses of the specified <code>Class</code>. <p> The caller must have permission to access all of the requested Credentials, or a <code>SecurityException</code> will be thrown. <p> The returned <code>Set</code> is not backed by this Subject's internal private Credential <code>Set</code>.  A new <code>Set</code> is created and returned for each method invocation. Modifications to the returned <code>Set</code> will not affect the internal private Credential <code>Set</code>. <p>
 * @param < T > the type of the class modeled by {@code c}
 * @param c the returned <code>Set</code> of private credentials will all beinstances of this class.
 * @return a <code>Set</code> of private credentials that are instancesof the  specified <code>Class</code>.
 * @exception NullPointerException if the specified <code>Class</code>is <code>null</code>.
 */
public <T>Set<T> getPrivateCredentials(Class<T> c){
  if (c == null)   throw new NullPointerException(ResourcesMgr.getString("String_Node_Str"));
  return new ClassSet<T>(PRIV_CREDENTIAL_SET,c);
}
Program: 79132
Project: 79132
Buggy source:
/** 
 * Return a <code>Set</code> of public credentials associated with this <code>Subject</code> that are instances or subclasses of the specified <code>Class</code>. <p> The returned <code>Set</code> is not backed by this Subject's internal public Credential <code>Set</code>.  A new <code>Set</code> is created and returned for each method invocation. Modifications to the returned <code>Set</code> will not affect the internal public Credential <code>Set</code>. <p>
 * @param c the returned <code>Set</code> of public credentials will all beinstances of this class.
 * @return a <code>Set</code> of public credentials that are instancesof the  specified <code>Class</code>.
 * @exception NullPointerException if the specified <code>Class</code>is <code>null</code>.
 */
public <T>Set<T> getPublicCredentials(Class<T> c){
  if (c == null)   throw new NullPointerException(ResourcesMgr.getString("String_Node_Str"));
  return new ClassSet<T>(PUB_CREDENTIAL_SET,c);
}

Fixed version (ground truth):
/** 
 * Return a <code>Set</code> of public credentials associated with this <code>Subject</code> that are instances or subclasses of the specified <code>Class</code>. <p> The returned <code>Set</code> is not backed by this Subject's internal public Credential <code>Set</code>.  A new <code>Set</code> is created and returned for each method invocation. Modifications to the returned <code>Set</code> will not affect the internal public Credential <code>Set</code>. <p>
 * @param < T > the type of the class modeled by {@code c}
 * @param c the returned <code>Set</code> of public credentials will all beinstances of this class.
 * @return a <code>Set</code> of public credentials that are instancesof the  specified <code>Class</code>.
 * @exception NullPointerException if the specified <code>Class</code>is <code>null</code>.
 */
public <T>Set<T> getPublicCredentials(Class<T> c){
  if (c == null)   throw new NullPointerException(ResourcesMgr.getString("String_Node_Str"));
  return new ClassSet<T>(PUB_CREDENTIAL_SET,c);
}
Program: 79133
Project: 79133
Buggy source:
/** 
 * Return a <code>Set</code> of Principals associated with this <code>Subject</code> that are instances or subclasses of the specified <code>Class</code>. <p> The returned <code>Set</code> is not backed by this Subject's internal <code>Principal</code> <code>Set</code>.  A new <code>Set</code> is created and returned for each method invocation. Modifications to the returned <code>Set</code> will not affect the internal <code>Principal</code> <code>Set</code>. <p>
 * @param c the returned <code>Set</code> of Principals will all beinstances of this class.
 * @return a <code>Set</code> of Principals that are instances of thespecified <code>Class</code>.
 * @exception NullPointerException if the specified <code>Class</code>is <code>null</code>.
 */
public <T extends Principal>Set<T> getPrincipals(Class<T> c){
  if (c == null)   throw new NullPointerException(ResourcesMgr.getString("String_Node_Str"));
  return new ClassSet<T>(PRINCIPAL_SET,c);
}

Fixed version (ground truth):
/** 
 * Return a <code>Set</code> of Principals associated with this <code>Subject</code> that are instances or subclasses of the specified <code>Class</code>. <p> The returned <code>Set</code> is not backed by this Subject's internal <code>Principal</code> <code>Set</code>.  A new <code>Set</code> is created and returned for each method invocation. Modifications to the returned <code>Set</code> will not affect the internal <code>Principal</code> <code>Set</code>. <p>
 * @param < T > the type of the class modeled by {@code c}
 * @param c the returned <code>Set</code> of Principals will all beinstances of this class.
 * @return a <code>Set</code> of Principals that are instances of thespecified <code>Class</code>.
 * @exception NullPointerException if the specified <code>Class</code>is <code>null</code>.
 */
public <T extends Principal>Set<T> getPrincipals(Class<T> c){
  if (c == null)   throw new NullPointerException(ResourcesMgr.getString("String_Node_Str"));
  return new ClassSet<T>(PRINCIPAL_SET,c);
}
Program: 79136
Project: 79136
Buggy source:
/** 
 * Gets the <code>version</code> (version number) value from the certificate. The ASN.1 definition for this is: <pre> version         [0]  EXPLICIT Version DEFAULT v1<p> Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  } </pre>
 * @return the version number from the ASN.1 encoding, i.e. 0, 1 or 2.
 */
public abstract int getVersion();

Fixed version (ground truth):
/** 
 * Gets the <code>version</code> (version number) value from the certificate. The ASN.1 definition for this is: <pre> version         [0]  EXPLICIT Version DEFAULT v1 Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  } </pre>
 * @return the version number from the ASN.1 encoding, i.e. 0, 1 or 2.
 */
public abstract int getVersion();
Program: 79137
Project: 79137
Buggy source:
/** 
 * Gets the <code>serialNumber</code> value from the certificate. The serial number is an integer assigned by the certification authority to each certificate. It must be unique for each certificate issued by a given CA (i.e., the issuer name and serial number identify a unique certificate). The ASN.1 definition for this is: <pre> serialNumber     CertificateSerialNumber<p> CertificateSerialNumber  ::=  INTEGER </pre>
 * @return the serial number.
 */
public abstract BigInteger getSerialNumber();

Fixed version (ground truth):
/** 
 * Gets the <code>serialNumber</code> value from the certificate. The serial number is an integer assigned by the certification authority to each certificate. It must be unique for each certificate issued by a given CA (i.e., the issuer name and serial number identify a unique certificate). The ASN.1 definition for this is: <pre> serialNumber     CertificateSerialNumber CertificateSerialNumber  ::=  INTEGER </pre>
 * @return the serial number.
 */
public abstract BigInteger getSerialNumber();
Program: 79138
Project: 79138
Buggy source:
/** 
 * Gets the <code>issuer</code> (issuer distinguished name) value from the certificate. The issuer name identifies the entity that signed (and issued) the certificate. <p>The issuer name field contains an X.500 distinguished name (DN). The ASN.1 definition for this is: <pre> issuer    Name<p> Name ::= CHOICE { RDNSequence } RDNSequence ::= SEQUENCE OF RelativeDistinguishedName RelativeDistinguishedName ::= SET OF AttributeValueAssertion AttributeValueAssertion ::= SEQUENCE { AttributeType, AttributeValue } AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY </pre> The <code>Name</code> describes a hierarchical name composed of attributes, such as country name, and corresponding values, such as US. The type of the <code>AttributeValue</code> component is determined by the <code>AttributeType</code>; in general it will be a <code>directoryString</code>. A <code>directoryString</code> is usually one of <code>PrintableString</code>, <code>TeletexString</code> or <code>UniversalString</code>.
 * @return a Principal whose name is the issuer distinguished name.
 */
public abstract Principal getIssuerDN();

Fixed version (ground truth):
/** 
 * Gets the <code>issuer</code> (issuer distinguished name) value from the certificate. The issuer name identifies the entity that signed (and issued) the certificate. <p>The issuer name field contains an X.500 distinguished name (DN). The ASN.1 definition for this is: <pre> issuer    Name Name ::= CHOICE { RDNSequence } RDNSequence ::= SEQUENCE OF RelativeDistinguishedName RelativeDistinguishedName ::= SET OF AttributeValueAssertion AttributeValueAssertion ::= SEQUENCE { AttributeType, AttributeValue } AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY </pre> The <code>Name</code> describes a hierarchical name composed of attributes, such as country name, and corresponding values, such as US. The type of the <code>AttributeValue</code> component is determined by the <code>AttributeType</code>; in general it will be a <code>directoryString</code>. A <code>directoryString</code> is usually one of <code>PrintableString</code>, <code>TeletexString</code> or <code>UniversalString</code>.
 * @return a Principal whose name is the issuer distinguished name.
 */
public abstract Principal getIssuerDN();
Program: 79139
Project: 79139
Buggy source:
/** 
 * Gets the <code>notBefore</code> date from the validity period of the certificate. The relevant ASN.1 definitions are: <pre> validity             Validity<p> Validity ::= SEQUENCE { notBefore      CertificateValidityDate, notAfter       CertificateValidityDate }<p> CertificateValidityDate ::= CHOICE { utcTime        UTCTime, generalTime    GeneralizedTime } </pre>
 * @return the start date of the validity period.
 * @see #checkValidity()
 */
public abstract Date getNotBefore();

Fixed version (ground truth):
/** 
 * Gets the <code>notBefore</code> date from the validity period of the certificate. The relevant ASN.1 definitions are: <pre> validity             Validity Validity ::= SEQUENCE { notBefore      CertificateValidityDate, notAfter       CertificateValidityDate } CertificateValidityDate ::= CHOICE { utcTime        UTCTime, generalTime    GeneralizedTime } </pre>
 * @return the start date of the validity period.
 * @see #checkValidity()
 */
public abstract Date getNotBefore();
Program: 79140
Project: 79140
Buggy source:
/** 
 * Gets the signature algorithm name for the certificate signature algorithm. An example is the string "SHA-1/DSA". The ASN.1 definition for this is: <pre> signatureAlgorithm   AlgorithmIdentifier<p> AlgorithmIdentifier  ::=  SEQUENCE  { algorithm               OBJECT IDENTIFIER, parameters              ANY DEFINED BY algorithm OPTIONAL  } -- contains a value of the type -- registered for use with the -- algorithm object identifier value </pre> <p>The algorithm name is determined from the <code>algorithm</code> OID string.
 * @return the signature algorithm name.
 */
public abstract String getSigAlgName();

Fixed version (ground truth):
/** 
 * Gets the signature algorithm name for the certificate signature algorithm. An example is the string "SHA-1/DSA". The ASN.1 definition for this is: <pre> signatureAlgorithm   AlgorithmIdentifier AlgorithmIdentifier  ::=  SEQUENCE  { algorithm               OBJECT IDENTIFIER, parameters              ANY DEFINED BY algorithm OPTIONAL  } -- contains a value of the type -- registered for use with the -- algorithm object identifier value </pre> <p>The algorithm name is determined from the <code>algorithm</code> OID string.
 * @return the signature algorithm name.
 */
public abstract String getSigAlgName();
Program: 79141
Project: 79141
Buggy source:
/** 
 * Instantiates an X509Certificate object, and initializes it with the specified byte array. The implementation (X509Certificate is an abstract class) is provided by the class specified as the value of the  {@code cert.provider.x509v1} security property.<p>Note: All X509Certificate subclasses must provide a constructor of the form: <code><pre> public &lt;subClass&gt;(InputStream inStream) ... </pre></code>
 * @param certData a byte array containing the DER-encodedcertificate.
 * @return an X509Certificate object initialized with the datafrom <code>certData</code>.
 * @exception CertificateException if a class initializationor certificate parsing error occurs.
 */
public static final X509Certificate getInstance(byte[] certData) throws CertificateException {
  return getInst((Object)certData);
}

Fixed version (ground truth):
/** 
 * Instantiates an X509Certificate object, and initializes it with the specified byte array. The implementation (X509Certificate is an abstract class) is provided by the class specified as the value of the  {@code cert.provider.x509v1} security property.<p>Note: All X509Certificate subclasses must provide a constructor of the form: <pre> {@code public <subClass>(InputStream inStream) ...}</pre>
 * @param certData a byte array containing the DER-encodedcertificate.
 * @return an X509Certificate object initialized with the datafrom <code>certData</code>.
 * @exception CertificateException if a class initializationor certificate parsing error occurs.
 */
public static final X509Certificate getInstance(byte[] certData) throws CertificateException {
  return getInst((Object)certData);
}
Program: 79142
Project: 79142
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: 79143
Project: 79143
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: 79144
Project: 79144
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: 79145
Project: 79145
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: 79146
Project: 79146
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);
}