nus-yam/ex-repair huggingface dataset:
Program: 3953
Project: 3953
Buggy source:
/** 
 * Initializes a new instance of the MapiTypeConverterMapEntry class.
 * @param type The type. y default, converting a type to string is done bycalling value.ToString. Instances can override this behavior. <p/> By default, converting a string to the appropriate value type is done by calling Convert.ChangeType Instances may override this behavior.
 */
protected MapiTypeConverterMapEntry(Class<?> type){
  EwsUtilities.EwsAssert(defaultValueMap.getMember().containsKey(type),"String_Node_Str",String.format("String_Node_Str",type.getName()));
  this.type=type;
  this.convertToString=new IFunction<Object,String>(){
    public String func(    Object o){
      return String.valueOf(o);
    }
  }
;
  this.parse=new IFunction<String,Object>(){
    public Object func(    String o){
      return o;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Initializes a new instance of the MapiTypeConverterMapEntry class.
 * @param type The type. y default, converting a type to string is done bycalling value.ToString. Instances can override this behavior. <p/> By default, converting a string to the appropriate value type is done by calling Convert.ChangeType Instances may override this behavior.
 */
protected MapiTypeConverterMapEntry(Class<?> type){
  EwsUtilities.EwsAssert(defaultValueMap.getMember().containsKey(type),"String_Node_Str","String_Node_Str" + type.getName());
  this.type=type;
  this.convertToString=new IFunction<Object,String>(){
    public String func(    Object o){
      return String.valueOf(o);
    }
  }
;
  this.parse=new IFunction<String,Object>(){
    public Object func(    String o){
      return o;
    }
  }
;
}
Program: 3954
Project: 3954
Buggy source:
/** 
 * Returns string that represents the current instance.
 * @return String representation of instance.
 */
@Override public String toString(){
  String addressPart;
  if (null == this.getAddress() || this.getAddress().isEmpty()) {
    return "String_Node_Str";
  }
  if (null != this.getRoutingType() && this.getRoutingType().isEmpty()) {
    addressPart=this.getRoutingType() + "String_Node_Str" + this.getAddress();
  }
 else {
    addressPart=this.getAddress();
  }
  if (null != this.getName() && this.getName().isEmpty()) {
    return this.getName() + "String_Node_Str" + addressPart+ "String_Node_Str";
  }
 else {
    return addressPart;
  }
}

Fixed version (ground truth):
/** 
 * Returns string that represents the current instance.
 * @return String representation of instance.
 */
@Override public String toString(){
  String addressPart;
  if (null == this.getAddress() || this.getAddress().isEmpty()) {
    return "String_Node_Str";
  }
  if (null != this.getRoutingType() && this.getRoutingType().isEmpty()) {
    addressPart=this.getRoutingType() + "String_Node_Str" + this.getAddress();
  }
 else {
    addressPart=this.getAddress();
  }
  if (null != this.getName() && !this.getName().isEmpty()) {
    return this.getName() + "String_Node_Str" + addressPart+ "String_Node_Str";
  }
 else {
    return addressPart;
  }
}
Program: 3955
Project: 3955
Buggy source:
/** 
 * Returns string that represents the current instance.
 * @return String representation of instance.
 */
@Override public String toString(){
  String addressPart;
  if (null == this.getAddress() || this.getAddress().isEmpty()) {
    return "String_Node_Str";
  }
  if (null != this.getRoutingType() && this.getRoutingType().isEmpty()) {
    addressPart=this.getRoutingType() + "String_Node_Str" + this.getAddress();
  }
 else {
    addressPart=this.getAddress();
  }
  if (null != this.getName() && this.getName().isEmpty()) {
    return this.getName() + "String_Node_Str" + addressPart+ "String_Node_Str";
  }
 else {
    return addressPart;
  }
}

Fixed version (ground truth):
/** 
 * Returns string that represents the current instance.
 * @return String representation of instance.
 */
@Override public String toString(){
  String addressPart;
  if (null == this.getAddress() || this.getAddress().isEmpty()) {
    return "String_Node_Str";
  }
  if (null != this.getRoutingType() && this.getRoutingType().isEmpty()) {
    addressPart=this.getRoutingType() + "String_Node_Str" + this.getAddress();
  }
 else {
    addressPart=this.getAddress();
  }
  if (null != this.getName() && !this.getName().isEmpty()) {
    return this.getName() + "String_Node_Str" + addressPart+ "String_Node_Str";
  }
 else {
    return addressPart;
  }
}
Program: 3956
Project: 3956
Buggy source:
/** 
 * Validates request parameters, and emits the request to the server.
 * @param request The request.
 * @return The response returned by the server.
 */
protected HttpWebRequest validateAndEmitRequest() throws ServiceLocalException, Exception {
  this.validate();
  HttpWebRequest request=this.buildEwsHttpWebRequest();
  return this.getEwsHttpWebResponse(request);
}

Fixed version (ground truth):
/** 
 * Validates request parameters, and emits the request to the server.
 * @return The response returned by the server.
 */
protected HttpWebRequest validateAndEmitRequest() throws ServiceLocalException, Exception {
  this.validate();
  HttpWebRequest request=this.buildEwsHttpWebRequest();
  try {
    return this.getEwsHttpWebResponse(request);
  }
 catch (  HttpErrorException e) {
    processWebException(e,request);
    throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed,e.getMessage()),e);
  }
}
Program: 3957
Project: 3957
Buggy source:
/** 
 * Gets the IEwsHttpWebRequest object from the specifiedHttpWebRequest object with exception handling
 * @param request The specified HttpWebRequest
 * @return An HttpWebResponse instance
 */
protected HttpWebRequest getEwsHttpWebResponse(HttpWebRequest request) throws Exception {
  int code;
  try {
    code=request.executeRequest();
  }
 catch (  HttpErrorException ex) {
    if (ex.getHttpErrorCode() == WebExceptionStatus.ProtocolError.ordinal() && ex.getMessage() != null) {
      this.processWebException(ex,request);
    }
    throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed,ex.getMessage()),ex);
  }
catch (  IOException e) {
    throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed,e.getMessage()),e);
  }
  return request;
}

Fixed version (ground truth):
/** 
 * Gets the IEwsHttpWebRequest object from the specifiedHttpWebRequest object with exception handling
 * @param request The specified HttpWebRequest
 * @return An HttpWebResponse instance
 */
protected HttpWebRequest getEwsHttpWebResponse(HttpWebRequest request) throws Exception {
  try {
    request.executeRequest();
    if (request.getResponseCode() >= 400) {
      throw new HttpErrorException("String_Node_Str" + request.getResponseCode() + "String_Node_Str"+ request.getResponseText(),request.getResponseCode());
    }
  }
 catch (  IOException e) {
    throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed,e.getMessage()),e);
  }
  return request;
}
Program: 3958
Project: 3958
Buggy source:
/** 
 * Executes this request. 
 * @throws Exception 
 * @throws microsoft.exchange.webservices.data.ServiceLocalException
 */
protected Object internalExecute() throws ServiceLocalException, Exception {
  HttpWebRequest response=this.validateAndEmitRequest();
  try {
    return this.readResponse(response);
  }
 catch (  IOException ex) {
    throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed,ex.getMessage(),ex));
  }
catch (  Exception e) {
    if (response != null) {
      this.getService().processHttpResponseHeaders(TraceFlags.EwsResponseHttpHeaders,response);
    }
    throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed,e.getMessage()),e);
  }
 finally {
    try {
      response.close();
    }
 catch (    Exception e2) {
      response=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Executes this request. 
 * @throws Exception 
 * @throws microsoft.exchange.webservices.data.ServiceLocalException
 */
protected Object internalExecute() throws ServiceLocalException, Exception {
  HttpWebRequest response=null;
  try {
    response=this.validateAndEmitRequest();
    return this.readResponse(response);
  }
 catch (  IOException ex) {
    throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed,ex.getMessage(),ex));
  }
catch (  Exception e) {
    if (response != null) {
      this.getService().processHttpResponseHeaders(TraceFlags.EwsResponseHttpHeaders,response);
    }
    throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed,e.getMessage()),e);
  }
 finally {
    try {
      if (response != null) {
        response.close();
      }
    }
 catch (    Exception e2) {
      response=null;
    }
  }
}
Program: 3959
Project: 3959
Buggy source:
/** 
 * Converts a string to value consistent with type (or uses the default value if the string is null or empty).
 * @param String to convert to a value.
 * @return Value.
 * @throws microsoft.exchange.webservices.data.FormatException
 * @throws ServiceXmlDeserializationException 
 */
protected Object ConvertToValueOrDefault(String stringValue) throws ServiceXmlDeserializationException, FormatException {
  return (stringValue == null || stringValue.isEmpty()) ? this.getDefaultValue() : this.convertToValue(stringValue);
}

Fixed version (ground truth):
/** 
 * Converts a string to value consistent with type (or uses the default value if the string is null or empty).
 * @param stringValue to convert to a value.
 * @return Value.
 * @throws microsoft.exchange.webservices.data.FormatException
 * @throws ServiceXmlDeserializationException 
 */
protected Object ConvertToValueOrDefault(String stringValue) throws ServiceXmlDeserializationException, FormatException {
  return (stringValue == null || stringValue.isEmpty()) ? this.getDefaultValue() : this.convertToValue(stringValue);
}
Program: 3960
Project: 3960
Buggy source:
/** 
 * Case insensitive check if the collection contains the string.
 * @param collectionThe collection of objects, only strings are checked
 * @param match String to match
 * @return true, if match contained in the collection
 */
protected static boolean caseInsensitiveContains(ArrayList collection,String match){
  for (  Object obj : collection) {
    String str=(String)obj;
    if (str != null) {
      if (str.equalsIgnoreCase(match)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Case insensitive check if the collection contains the string.
 * @param collection The collection of objects, only strings are checked
 * @param match String to match
 * @return true, if match contained in the collection
 */
protected static boolean caseInsensitiveContains(ArrayList collection,String match){
  for (  Object obj : collection) {
    String str=(String)obj;
    if (str != null) {
      if (str.equalsIgnoreCase(match)) {
        return true;
      }
    }
  }
  return false;
}
Program: 3961
Project: 3961
Buggy source:
/** 
 * Determines whether every element in the collection  matches the conditions defined by the specified predicate.
 * @param typeparam T Entry type.
 * @param collection The collection.
 * @param predicate Predicate that defines the conditions  to check against the elements.
 * @return  True if every element in the collection matches the conditions defined by the specified predicate; otherwise, false.
 * @throws ServiceLocalException 
 */
protected static <T>boolean trueForAll(Iterable<T> collection,IPredicate<T> predicate) throws ServiceLocalException {
  for (  T entry : collection) {
    if (!predicate.predicate(entry)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Determines whether every element in the collection  matches the conditions defined by the specified predicate.
 * @param < T >           Entry type.
 * @param collection    The collection.
 * @param predicate     Predicate that defines the conditions to check against the elements.
 * @return  True if every element in the collection matches the conditions defined by the specified predicate; otherwise, false.
 * @throws ServiceLocalException 
 */
protected static <T>boolean trueForAll(Iterable<T> collection,IPredicate<T> predicate) throws ServiceLocalException {
  for (  T entry : collection) {
    if (!predicate.predicate(entry)) {
      return false;
    }
  }
  return true;
}
Program: 3962
Project: 3962
Buggy source:
/** 
 * Validates string parameter to be  non-empty string (null value not allowed).
 * @param paramThe string parameter.	
 * @param paramName Name of the parameter.	 
 * @throws ArgumentNullException 
 * @throws ArgumentException 
 * @throws ServiceLocalException 
 */
protected static void validateNonBlankStringParam(String param,String paramName) throws ArgumentNullException, ArgumentException, ServiceLocalException {
  if (param == null) {
    throw new ArgumentNullException(paramName);
  }
  validateNonBlankStringParamAllowNull(param,paramName);
}

Fixed version (ground truth):
/** 
 * Validates string parameter to be  non-empty string (null value not allowed).
 * @param param The string parameter.
 * @param paramName Name of the parameter.	 
 * @throws ArgumentNullException 
 * @throws ArgumentException 
 * @throws ServiceLocalException 
 */
protected static void validateNonBlankStringParam(String param,String paramName) throws ArgumentNullException, ArgumentException, ServiceLocalException {
  if (param == null) {
    throw new ArgumentNullException(paramName);
  }
  validateNonBlankStringParamAllowNull(param,paramName);
}
Program: 3963
Project: 3963
Buggy source:
/** 
 * Call an action for each member of a collection.
 * @param typeparam T Collection element type.
 * @param collection The collection.
 * @param action The action to apply.
 */
protected static <T>void forEach(Iterable<T> collection,IAction<T> action){
  for (  T entry : collection) {
    action.action(entry);
  }
}

Fixed version (ground truth):
/** 
 * Call an action for each member of a collection.
 * @param < T >           Collection element type.
 * @param collection    The collection.
 * @param action        The action to apply.
 */
protected static <T>void forEach(Iterable<T> collection,IAction<T> action){
  for (  T entry : collection) {
    action.action(entry);
  }
}
Program: 3964
Project: 3964
Buggy source:
/** 
 * Copies source stream to target.
 * @param source The source. 
 * @param name target The target.
 */
protected static void copyStream(ByteArrayOutputStream source,ByteArrayOutputStream target) throws Exception {
  ByteArrayOutputStream memContentStream=source;
  if (memContentStream != null) {
    memContentStream.writeTo(target);
    memContentStream.flush();
  }
 else {
    int c;
    ByteArrayInputStream inStream=new ByteArrayInputStream(source.toByteArray());
    while ((c=inStream.read()) != -1) {
      target.write((char)c);
    }
  }
}

Fixed version (ground truth):
/** 
 * Copies source stream to target.
 * @param source The source stream.
 * @param target The target stream.
 */
protected static void copyStream(ByteArrayOutputStream source,ByteArrayOutputStream target) throws Exception {
  ByteArrayOutputStream memContentStream=source;
  if (memContentStream != null) {
    memContentStream.writeTo(target);
    memContentStream.flush();
  }
 else {
    int c;
    ByteArrayInputStream inStream=new ByteArrayInputStream(source.toByteArray());
    while ((c=inStream.read()) != -1) {
      target.write((char)c);
    }
  }
}
Program: 3965
Project: 3965
Buggy source:
/** 
 * Empties the folder. Calling this method results in a call to EWS.
 * @param deletemode the delete mode	 
 * @throws deleteSubFolders Indicates whether sub-folders should also be deleted.
 * @throws Exception 
 */
public void empty(DeleteMode deletemode,boolean deleteSubFolders) throws Exception {
  this.throwIfThisIsNew();
  this.getService().emptyFolder(this.getId(),deletemode,deleteSubFolders);
}

Fixed version (ground truth):
/** 
 * Empties the folder. Calling this method results in a call to EWS.
 * @param deletemode the delete mode	 
 * @param deleteSubFolders Indicates whether sub-folders should also be deleted.
 * @throws Exception 
 */
public void empty(DeleteMode deletemode,boolean deleteSubFolders) throws Exception {
  this.throwIfThisIsNew();
  this.getService().emptyFolder(this.getId(),deletemode,deleteSubFolders);
}
Program: 3966
Project: 3966
Buggy source:
/** 
 * Sets the credentials.
 * @param emailAddress the email-id
 * @param pwd the password
 */
public void setCredentials(String domain,String user,String pwd){
  this.domain=domain;
  this.userName=user;
  this.password=pwd;
}

Fixed version (ground truth):
/** 
 * Sets the credentials.
 * @param domain user domain
 * @param user   user name
 * @param pwd    password
 */
public void setCredentials(String domain,String user,String pwd){
  this.domain=domain;
  this.userName=user;
  this.password=pwd;
}
Program: 3967
Project: 3967
Buggy source:
/** 
 * Sets the Headers.
 * @param contentType the new content type
 */
public void setHeaders(Map<String,String> headers){
  this.headers=headers;
}

Fixed version (ground truth):
/** 
 * Sets the Headers.
 * @param headers The headers
 */
public void setHeaders(Map<String,String> headers){
  this.headers=headers;
}
Program: 3968
Project: 3968
Buggy source:
/** 
 * Reads an XML Schema from the supplied stream.
 * @param array The character array containing the name to add.
 * @param offset Zero-based index into the array specifying the first character of the name.
 * @param length The number of characters in the name.
 * @return The new atomized String or the existing one if it already exists.If length is zero, String.Empty is returned
 * @throws System.IndexOutOfRangeException 0 > offset -or- offset >= array.Length -or- length > array.Length The above conditions do not cause an exception to be thrown if length =0.
 * @throws System.ArgumentOutOfRangeException length < 0.
 */
public abstract String Add(char[] array,int offset,int length);

Fixed version (ground truth):
/** 
 * Reads an XML Schema from the supplied stream.
 * @param array The character array containing the name to add.
 * @param offset Zero-based index into the array specifying the first character of the name.
 * @param length The number of characters in the name.
 * @return The new atomized String or the existing one if it already exists.If length is zero, String.Empty is returned
 * @throws ArgumentOutOfRangeException 0 > offset -or- offset >= array.Length -or- length > array.Length The above conditions do not cause an exception to be thrown if length =0.
 * @throws ArgumentOutOfRangeException length < 0.
 */
public abstract String Add(char[] array,int offset,int length);
Program: 3969
Project: 3969
Buggy source:
/** 
 * When overridden in a derived class, gets the atomized String containing the same characters as the specified range of characters in the given array.
 * @param array The character array containing the name to add.
 * @param offset Zero-based index into the array specifying the first character of the name.
 * @param length The number of characters in the name.
 * @return The atomized String or null if the String has not already beenatomized. If length is zero, String.Empty is returned
 * @throws System.IndexOutOfRangeException 0 > offset -or- offset >= array.Length -or- length > array.Length The above conditions do not cause an exception to be thrown if length =0.
 * @throws System.ArgumentOutOfRangeException length < 0.
 */
public abstract String Get(char[] array,int offset,int length);

Fixed version (ground truth):
/** 
 * When overridden in a derived class, gets the atomized String containing the same characters as the specified range of characters in the given array.
 * @param array The character array containing the name to add.
 * @param offset Zero-based index into the array specifying the first character of the name.
 * @param length The number of characters in the name.
 * @return The atomized String or null if the String has not already beenatomized. If length is zero, String.Empty is returned
 * @throws ArgumentOutOfRangeException 0 > offset -or- offset >= array.Length -or- length > array.Length The above conditions do not cause an exception to be thrown if length =0.
 * @throws ArgumentOutOfRangeException length < 0.
 */
public abstract String Get(char[] array,int offset,int length);
Program: 3970
Project: 3970
Buggy source:
/** 
 * Gets the property instance. 
 * @param propertyBag The property bag. 
 * @param complexProperty The property instance. 
 * @return True if the instance is newly created.
 */
private boolean getPropertyInstance(PropertyBag propertyBag,OutParam<Object> complexProperty){
  boolean retValue=false;
  if (!propertyBag.tryGetValue(this,complexProperty) || !this.hasFlag(PropertyDefinitionFlags.ReuseInstance,propertyBag.getOwner().getService().getRequestedServerVersion()))   ;
{
    complexProperty.setParam(this.createPropertyInstance(propertyBag.getOwner()));
    retValue=true;
  }
  return retValue;
}

Fixed version (ground truth):
/** 
 * Gets the property instance. 
 * @param propertyBag The property bag. 
 * @param complexProperty The property instance. 
 * @return True if the instance is newly created.
 */
private boolean getPropertyInstance(PropertyBag propertyBag,OutParam<Object> complexProperty){
  boolean retValue=false;
  if (!propertyBag.tryGetValue(this,complexProperty) || !this.hasFlag(PropertyDefinitionFlags.ReuseInstance,propertyBag.getOwner().getService().getRequestedServerVersion())) {
    complexProperty.setParam(this.createPropertyInstance(propertyBag.getOwner()));
    retValue=true;
  }
  return retValue;
}
Program: 3971
Project: 3971
Buggy source:
/** 
 * Convert DateTime to XML Schema date.
 * @param date the date
 * @return String representation of DateTime.
 */
static String dateTimeToXSDate(Date date){
  String format="String_Node_Str";
  DateFormat utcFormatter=new SimpleDateFormat(format);
  return utcFormatter.format(date);
}

Fixed version (ground truth):
/** 
 * Convert DateTime to XML Schema date.
 * @param date the date
 * @return String representation of DateTime.
 */
static String dateTimeToXSDate(Date date){
  String format="String_Node_Str";
  DateFormat utcFormatter=new SimpleDateFormat(format);
  utcFormatter.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  return utcFormatter.format(date);
}
Program: 3972
Project: 3972
Buggy source:
/** 
 * Dates the DateTime into an XML schema date time.
 * @param date the date
 * @return String representation of DateTime.
 */
protected static String dateTimeToXSDateTime(Date date){
  String format="String_Node_Str";
  DateFormat utcFormatter=new SimpleDateFormat(format);
  return utcFormatter.format(date);
}

Fixed version (ground truth):
/** 
 * Dates the DateTime into an XML schema date time.
 * @param date the date
 * @return String representation of DateTime.
 */
protected static String dateTimeToXSDateTime(Date date){
  String format="String_Node_Str";
  DateFormat utcFormatter=new SimpleDateFormat(format);
  utcFormatter.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  return utcFormatter.format(date);
}
Program: 3974
Project: 3974
Buggy source:
/** 
 * Converts the date time to universal date time string.
 * @param dt the date
 * @return String representation of DateTime in yyyy-MM-ddTHH:mm:ssZ format.
 */
protected String convertDateTimeToUniversalDateTimeString(Date dt){
  DateFormat utcFormatter=null;
  String utcPattern="String_Node_Str";
  utcFormatter=new SimpleDateFormat(utcPattern);
  return utcFormatter.format(dt);
}

Fixed version (ground truth):
/** 
 * Converts the date time to universal date time string.
 * @param dt the date
 * @return String representation of DateTime in yyyy-MM-ddTHH:mm:ssZ format.
 */
protected String convertDateTimeToUniversalDateTimeString(Date dt){
  String utcPattern="String_Node_Str";
  DateFormat utcFormatter=new SimpleDateFormat(utcPattern);
  utcFormatter.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  return utcFormatter.format(dt);
}
Program: 3976
Project: 3976
Buggy source:
/** 
 * Tries to read element from XML.
 * @param reader the reader
 * @return True if element was read
 * @throws Exception the exception
 */
protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception {
  if (super.tryReadElementFromXml(reader)) {
    return true;
  }
 else {
    if (reader.getLocalName().equals(XmlElementNames.EndDate)) {
      Date temp=reader.readElementValueAsDateTime();
      if (temp != null) {
        this.endDate=temp;
      }
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
/** 
 * Tries to read element from XML.
 * @param reader the reader
 * @return True if element was read
 * @throws Exception the exception
 */
protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception {
  if (super.tryReadElementFromXml(reader)) {
    return true;
  }
 else {
    if (reader.getLocalName().equals(XmlElementNames.EndDate)) {
      Date temp=reader.readElementValueAsUnspecifiedDate();
      if (temp != null) {
        this.endDate=temp;
      }
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 3977
Project: 3977
Buggy source:
/** 
 * Setups the recurrence.
 * @param recurrence the new up recurrence
 * @throws Exception the exception
 */
protected void setupRecurrence(Recurrence recurrence) throws Exception {
  super.setupRecurrence(recurrence);
  this.endDate=recurrence.getEndDate();
}

Fixed version (ground truth):
/** 
 * Setups the recurrence.
 * @param recurrence the new up recurrence
 * @throws Exception the exception
 */
protected void setupRecurrence(Recurrence recurrence) throws Exception {
  super.setupRecurrence(recurrence);
  recurrence.setEndDate(this.endDate);
}
Program: 3978
Project: 3978
Buggy source:
/** 
 * Setups the recurrence.
 * @param recurrence the new up recurrence
 * @throws Exception the exception
 */
protected void setupRecurrence(Recurrence recurrence) throws Exception {
  super.setupRecurrence(recurrence);
  this.numberOfOccurrences=recurrence.getNumberOfOccurrences();
}

Fixed version (ground truth):
/** 
 * Setups the recurrence.
 * @param recurrence the new up recurrence
 * @throws Exception the exception
 */
protected void setupRecurrence(Recurrence recurrence) throws Exception {
  super.setupRecurrence(recurrence);
  recurrence.setNumberOfOccurrences(this.numberOfOccurrences);
}
Program: 3979
Project: 3979
Buggy source:
/** 
 * * Writes the Id encapsulated in the wrapper to XML.
 * @param writer the writer
 * @throws Exception the exception
 */
protected abstract void writeToXml(EwsServiceXmlWriter writer) throws Exception ;

Fixed version (ground truth):
/** 
 * Writes the Id encapsulated in the wrapper to XML.
 * @param writer the writer
 * @throws Exception the exception
 */
protected abstract void writeToXml(EwsServiceXmlWriter writer) throws Exception ;
Program: 3980
Project: 3980
Buggy source:
/** 
 * * Initializes a new instance of the class.
 */
protected AbstractItemIdWrapper(){
}

Fixed version (ground truth):
/** 
 * Initializes a new instance of the class.
 */
protected AbstractItemIdWrapper(){
}
Program: 3981
Project: 3981
Buggy source:
/** 
 * * Initializes a new instance of the class.
 * @param service the service
 * @throws Exception 
 */
protected AddDelegateRequest(ExchangeService service) throws Exception {
  super(service);
}

Fixed version (ground truth):
/** 
 * Initializes a new instance of the class.
 * @param service the service
 * @throws Exception 
 */
protected AddDelegateRequest(ExchangeService service) throws Exception {
  super(service);
}
Program: 3982
Project: 3982
Buggy source:
/** 
 * * Gets the delegate users. <value>The delegate users.</value>
 * @return the delegate users
 */
public List<DelegateUser> getDelegateUsers(){
  return this.delegateUsers;
}

Fixed version (ground truth):
/** 
 * Gets the delegate users. <value>The delegate users.</value>
 * @return the delegate users
 */
public List<DelegateUser> getDelegateUsers(){
  return this.delegateUsers;
}
Program: 3983
Project: 3983
Buggy source:
/** 
 * * Writes the elements to XML.
 * @param writer the writer
 * @throws Exception the exception
 */
@Override protected void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception {
  super.writeElementsToXml(writer);
  writer.writeStartElement(XmlNamespace.Messages,XmlElementNames.DelegateUsers);
  for (  DelegateUser delegateUser : this.getDelegateUsers()) {
    delegateUser.writeToXml(writer,XmlElementNames.DelegateUser);
  }
  writer.writeEndElement();
  if (this.getMeetingRequestsDeliveryScope() != null) {
    writer.writeElementValue(XmlNamespace.Messages,XmlElementNames.DeliverMeetingRequests,this.getMeetingRequestsDeliveryScope());
  }
}

Fixed version (ground truth):
/** 
 * Writes the elements to XML.
 * @param writer the writer
 * @throws Exception the exception
 */
@Override protected void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception {
  super.writeElementsToXml(writer);
  writer.writeStartElement(XmlNamespace.Messages,XmlElementNames.DelegateUsers);
  for (  DelegateUser delegateUser : this.getDelegateUsers()) {
    delegateUser.writeToXml(writer,XmlElementNames.DelegateUser);
  }
  writer.writeEndElement();
  if (this.getMeetingRequestsDeliveryScope() != null) {
    writer.writeElementValue(XmlNamespace.Messages,XmlElementNames.DeliverMeetingRequests,this.getMeetingRequestsDeliveryScope());
  }
}
Program: 3984
Project: 3984
Buggy source:
/** 
 * * Gets the meeting requests delivery scope. <value>The meeting requests delivery scope.</value>
 * @return the meeting requests delivery scope
 */
public MeetingRequestsDeliveryScope getMeetingRequestsDeliveryScope(){
  return this.meetingRequestsDeliveryScope;
}

Fixed version (ground truth):
/** 
 * Gets the meeting requests delivery scope. <value>The meeting requests delivery scope.</value>
 * @return the meeting requests delivery scope
 */
public MeetingRequestsDeliveryScope getMeetingRequestsDeliveryScope(){
  return this.meetingRequestsDeliveryScope;
}
Program: 3985
Project: 3985
Buggy source:
/** 
 * * Initializes a new instance of the class.
 * @throws Exception the exception
 */
@Override protected void validate() throws Exception {
  super.validate();
  EwsUtilities.validateParamCollection(this.getDelegateUsers().iterator(),"String_Node_Str");
  for (  DelegateUser delegateUser : this.getDelegateUsers()) {
    delegateUser.validateUpdateDelegate();
  }
  if (this.meetingRequestsDeliveryScope != null) {
    EwsUtilities.validateEnumVersionValue(this.getMeetingRequestsDeliveryScope(),this.getService().getRequestedServerVersion());
  }
}

Fixed version (ground truth):
/** 
 * Initializes a new instance of the class.
 * @throws Exception the exception
 */
@Override protected void validate() throws Exception {
  super.validate();
  EwsUtilities.validateParamCollection(this.getDelegateUsers().iterator(),"String_Node_Str");
  for (  DelegateUser delegateUser : this.getDelegateUsers()) {
    delegateUser.validateUpdateDelegate();
  }
  if (this.meetingRequestsDeliveryScope != null) {
    EwsUtilities.validateEnumVersionValue(this.getMeetingRequestsDeliveryScope(),this.getService().getRequestedServerVersion());
  }
}
Program: 3986
Project: 3986
Buggy source:
/** 
 * * Initializes a new instance.
 * @param owner The owner.
 */
protected Attachment(Item owner){
  this.owner=owner;
}

Fixed version (ground truth):
/** 
 * Initializes a new instance.
 * @param owner The owner.
 */
protected Attachment(Item owner){
  this.owner=owner;
}
Program: 3987
Project: 3987
Buggy source:
/** 
 * * Adds a file attachment to the collection.
 * @param name the name
 * @param content accepts byte byte arrays representing the content of the attachment.
 * @return FileAttachment
 */
public FileAttachment addFileAttachment(String name,byte[] content){
  FileAttachment fileAttachment=new FileAttachment(this.owner);
  fileAttachment.setName(name);
  fileAttachment.setContent(content);
  this.internalAdd(fileAttachment);
  return fileAttachment;
}

Fixed version (ground truth):
/** 
 * Adds a file attachment to the collection.
 * @param name the name
 * @param content accepts byte byte arrays representing the content of the attachment.
 * @return FileAttachment
 */
public FileAttachment addFileAttachment(String name,byte[] content){
  FileAttachment fileAttachment=new FileAttachment(this.owner);
  fileAttachment.setName(name);
  fileAttachment.setContent(content);
  this.internalAdd(fileAttachment);
  return fileAttachment;
}
Program: 3988
Project: 3988
Buggy source:
/** 
 * * Adds an item attachment to the collection.
 * @param < TItem > the generic type
 * @param cls the cls
 * @return An ItemAttachment instance.
 * @throws Exception the exception
 */
public <TItem extends Item>GenericItemAttachment<TItem> addItemAttachment(Class<TItem> cls) throws Exception {
  if (cls.getDeclaredFields().length == 0) {
    throw new InvalidOperationException(String.format("String_Node_Str",cls.getName()));
  }
  GenericItemAttachment<TItem> itemAttachment=new GenericItemAttachment<TItem>(this.owner);
  itemAttachment.setTItem((TItem)EwsUtilities.createItemFromItemClass(itemAttachment,cls,true));
  this.internalAdd(itemAttachment);
  return itemAttachment;
}

Fixed version (ground truth):
/** 
 * Adds an item attachment to the collection.
 * @param < TItem > the generic type
 * @param cls the cls
 * @return An ItemAttachment instance.
 * @throws Exception the exception
 */
public <TItem extends Item>GenericItemAttachment<TItem> addItemAttachment(Class<TItem> cls) throws Exception {
  if (cls.getDeclaredFields().length == 0) {
    throw new InvalidOperationException(String.format("String_Node_Str",cls.getName()));
  }
  GenericItemAttachment<TItem> itemAttachment=new GenericItemAttachment<TItem>(this.owner);
  itemAttachment.setTItem((TItem)EwsUtilities.createItemFromItemClass(itemAttachment,cls,true));
  this.internalAdd(itemAttachment);
  return itemAttachment;
}
Program: 3989
Project: 3989
Buggy source:
/** 
 * * Gets the type of response the attendee gave to the meeting invitation it received.
 * @return the response type
 */
public MeetingResponseType getResponseType(){
  return responseType;
}

Fixed version (ground truth):
/** 
 * Gets the type of response the attendee gave to the meeting invitation it received.
 * @return the response type
 */
public MeetingResponseType getResponseType(){
  return responseType;
}
Program: 3990
Project: 3990
Buggy source:
/** 
 * * Writes the elements to XML.
 * @param writer the writer
 * @throws Exception the exception
 */
protected void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception {
  writer.writeStartElement(this.getNamespace(),XmlElementNames.Mailbox);
  super.writeElementsToXml(writer);
  writer.writeEndElement();
}

Fixed version (ground truth):
/** 
 * Writes the elements to XML.
 * @param writer the writer
 * @throws Exception the exception
 */
protected void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception {
  writer.writeStartElement(this.getNamespace(),XmlElementNames.Mailbox);
  super.writeElementsToXml(writer);
  writer.writeEndElement();
}
Program: 3991
Project: 3991
Buggy source:
/** 
 * * Initializes a new instance of the Attendee class.
 * @param mailbox the mailbox
 * @throws Exception the exception
 */
public Attendee(EmailAddress mailbox) throws Exception {
  super(mailbox);
}

Fixed version (ground truth):
/** 
 * Initializes a new instance of the Attendee class.
 * @param mailbox the mailbox
 * @throws Exception the exception
 */
public Attendee(EmailAddress mailbox) throws Exception {
  super(mailbox);
}
Program: 3992
Project: 3992
Buggy source:
/** 
 * * Tries to read element from XML.
 * @param reader the reader
 * @return True if element was read.
 * @throws Exception the exception
 */
protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception {
  if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Mailbox)) {
    this.loadFromXml(reader,reader.getLocalName());
    return true;
  }
 else   if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ResponseType)) {
    this.responseType=reader.readElementValue(MeetingResponseType.class);
    return true;
  }
 else   if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.LastResponseTime)) {
    this.lastResponseTime=reader.readElementValueAsDateTime();
    return true;
  }
 else {
    return super.tryReadElementFromXml(reader);
  }
}

Fixed version (ground truth):
/** 
 * Tries to read element from XML.
 * @param reader the reader
 * @return True if element was read.
 * @throws Exception the exception
 */
protected boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception {
  if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Mailbox)) {
    this.loadFromXml(reader,reader.getLocalName());
    return true;
  }
 else   if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ResponseType)) {
    this.responseType=reader.readElementValue(MeetingResponseType.class);
    return true;
  }
 else   if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.LastResponseTime)) {
    this.lastResponseTime=reader.readElementValueAsDateTime();
    return true;
  }
 else {
    return super.tryReadElementFromXml(reader);
  }
}
Program: 3993
Project: 3993
Buggy source:
public Object call(org.mozilla.javascript.Context cx,Scriptable scope,Scriptable thisObj,final Object[] args){
  Activity activity=(Activity)mContext;
  activity.runOnUiThread(new Runnable(){
    @Override public void run(){
      toast((String)args[0]);
    }
  }
);
  return null;
}

Fixed version (ground truth):
public Object call(org.mozilla.javascript.Context cx,Scriptable scope,Scriptable thisObj,final Object[] args){
  Activity activity=(Activity)mContext;
  activity.runOnUiThread(new Runnable(){
    @Override public void run(){
      toast(((org.mozilla.javascript.ConsString)args[0]).toString());
    }
  }
);
  return null;
}
Program: 3994
Project: 3994
Buggy source:
public static void toast(String message){
  if (mInstance.currentToast != null) {
    mInstance.currentToast.cancel();
  }
  mInstance.currentToast=Toast.makeText(mInstance.mContext,message,Toast.LENGTH_SHORT);
  mInstance.currentToast.show();
}

Fixed version (ground truth):
public static void toast(final String message){
  if (mInstance.currentToast != null) {
    mInstance.currentToast.cancel();
  }
  mInstance.currentToast=Toast.makeText(mInstance.mContext,message,Toast.LENGTH_SHORT);
  mInstance.currentToast.show();
}
Program: 3995
Project: 3995
Buggy source:
@Override public void run(){
  toast((String)args[0]);
}

Fixed version (ground truth):
@Override public void run(){
  toast(((org.mozilla.javascript.ConsString)args[0]).toString());
}
Program: 3996
Project: 3996
Buggy source:
private static int vn(byte[] x,final int xoff,final int xlen,byte[] y,final int yoff,final int ylen,int n){
  int i, d=0;
  for (i=0; i < n; i++)   d|=x[i + xoff] ^ y[i + yoff];
  return (1 & ((d - 1) >>> 8)) - 1;
}

Fixed version (ground truth):
private static int vn(byte[] x,final int xoff,final int xlen,byte[] y,final int yoff,final int ylen,int n){
  int i, d=0;
  for (i=0; i < n; i++)   d|=(x[i + xoff] ^ y[i + yoff]) & 0xff;
  return (1 & ((d - 1) >>> 8)) - 1;
}
Program: 3997
Project: 3997
Buggy source:
private static int vn(byte[] x,final int xoff,byte[] y,final int yoff,int n){
  int i, d=0;
  for (i=0; i < n; i++)   d|=x[i + xoff] ^ y[i + yoff];
  return (1 & ((d - 1) >>> 8)) - 1;
}

Fixed version (ground truth):
private static int vn(byte[] x,final int xoff,byte[] y,final int yoff,int n){
  int i, d=0;
  for (i=0; i < n; i++)   d|=(x[i + xoff] ^ y[i + yoff]) & 0xff;
  return (1 & ((d - 1) >>> 8)) - 1;
}
Program: 3998
Project: 3998
Buggy source:
/** 
 * Sends a close instruction to the remote party.
 * @throws Exception 
 * @api public
 */
protected boolean close(int code,Object data,boolean mask) throws Exception {
  if (code > 0) {
    if (!ErrorCodes.isValidErrorCode(code))     throw new Exception("String_Node_Str");
  }
  code=code > 0 ? code : 1000;
  ByteBuffer dataBuffer=ByteBuffer.allocate(2 + (data != null ? Util.chunkByteLength(data,"String_Node_Str") : 0));
  dataBuffer.order(ByteOrder.BIG_ENDIAN).putShort(0,(short)(code & 0xffff));
  if (dataBuffer.capacity() > 2)   dataBuffer.put(Util.chunkToBuffer(data,"String_Node_Str"));
  return this.frameAndSend(0x8,dataBuffer,true,mask,null);
}

Fixed version (ground truth):
/** 
 * Sends a close instruction to the remote party.
 * @throws Exception 
 * @api public
 */
protected boolean close(int code,Object data,boolean mask) throws Exception {
  Log.d(TAG,"String_Node_Str" + code + "String_Node_Str"+ data+ "String_Node_Str"+ mask);
  if (code > 0) {
    if (!ErrorCodes.isValidErrorCode(code))     throw new Exception("String_Node_Str");
  }
  code=code > 0 ? code : 1000;
  ByteBuffer dataBuffer=ByteBuffer.allocate(2 + (data != null ? Util.chunkByteLength(data,"String_Node_Str") : 0));
  dataBuffer.order(ByteOrder.BIG_ENDIAN).putShort(0,(short)(code & 0xffff));
  if (dataBuffer.capacity() > 2)   BufferUtil.fastCopy(dataBuffer.capacity() - 2,Util.chunkToBuffer(data,"String_Node_Str"),dataBuffer,2);
  return this.frameAndSend(0x8,dataBuffer,true,mask,null);
}
Program: 4001
Project: 4001
Buggy source:
@Override public void onOpen(OpenEvent event) throws Exception {
  ws.send("String_Node_Str",new WebSocket.SendOptions(false,true),null);
  ctx.setInterval(new IntervalListener(){
    @Override public void onInterval() throws Exception {
      ws.send("String_Node_Str" + new Date(),new WebSocket.SendOptions(false,true),null);
    }
  }
,3000);
}

Fixed version (ground truth):
@Override public void onOpen(OpenEvent event) throws Exception {
  ws.send("String_Node_Str",new WebSocket.SendOptions(false,false),null);
  ctx.setInterval(new IntervalListener(){
    @Override public void onInterval() throws Exception {
      ws.send("String_Node_Str" + new Date(),new WebSocket.SendOptions(false,true),null);
    }
  }
,3000);
}
Program: 4002
Project: 4002
Buggy source:
@Override public void onMessage(MessageEvent event) throws Exception {
  Log.d(TAG,"String_Node_Str" + event.toString());
  if (event.isBinary()) {
    Log.d(TAG,"String_Node_Str" + event.getData().toString());
  }
 else {
    Log.d(TAG,"String_Node_Str" + (String)(event.getData()));
    socket.send(event.getData().toString() + "String_Node_Str",new WebSocket.SendOptions(false,true),null);
  }
}

Fixed version (ground truth):
@Override public void onMessage(MessageEvent event) throws Exception {
  Log.d(TAG,"String_Node_Str" + event.toString());
  if (event.isBinary()) {
    Log.d(TAG,"String_Node_Str" + event.getData().toString());
  }
 else {
    Log.d(TAG,"String_Node_Str" + (String)(event.getData()));
    socket.send(event.getData().toString() + "String_Node_Str",new WebSocket.SendOptions(false,false),null);
  }
}
Program: 4003
Project: 4003
Buggy source:
@Override public void onListening() throws Exception {
  Log.d(TAG,"String_Node_Str");
  final WebSocket ws=new WebSocket(ctx,"String_Node_Str",null,new WebSocket.Options());
  ws.onmessage(new onmessageListener(){
    @Override public void onMessage(    MessageEvent event) throws Exception {
      Log.d(TAG,"String_Node_Str" + event.toString());
      if (event.isBinary()) {
        Log.d(TAG,"String_Node_Str" + event.getData().toString());
      }
 else {
        Log.d(TAG,"String_Node_Str" + (String)(event.getData()));
      }
    }
  }
);
  ws.onopen(new onopenListener(){
    @Override public void onOpen(    OpenEvent event) throws Exception {
      ws.send("String_Node_Str",new WebSocket.SendOptions(false,true),null);
      ctx.setInterval(new IntervalListener(){
        @Override public void onInterval() throws Exception {
          ws.send("String_Node_Str" + new Date(),new WebSocket.SendOptions(false,true),null);
        }
      }
,3000);
    }
  }
);
}

Fixed version (ground truth):
@Override public void onListening() throws Exception {
  Log.d(TAG,"String_Node_Str");
  final WebSocket ws=new WebSocket(ctx,"String_Node_Str",null,new WebSocket.Options());
  ws.onmessage(new onmessageListener(){
    @Override public void onMessage(    MessageEvent event) throws Exception {
      Log.d(TAG,"String_Node_Str" + event.toString());
      if (event.isBinary()) {
        Log.d(TAG,"String_Node_Str" + event.getData().toString());
      }
 else {
        Log.d(TAG,"String_Node_Str" + (String)(event.getData()));
      }
    }
  }
);
  ws.onerror(new WebSocket.onerrorListener(){
    @Override public void onError(    ErrorEvent event) throws Exception {
      Log.d(TAG,"String_Node_Str" + event.getCode() + "String_Node_Str"+ event.getError());
    }
  }
);
  ws.onopen(new onopenListener(){
    @Override public void onOpen(    OpenEvent event) throws Exception {
      ws.send("String_Node_Str",new WebSocket.SendOptions(false,false),null);
      ctx.setInterval(new IntervalListener(){
        @Override public void onInterval() throws Exception {
          ws.send("String_Node_Str" + new Date(),new WebSocket.SendOptions(false,true),null);
        }
      }
,3000);
    }
  }
);
}
Program: 4004
Project: 4004
Buggy source:
@Override public void onConnection(final WebSocket socket) throws Exception {
  Log.d(TAG,"String_Node_Str" + socket);
  socket.onmessage(new WebSocket.onmessageListener(){
    @Override public void onMessage(    MessageEvent event) throws Exception {
      Log.d(TAG,"String_Node_Str" + event.toString());
      if (event.isBinary()) {
        Log.d(TAG,"String_Node_Str" + event.getData().toString());
      }
 else {
        Log.d(TAG,"String_Node_Str" + (String)(event.getData()));
        socket.send(event.getData().toString() + "String_Node_Str",new WebSocket.SendOptions(false,true),null);
      }
    }
  }
);
  socket.send("String_Node_Str",new WebSocket.SendOptions(false,true),null);
}

Fixed version (ground truth):
@Override public void onConnection(final WebSocket socket) throws Exception {
  Log.d(TAG,"String_Node_Str" + socket);
  socket.onmessage(new WebSocket.onmessageListener(){
    @Override public void onMessage(    MessageEvent event) throws Exception {
      Log.d(TAG,"String_Node_Str" + event.toString());
      if (event.isBinary()) {
        Log.d(TAG,"String_Node_Str" + event.getData().toString());
      }
 else {
        Log.d(TAG,"String_Node_Str" + (String)(event.getData()));
        socket.send(event.getData().toString() + "String_Node_Str",new WebSocket.SendOptions(false,false),null);
      }
    }
  }
);
  socket.send("String_Node_Str",new WebSocket.SendOptions(false,false),null);
}