nus-yam/ex-repair huggingface dataset:
Program: 100895
Project: 100895
Buggy source:
/** 
 * Evaluates the conditional.
 * @param conditional The conditional.
 * @return A boolean indicating the conditional resolution.
 * @throws com.github.arara.exception.AraraException An exception is raisedin case of error.
 */
public static boolean evaluate(String conditional) throws AraraException {
  if ("String_Node_Str".equals(conditional)) {
    return true;
  }
  HashMap map=new HashMap();
  try {
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class,String.class));
  }
 catch (  NoSuchMethodException nsme) {
  }
  try {
    Object result=TemplateRuntime.eval("String_Node_Str".concat(conditional).concat("String_Node_Str"),map);
    if (!(result instanceof Boolean)) {
      throw new AraraException(localization.getMessage("String_Node_Str").concat("String_Node_Str").concat(conditional));
    }
 else {
      return ((Boolean)result).booleanValue();
    }
  }
 catch (  RuntimeException runtimeException) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraUtils.getVariableFromException(runtimeException)));
  }
}

Fixed version (ground truth):
/** 
 * Evaluates the conditional.
 * @param conditional The conditional.
 * @return A boolean indicating the conditional resolution.
 * @throws com.github.arara.exception.AraraException An exception is raisedin case of error.
 */
public static boolean evaluate(String conditional) throws AraraException {
  if ("String_Node_Str".equals(conditional)) {
    return true;
  }
  HashMap map=new HashMap();
  try {
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class,String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
  }
 catch (  NoSuchMethodException nsme) {
  }
  try {
    Object result=TemplateRuntime.eval("String_Node_Str".concat(conditional).concat("String_Node_Str"),map);
    if (!(result instanceof Boolean)) {
      throw new AraraException(localization.getMessage("String_Node_Str").concat("String_Node_Str").concat(conditional));
    }
 else {
      return ((Boolean)result).booleanValue();
    }
  }
 catch (  RuntimeException runtimeException) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraUtils.getVariableFromException(runtimeException)));
  }
}
Program: 100896
Project: 100896
Buggy source:
/** 
 * Discovers name based on some tricky rules.
 * @param value The value to be analyzed.
 * @param prefix The file prefix.
 * @return The new discovered name.
 */
private static String discoverName(String value,String prefix){
  if (value.lastIndexOf("String_Node_Str") == -1) {
    return prefix.concat("String_Node_Str").concat(value);
  }
 else {
    if (value.endsWith("String_Node_Str")) {
      return value.substring(0,value.length() - 1);
    }
 else {
      return value;
    }
  }
}

Fixed version (ground truth):
/** 
 * Discovers name based on some tricky rules.
 * @param value The value to be analyzed.
 * @param prefix The file prefix.
 * @return The new discovered name.
 */
private static String discoverName(String value,String prefix){
  if (!value.contains(File.separator)) {
    if (value.lastIndexOf("String_Node_Str") == -1) {
      return absolutePath.concat(File.separator).concat(prefix).concat("String_Node_Str").concat(value);
    }
 else {
      if (value.endsWith("String_Node_Str")) {
        return absolutePath.concat(File.separator).concat(value.substring(0,value.length() - 1));
      }
 else {
        return absolutePath.concat(File.separator).concat(value);
      }
    }
  }
 else {
    if (value.startsWith(File.separator)) {
      return value;
    }
 else {
      return absolutePath.concat(File.separator).concat(value);
    }
  }
}
Program: 100897
Project: 100897
Buggy source:
/** 
 * Test filenames.
 * @throws IllegalAccessException Throw exception in case of error.
 * @throws IllegalArgumentException Throw exception in case of error.
 * @throws NoSuchMethodException Throw exception in case of error.
 * @throws InvocationTargetException Throw exception in case of error.
 */
public void testFilenames() throws IllegalAccessException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
  Method method=ConditionalMethods.class.getDeclaredMethod("String_Node_Str",String.class,String.class);
  method.setAccessible(true);
  List<String> results=new ArrayList<String>();
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  List<String> expected=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals(results,expected);
}

Fixed version (ground truth):
/** 
 * Test filenames.
 * @throws IllegalAccessException Throw exception in case of error.
 * @throws IllegalArgumentException Throw exception in case of error.
 * @throws NoSuchMethodException Throw exception in case of error.
 * @throws InvocationTargetException Throw exception in case of error.
 */
public void testFilenames() throws IllegalAccessException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException, NoSuchFieldException {
  Method method=ConditionalMethods.class.getDeclaredMethod("String_Node_Str",String.class,String.class);
  method.setAccessible(true);
  Field field=ConditionalMethods.class.getDeclaredField("String_Node_Str");
  field.setAccessible(true);
  field.set(null,"String_Node_Str");
  List<String> results=new ArrayList<String>();
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  List<String> expected=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals(results,expected);
}
Program: 100899
Project: 100899
Buggy source:
/** 
 * Loads the XML file and maps the content to a hashmap.
 * @return A hashmap containing all data from the XML file, hopefully thefilename and its corresponding hash.
 * @throws com.github.arara.exception.AraraException if something badhappens, including a malformed XML or an encoding problem.
 */
public static HashMap load() throws AraraException {
  try {
    FileInputStream inputStream=new FileInputStream(AraraConstants.ARARADATABASE);
    Reader reader=new InputStreamReader(inputStream,"String_Node_Str");
    XStream xstream=new XStream();
    HashMap map=(HashMap)xstream.fromXML(reader);
    reader.close();
    inputStream.close();
    return map;
  }
 catch (  FileNotFoundException fnfe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  UnsupportedEncodingException uee) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  XStreamException xe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  IOException ioe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
}

Fixed version (ground truth):
/** 
 * Loads the XML file and maps the content to a hashmap.
 * @return A hashmap containing all data from the XML file, hopefully thefilename and its corresponding hash.
 * @throws com.github.arara.exception.AraraException if something badhappens, including a malformed XML or an encoding problem.
 */
public static HashMap load() throws AraraException {
  try {
    FileInputStream inputStream=new FileInputStream(absolutePath.concat(File.separator).concat(AraraConstants.ARARADATABASE));
    Reader reader=new InputStreamReader(inputStream,"String_Node_Str");
    XStream xstream=new XStream();
    HashMap map=(HashMap)xstream.fromXML(reader);
    reader.close();
    inputStream.close();
    return map;
  }
 catch (  FileNotFoundException fnfe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  UnsupportedEncodingException uee) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  XStreamException xe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  IOException ioe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
}
Program: 100900
Project: 100900
Buggy source:
/** 
 * Saves the hashmap into a XML file.
 * @param map A hashmap containing all data from files and theircorresponding hashes.
 * @throws com.github.arara.exception.AraraException if something badhappens.
 */
public static void save(HashMap map) throws AraraException {
  try {
    FileOutputStream outputStream=new FileOutputStream(AraraConstants.ARARADATABASE);
    OutputStreamWriter writer=new OutputStreamWriter(outputStream,"String_Node_Str");
    XStream xstream=new XStream();
    xstream.toXML(map,writer);
    writer.close();
    outputStream.close();
  }
 catch (  UnsupportedEncodingException uee) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  XStreamException xe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  IOException ioe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
}

Fixed version (ground truth):
/** 
 * Saves the hashmap into a XML file.
 * @param map A hashmap containing all data from files and theircorresponding hashes.
 * @throws com.github.arara.exception.AraraException if something badhappens.
 */
public static void save(HashMap map) throws AraraException {
  try {
    FileOutputStream outputStream=new FileOutputStream(absolutePath.concat(File.separator).concat(AraraConstants.ARARADATABASE));
    OutputStreamWriter writer=new OutputStreamWriter(outputStream,"String_Node_Str");
    XStream xstream=new XStream();
    xstream.toXML(map,writer);
    writer.close();
    outputStream.close();
  }
 catch (  UnsupportedEncodingException uee) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  XStreamException xe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
catch (  IOException ioe) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraConstants.ARARADATABASE));
  }
}
Program: 100901
Project: 100901
Buggy source:
/** 
 * Checks if the XML file exists in the current directory.
 * @return a boolean indicating if the XML file exists in the currentdirectory.
 */
public static boolean exists(){
  return ConditionalMethods.exists(AraraConstants.ARARADATABASE);
}

Fixed version (ground truth):
/** 
 * Checks if the XML file exists in the current directory.
 * @return a boolean indicating if the XML file exists in the currentdirectory.
 */
public static boolean exists(){
  return ConditionalMethods.exists(absolutePath.concat(File.separator).concat(AraraConstants.ARARADATABASE));
}
Program: 100903
Project: 100903
Buggy source:
/** 
 * Evaluates the conditional.
 * @param conditional The conditional.
 * @return A boolean indicating the conditional resolution.
 * @throws com.github.arara.exception.AraraException An exception is raisedin case of error.
 */
public static boolean evaluate(String conditional) throws AraraException {
  if ("String_Node_Str".equals(conditional)) {
    return true;
  }
  HashMap map=new HashMap();
  try {
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class,String.class));
  }
 catch (  NoSuchMethodException nsme) {
  }
  try {
    Object result=TemplateRuntime.eval("String_Node_Str".concat(conditional).concat("String_Node_Str"),map);
    if (!(result instanceof Boolean)) {
      throw new AraraException(localization.getMessage("String_Node_Str").concat("String_Node_Str").concat(conditional));
    }
 else {
      return ((Boolean)result).booleanValue();
    }
  }
 catch (  RuntimeException runtimeException) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraUtils.getVariableFromException(runtimeException)));
  }
}

Fixed version (ground truth):
/** 
 * Evaluates the conditional.
 * @param conditional The conditional.
 * @return A boolean indicating the conditional resolution.
 * @throws com.github.arara.exception.AraraException An exception is raisedin case of error.
 */
public static boolean evaluate(String conditional) throws AraraException {
  if ("String_Node_Str".equals(conditional)) {
    return true;
  }
  HashMap map=new HashMap();
  try {
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class,String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
    map.put("String_Node_Str",ConditionalMethods.class.getMethod("String_Node_Str",String.class));
  }
 catch (  NoSuchMethodException nsme) {
  }
  try {
    Object result=TemplateRuntime.eval("String_Node_Str".concat(conditional).concat("String_Node_Str"),map);
    if (!(result instanceof Boolean)) {
      throw new AraraException(localization.getMessage("String_Node_Str").concat("String_Node_Str").concat(conditional));
    }
 else {
      return ((Boolean)result).booleanValue();
    }
  }
 catch (  RuntimeException runtimeException) {
    throw new AraraException(localization.getMessage("String_Node_Str",AraraUtils.getVariableFromException(runtimeException)));
  }
}
Program: 100904
Project: 100904
Buggy source:
/** 
 * Discovers name based on some tricky rules.
 * @param value The value to be analyzed.
 * @param prefix The file prefix.
 * @return The new discovered name.
 */
private static String discoverName(String value,String prefix){
  if (value.lastIndexOf("String_Node_Str") == -1) {
    return prefix.concat("String_Node_Str").concat(value);
  }
 else {
    if (value.endsWith("String_Node_Str")) {
      return value.substring(0,value.length() - 1);
    }
 else {
      return value;
    }
  }
}

Fixed version (ground truth):
/** 
 * Discovers name based on some tricky rules.
 * @param value The value to be analyzed.
 * @param prefix The file prefix.
 * @return The new discovered name.
 */
private static String discoverName(String value,String prefix){
  if (!value.contains(File.separator)) {
    if (value.lastIndexOf("String_Node_Str") == -1) {
      return absolutePath.concat(File.separator).concat(prefix).concat("String_Node_Str").concat(value);
    }
 else {
      if (value.endsWith("String_Node_Str")) {
        return absolutePath.concat(File.separator).concat(value.substring(0,value.length() - 1));
      }
 else {
        return absolutePath.concat(File.separator).concat(value);
      }
    }
  }
 else {
    if (value.startsWith(File.separator)) {
      return value;
    }
 else {
      return absolutePath.concat(File.separator).concat(value);
    }
  }
}
Program: 100905
Project: 100905
Buggy source:
/** 
 * Test filenames.
 * @throws IllegalAccessException Throw exception in case of error.
 * @throws IllegalArgumentException Throw exception in case of error.
 * @throws NoSuchMethodException Throw exception in case of error.
 * @throws InvocationTargetException Throw exception in case of error.
 */
public void testFilenames() throws IllegalAccessException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
  Method method=ConditionalMethods.class.getDeclaredMethod("String_Node_Str",String.class,String.class);
  method.setAccessible(true);
  List<String> results=new ArrayList<String>();
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  List<String> expected=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals(results,expected);
}

Fixed version (ground truth):
/** 
 * Test filenames.
 * @throws IllegalAccessException Throw exception in case of error.
 * @throws IllegalArgumentException Throw exception in case of error.
 * @throws NoSuchMethodException Throw exception in case of error.
 * @throws InvocationTargetException Throw exception in case of error.
 */
public void testFilenames() throws IllegalAccessException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException, NoSuchFieldException {
  Method method=ConditionalMethods.class.getDeclaredMethod("String_Node_Str",String.class,String.class);
  method.setAccessible(true);
  Field field=ConditionalMethods.class.getDeclaredField("String_Node_Str");
  field.setAccessible(true);
  field.set(null,"String_Node_Str");
  List<String> results=new ArrayList<String>();
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  results.add((String)method.invoke(this,"String_Node_Str","String_Node_Str"));
  List<String> expected=Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals(results,expected);
}
Program: 100908
Project: 100908
Buggy source:
/** 
 * Checks if file is valid.
 * @param filename The file name.
 * @param extensions A priority list of allowed extensions.
 * @return A boolean value to determine if the file is valid.
 */
private boolean checkFile(String filename,String[] extensions){
  boolean foundFile=false;
  for (  String currentExtension : extensions) {
    if (filename.toLowerCase().endsWith(currentExtension)) {
      foundFile=true;
      configuration.setChosenFilePattern(currentExtension);
      break;
    }
  }
  File fileStatus=null;
  if (foundFile) {
    fileStatus=new File(filename);
    if (fileStatus.exists()) {
      theFile=filename;
      fileReference=new File(theFile.substring(0,theFile.length() - 4));
      return true;
    }
 else {
      System.out.println("String_Node_Str" + filename + "String_Node_Str");
      return false;
    }
  }
 else {
    for (    String currentExtension : extensions) {
      fileStatus=new File(filename + currentExtension);
      if (fileStatus.exists()) {
        theFile=filename + currentExtension;
        fileReference=new File(theFile.substring(0,theFile.length() - 4));
        return true;
      }
    }
    System.out.println(AraraUtils.wrap(localization.getMessage("String_Node_Str",filename,getExtensionsList(extensions))));
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks if file is valid.
 * @param filename The file name.
 * @param extensions A priority list of allowed extensions.
 * @return A boolean value to determine if the file is valid.
 */
private boolean checkFile(String filename,String[] extensions){
  boolean foundFile=false;
  for (  String currentExtension : extensions) {
    if (filename.toLowerCase().endsWith(currentExtension)) {
      foundFile=true;
      configuration.setChosenFilePattern(currentExtension);
      break;
    }
  }
  File fileStatus=null;
  if (foundFile) {
    fileStatus=new File(filename);
    if (fileStatus.exists()) {
      theFile=filename;
      return true;
    }
 else {
      System.out.println(localization.getMessage("String_Node_Str",filename));
      return false;
    }
  }
 else {
    for (    String currentExtension : extensions) {
      fileStatus=new File(filename + currentExtension);
      if (fileStatus.exists()) {
        theFile=filename + currentExtension;
        configuration.setChosenFilePattern(currentExtension);
        return true;
      }
    }
    System.out.println(AraraUtils.wrap(localization.getMessage("String_Node_Str",filename,getExtensionsList(extensions))));
    return false;
  }
}
Program: 100909
Project: 100909
Buggy source:
/** 
 * Returns the collection of   {@link UriTemplateComponent} instancesfound in this template.
 * @return
 */
public Collection<UriTemplateComponent> getComponents(){
  return Collections.unmodifiableCollection(components);
}

Fixed version (ground truth):
/** 
 * <p> Returns the collection of   {@link UriTemplateComponent} instancesfound in this template. </p>
 * @return the collection of {@link UriTemplateComponent}s
 */
public Collection<UriTemplateComponent> getComponents(){
  return Collections.unmodifiableCollection(components);
}
Program: 100910
Project: 100910
Buggy source:
/** 
 * <p> Creates a new   {@link UriTemplate} from a root {@link UriTemplate}. This method will create a new   {@link UriTemplate} from the base and copy the variablesfrom the base template to the new  {@link UriTemplate}. </p> <p> This method is useful when the base template is less volatile than the child expression and you want to merge the two. </p>
 * @param baseTemplate
 * @return
 * @since 1.0
 */
public static UriTemplateBuilder fromTemplate(UriTemplate baseTemplate) throws MalformedUriTemplateException {
  return new UriTemplateBuilder(baseTemplate.getTemplate());
}

Fixed version (ground truth):
/** 
 * <p> This method is now deprecated. Use   {@link UriTemplate#buildFromTemplate(UriTemplate)} instead.</p>
 * @deprecated use {@link #buildFromTemplate(UriTemplate)}
 * @param baseTemplate
 * @return
 * @since 1.0
 */
@Deprecated public static UriTemplateBuilder fromTemplate(UriTemplate baseTemplate) throws MalformedUriTemplateException {
  return new UriTemplateBuilder(baseTemplate);
}
Program: 100911
Project: 100911
Buggy source:
/** 
 * @param sourceValue
 * @return the encoded string
 */
public static String encodeFragment(String sourceValue) throws UnsupportedEncodingException {
  return encode(sourceValue,ESCAPE_CHARS);
}

Fixed version (ground truth):
/** 
 * @param sourceValue
 * @return the encoded string
 */
public static String encodeFragment(String sourceValue) throws UnsupportedEncodingException {
  Matcher m=PCT_ENCODDED_STRING.matcher(sourceValue);
  List<int[]> positions=new ArrayList<int[]>();
  while (m.find()) {
    positions.add(new int[]{m.start(),m.end()});
  }
  if (!positions.isEmpty()) {
    StringBuilder b=new StringBuilder();
    int offset=0;
    for (    int[] pos : positions) {
      b.append(UriUtil.encode(sourceValue.substring(offset,pos[0]),ESCAPE_CHARS));
      b.append(sourceValue.substring(pos[0],pos[1]));
      offset=pos[1];
    }
    b.append(encode(sourceValue.substring(offset,sourceValue.length()),ESCAPE_CHARS));
    return b.toString();
  }
  return encode(sourceValue,ESCAPE_CHARS);
}
Program: 100912
Project: 100912
Buggy source:
/** 
 * A lite version of the introspection logic performed by the BeanInfo introspector.
 * @param method
 */
private void inspectGetters(Method method){
  String methodName=method.getName();
  int prefixLength=0;
  if (methodName.startsWith(GET_PREFIX)) {
    prefixLength=GET_PREFIX.length();
  }
  if (methodName.startsWith(IS_PREIX)) {
    prefixLength=IS_PREIX.length();
  }
  if (prefixLength == 0) {
    return;
  }
  String name=decapitalize(methodName.substring(prefixLength));
  if (!isValidProperty(name)) {
    return;
  }
  Class propertyType=method.getReturnType();
  if (propertyType == null || propertyType == void.class) {
    return;
  }
  if (prefixLength == 2) {
    if (!(propertyType == boolean.class)) {
      return;
    }
  }
  Class[] paramTypes=method.getParameterTypes();
  if (paramTypes.length > 1 || (paramTypes.length == 1 && paramTypes[0] != int.class)) {
    return;
  }
  if (!method.isAnnotationPresent(UriTransient.class) && !name.equals("String_Node_Str")) {
    Object value=getValue(method);
    if (method.isAnnotationPresent(VarName.class)) {
      name=method.getAnnotation(VarName.class).value();
    }
    if (value != null) {
      pairs.put(name,value);
    }
  }
}

Fixed version (ground truth):
/** 
 * A lite version of the introspection logic performed by the BeanInfo introspector.
 * @param method
 */
private void inspectGetters(Method method){
  String methodName=method.getName();
  int prefixLength=0;
  if (methodName.startsWith(GET_PREFIX)) {
    prefixLength=GET_PREFIX.length();
  }
  if (methodName.startsWith(IS_PREIX)) {
    prefixLength=IS_PREIX.length();
  }
  if (prefixLength == 0) {
    return;
  }
  String name=decapitalize(methodName.substring(prefixLength));
  if (!isValidProperty(name)) {
    return;
  }
  Class propertyType=method.getReturnType();
  if (propertyType == null || propertyType == void.class) {
    return;
  }
  if (prefixLength == 2) {
    if (!(propertyType == boolean.class)) {
      return;
    }
  }
  Class[] paramTypes=method.getParameterTypes();
  if (paramTypes.length > 1 || (paramTypes.length == 1 && paramTypes[0] != int.class)) {
    return;
  }
  if (!method.isAnnotationPresent(UriTransient.class) && !"String_Node_Str".equals(name)) {
    Object value=getValue(method);
    if (method.isAnnotationPresent(VarName.class)) {
      name=method.getAnnotation(VarName.class).value();
    }
    if (value != null) {
      pairs.put(name,value);
    }
  }
}
Program: 100913
Project: 100913
Buggy source:
/** 
 * @param operator
 * @param varSpec
 * @param variable
 * @param format
 * @return
 */
private String expandStringValue(Operator operator,VarSpec varSpec,String variable,VarSpec.VarFormat format) throws VariableExpansionException {
  String expanded;
  if (varSpec.getModifier() == Modifier.PREFIX) {
    int position=varSpec.getPosition();
    if (position < variable.length()) {
      variable=variable.substring(0,position);
    }
  }
  try {
    if (operator.getEncoding() == Encoding.UR) {
      expanded=UriUtil.encodeFragment(variable);
    }
 else {
      expanded=UriUtil.encode(variable);
    }
  }
 catch (  UnsupportedEncodingException e) {
    throw new VariableExpansionException("String_Node_Str",e);
  }
  if (operator.isNamed()) {
    if (expanded.isEmpty() && !operator.getSeparator().equals("String_Node_Str")) {
      expanded=varSpec.getValue();
    }
 else     if (format == VarSpec.VarFormat.SINGLE) {
      expanded=varSpec.getVariableName() + "String_Node_Str" + expanded;
    }
 else {
      if (varSpec.getModifier() == Modifier.EXPLODE) {
        if (operator.useVarNameWhenExploded() && format != VarSpec.VarFormat.PAIRS) {
          expanded=varSpec.getVariableName() + "String_Node_Str" + expanded;
        }
      }
    }
  }
  return expanded;
}

Fixed version (ground truth):
/** 
 * @param operator
 * @param varSpec
 * @param variable
 * @param format
 * @return
 */
private String expandStringValue(Operator operator,VarSpec varSpec,String variable,VarSpec.VarFormat format) throws VariableExpansionException {
  String expanded;
  if (varSpec.getModifier() == Modifier.PREFIX) {
    int position=varSpec.getPosition();
    if (position < variable.length()) {
      variable=variable.substring(0,position);
    }
  }
  try {
    if (operator.getEncoding() == Encoding.UR) {
      expanded=UriUtil.encodeFragment(variable);
    }
 else {
      expanded=UriUtil.encode(variable);
    }
  }
 catch (  UnsupportedEncodingException e) {
    throw new VariableExpansionException("String_Node_Str",e);
  }
  if (operator.isNamed()) {
    if (expanded.isEmpty() && !"String_Node_Str".equals(operator.getSeparator())) {
      expanded=varSpec.getValue();
    }
 else     if (format == VarSpec.VarFormat.SINGLE) {
      expanded=varSpec.getVariableName() + "String_Node_Str" + expanded;
    }
 else {
      if (varSpec.getModifier() == Modifier.EXPLODE) {
        if (operator.useVarNameWhenExploded() && format != VarSpec.VarFormat.PAIRS) {
          expanded=varSpec.getVariableName() + "String_Node_Str" + expanded;
        }
      }
    }
  }
  return expanded;
}
Program: 100914
Project: 100914
Buggy source:
/** 
 * Initializes the values from the object properties and constructs a map from those values.
 * @throws VarExploderException
 */
private void initValues() throws VarExploderException {
  Class<?> c=source.getClass();
  if (c.isAnnotation() || c.isArray() || c.isEnum()|| c.isPrimitive()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Method[] methods=c.getMethods();
  for (  Method method : methods) {
    inspectGetters(method);
  }
  scanFields(c);
}

Fixed version (ground truth):
/** 
 * Initializes the values from the object properties and constructs a map from those values.
 * @throws VarExploderException
 */
private void initValues() throws VarExploderException {
  Class<?> c=source.getClass();
  if (c.isAnnotation() || c.isArray() || c.isEnum()|| c.isPrimitive()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (source instanceof Map) {
    this.pairs=(Map)source;
    return;
  }
  Method[] methods=c.getMethods();
  for (  Method method : methods) {
    inspectGetters(method);
  }
  scanFields(c);
}
Program: 100915
Project: 100915
Buggy source:
private void initVariableName(){
  if (modifier != Modifier.NONE) {
    if (modifier == Modifier.PREFIX) {
      String[] values=getValue().split(Modifier.PREFIX.getValue());
      variableName=values[0];
    }
 else     if (modifier == Modifier.EXPLODE) {
      variableName=getValue().substring(0,getValue().length() - 1);
    }
  }
 else {
    variableName=getValue();
  }
}

Fixed version (ground truth):
private void initVariableName(){
  variableName=getValue();
  if (modifier != Modifier.NONE) {
    if (modifier == Modifier.PREFIX) {
      String[] values=getValue().split(Modifier.PREFIX.getValue());
      variableName=values[0];
    }
    if (modifier == Modifier.EXPLODE && getValue().lastIndexOf('*') != -1) {
      variableName=getValue().substring(0,getValue().length() - 1);
    }
  }
}
Program: 100916
Project: 100916
Buggy source:
/** 
 * Returns true of the object is: <ul> <li>a primitive type</li> <li>an instance of   {@link CharSequence}</li> <li>an instance of   {@link Number} <li><li>an instance of  {@link Date} <li></ul>
 * @param value
 * @return
 */
private boolean isSimpleType(Object value){
  if (value.getClass().isPrimitive() || value instanceof Number || value instanceof CharSequence|| value instanceof Date|| value instanceof Boolean) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true of the object is: <ul> <li>a primitive type</li> <li>an enum</li> <li>an instance of   {@link CharSequence}</li> <li>an instance of   {@link Number} <li><li>an instance of  {@link Date} <li><li>an instance of  {@link Boolean}</li> <li>an instance of   {@link UUID}</li> <li>an instance of   {@link Class}</li> </ul>
 * @param value
 * @return
 */
private boolean isSimpleType(Object value){
  if (value.getClass().isPrimitive() || value.getClass().isEnum() || value instanceof Class|| value instanceof Number|| value instanceof CharSequence|| value instanceof Date|| value instanceof Boolean|| value instanceof UUID) {
    return true;
  }
  return false;
}
Program: 100917
Project: 100917
Buggy source:
/** 
 * Returns the
 * @return
 */
protected Pattern getReverseMatchPattern(){
  if (this.reverseMatchPattern == null) {
    buildReverssMatchRegexFromComponents();
  }
  return this.reverseMatchPattern;
}

Fixed version (ground truth):
/** 
 * Returns the
 * @return
 */
protected Pattern getReverseMatchPattern(){
  if (this.reverseMatchPattern == null) {
    buildReverseMatchRegexFromComponents();
  }
  return this.reverseMatchPattern;
}
Program: 100918
Project: 100918
Buggy source:
/** 
 * <p> Creates a new   {@link UriTemplate} from a root {@link UriTemplate}. This method will create a new   {@link UriTemplate} from the base and copy the variablesfrom the base template to the new  {@link UriTemplate}. </p> <p> This method is useful when the base template is less volatile than the child expression and you want to merge the two. </p>
 * @param base
 * @return
 * @since 1.0
 */
public static UriTemplateBuilder fromTemplate(UriTemplate base) throws MalformedUriTemplateException {
  return new UriTemplateBuilder(base.getTemplate());
}

Fixed version (ground truth):
/** 
 * <p> Creates a new   {@link UriTemplate} from a root {@link UriTemplate}. This method will create a new   {@link UriTemplate} from the base and copy the variablesfrom the base template to the new  {@link UriTemplate}. </p> <p> This method is useful when the base template is less volatile than the child expression and you want to merge the two. </p>
 * @param baseTemplate
 * @return
 * @since 1.0
 */
public static UriTemplateBuilder fromTemplate(UriTemplate baseTemplate) throws MalformedUriTemplateException {
  return new UriTemplateBuilder(baseTemplate.getTemplate());
}
Program: 100919
Project: 100919
Buggy source:
public String expandPartial() throws VariableExpansionException {
  String template=getTemplate();
  for (  Expression expression : expressions) {
    final String replacement=expressionReplacementString(expression,true);
    template=template.replaceAll(expression.getReplacementPattern(),replacement);
  }
  return template;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws VariableExpansionException
 */
public String expandPartial() throws VariableExpansionException {
  String template=getTemplate();
  for (  Expression expression : expressions) {
    final String replacement=expressionReplacementString(expression,true);
    template=template.replaceAll(expression.getReplacementPattern(),replacement);
  }
  return template;
}
Program: 100920
Project: 100920
Buggy source:
/** 
 * <p> Creates a new   {@link UriTemplateBuilder} from a root {@link UriTemplate}. This method will create a new   {@link UriTemplate} from the base and copy the variablesfrom the base template to the new  {@link UriTemplate}. </p> <p> This method is useful when the base template is less volatile than the child expression and you want to merge the two. </p>
 * @param base
 * @return
 * @since 2.0
 */
public static UriTemplateBuilder buildFromTemplate(UriTemplate template) throws MalformedUriTemplateException {
  return new UriTemplateBuilder(template);
}

Fixed version (ground truth):
/** 
 * <p> Creates a new   {@link UriTemplateBuilder} from a root {@link UriTemplate}. This method will create a new   {@link UriTemplate} from the base and copy the variablesfrom the base template to the new  {@link UriTemplate}. </p> <p> This method is useful when the base template is less volatile than the child expression and you want to merge the two. </p>
 * @param baseTemplate
 * @return
 * @since 2.0
 */
public static UriTemplateBuilder buildFromTemplate(UriTemplate baseTemplate) throws MalformedUriTemplateException {
  return new UriTemplateBuilder(baseTemplate);
}
Program: 100921
Project: 100921
Buggy source:
/** 
 * @param soureValue
 * @param chars
 * @return
 * @throws UriEncodingException
 */
private static String encode(String sourceValue,BitSet chars) throws UriEncodingException {
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  try {
    byte[] source=sourceValue.getBytes(Charset.forName("String_Node_Str"));
    for (int i=0; i < source.length; i++) {
      byte c=source[i];
      if (chars.get(c) || c <= 0x20) {
        out.write('%');
        char hex1=Character.toUpperCase(Character.forDigit((c >> 4) & 0xF,16));
        char hex2=Character.toUpperCase(Character.forDigit(c & 0xF,16));
        out.write(hex1);
        out.write(hex2);
      }
 else {
        out.write(c);
      }
    }
    return new String(out.toByteArray(),"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new UriEncodingException(e);
  }
}

Fixed version (ground truth):
/** 
 * @param soureValue
 * @param chars
 * @return
 * @throws UriEncodingException
 */
private static String encode(String sourceValue,BitSet chars) throws UriEncodingException {
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  try {
    byte[] source=sourceValue.getBytes(Charset.forName("String_Node_Str"));
    for (int i=0; i < source.length; i++) {
      byte c=source[i];
      if (chars.get(c & 0xff) || c <= 0x20) {
        out.write('%');
        char hex1=Character.toUpperCase(Character.forDigit((c >> 4) & 0xF,16));
        char hex2=Character.toUpperCase(Character.forDigit(c & 0xF,16));
        out.write(hex1);
        out.write(hex2);
      }
 else {
        out.write(c);
      }
    }
    return new String(out.toByteArray(),"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new UriEncodingException(e);
  }
}
Program: 100922
Project: 100922
Buggy source:
/** 
 * @throws Exception
 */
@SuppressWarnings("String_Node_Str") @Test public void test() throws Exception {
  UriTemplate t=UriTemplate.fromExpression(template);
  String actual=t.expand(variables);
  if (expected instanceof String) {
    Assert.assertEquals(testsuite + "String_Node_Str" + template,expected,actual);
  }
 else   if (expected instanceof Collection) {
    List<String> combinations=(List<String>)expected;
    boolean match=false;
    for (    String combo : combinations) {
      if (combo.equalsIgnoreCase(actual)) {
        match=true;
        break;
      }
    }
    Assert.assertTrue(testsuite + "String_Node_Str" + template+ "String_Node_Str",match);
  }
}

Fixed version (ground truth):
/** 
 * @throws Exception
 */
@SuppressWarnings("String_Node_Str") @Test public void test() throws Exception {
  UriTemplate t=UriTemplate.fromExpression(template);
  String actual=t.expand(variables);
  if (expected instanceof String) {
    Assert.assertEquals(testsuite + "String_Node_Str" + template,expected,actual);
  }
 else   if (expected instanceof Collection) {
    List<String> combinations=(List<String>)expected;
    boolean match=false;
    for (    String combo : combinations) {
      if (combo.equalsIgnoreCase(actual)) {
        match=true;
        break;
      }
    }
    Assert.assertTrue(testsuite + "String_Node_Str" + template+ "String_Node_Str"+ actual+ "String_Node_Str",match);
  }
}
Program: 100923
Project: 100923
Buggy source:
/** 
 * FIXME Comment this
 * @param operator
 * @param varSpec
 * @param variable
 * @param format
 * @return
 */
private String expandStringValue(Op operator,VarSpec varSpec,String variable,VarFormat format){
  String expanded="String_Node_Str";
  if (varSpec.getModifier() == Modifier.PREFIX) {
    int position=varSpec.getPosition();
    if (position < variable.length()) {
      variable=variable.substring(0,position);
    }
  }
  try {
    if (operator == Op.NAME_LABEL || operator == Op.FRAGMENT || operator == Op.RESERVED) {
      expanded=variable.replaceAll("String_Node_Str","String_Node_Str");
    }
 else {
      expanded=urlCodec.encode(variable).replaceAll("String_Node_Str","String_Node_Str");
    }
  }
 catch (  EncoderException e) {
    throw new RuntimeException(e);
  }
  if (operator.useQueryString()) {
    if (expanded.isEmpty() && !operator.getJoiner().equals("String_Node_Str")) {
      expanded=varSpec.getValue();
    }
 else     if (format == VarFormat.SINGLE) {
      expanded=varSpec.getVariableName() + "String_Node_Str" + expanded;
    }
 else {
      if (expanded.isEmpty()) {
        expanded=varSpec.getValue();
      }
 else       if (varSpec.getModifier() == Modifier.EXPLODE) {
        if (operator.useVarNameWhenExploded() && format != VarFormat.PAIRS) {
          expanded=varSpec.getVariableName() + "String_Node_Str" + expanded;
        }
      }
    }
  }
  return expanded;
}

Fixed version (ground truth):
/** 
 * FIXME Comment this
 * @param operator
 * @param varSpec
 * @param variable
 * @param format
 * @return
 */
private String expandStringValue(Op operator,VarSpec varSpec,String variable,VarFormat format){
  String expanded="String_Node_Str";
  if (varSpec.getModifier() == Modifier.PREFIX) {
    int position=varSpec.getPosition();
    if (position < variable.length()) {
      variable=variable.substring(0,position);
    }
  }
  if (operator == Op.NAME_LABEL || operator == Op.RESERVED) {
    expanded=variable.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
  }
 else   if (operator == Op.FRAGMENT) {
    expanded=UriUtil.encodeUri(variable);
  }
 else {
    try {
      expanded=urlCodec.encode(variable).replaceAll("String_Node_Str","String_Node_Str");
    }
 catch (    EncoderException e) {
      throw new RuntimeException(e);
    }
  }
  if (operator.useQueryString()) {
    if (expanded.isEmpty() && !operator.getJoiner().equals("String_Node_Str")) {
      expanded=varSpec.getValue();
    }
 else     if (format == VarFormat.SINGLE) {
      expanded=varSpec.getVariableName() + "String_Node_Str" + expanded;
    }
 else {
      if (expanded.isEmpty()) {
        expanded=varSpec.getValue();
      }
 else       if (varSpec.getModifier() == Modifier.EXPLODE) {
        if (operator.useVarNameWhenExploded() && format != VarFormat.PAIRS) {
          expanded=varSpec.getVariableName() + "String_Node_Str" + expanded;
        }
      }
    }
  }
  return expanded;
}
Program: 100925
Project: 100925
Buggy source:
public void close() throws ZkInterruptedException {
  if (_connection == null) {
    return;
  }
  LOG.debug("String_Node_Str");
  getEventLock().lock();
  try {
    setShutdownTrigger(true);
    _eventThread.interrupt();
    _eventThread.join(2000);
    _connection.close();
    _connection=null;
  }
 catch (  InterruptedException e) {
    throw new ZkInterruptedException(e);
  }
 finally {
    getEventLock().unlock();
  }
  LOG.debug("String_Node_Str");
}

Fixed version (ground truth):
public void close() throws ZkInterruptedException {
  if (_connection == null) {
    return;
  }
  LOG.debug("String_Node_Str");
  getEventLock().lock();
  try {
    setShutdownTrigger(true);
    _eventThread.interrupt();
    _eventThread.join(2000);
    _connection.close();
    _connection=null;
    _eventThread=null;
  }
 catch (  InterruptedException e) {
    throw new ZkInterruptedException(e);
  }
 finally {
    getEventLock().unlock();
  }
  LOG.debug("String_Node_Str");
}
Program: 100926
Project: 100926
Buggy source:
public void connect(final long maxMsToWaitUntilConnected,Watcher watcher){
  boolean started=false;
  try {
    getEventLock().lockInterruptibly();
    setShutdownTrigger(false);
    _eventThread=new ZkEventThread(_connection.getServers());
    _eventThread.start();
    _connection.connect(watcher);
    LOG.debug("String_Node_Str" + maxMsToWaitUntilConnected);
    if (!waitUntilConnected(maxMsToWaitUntilConnected,TimeUnit.MILLISECONDS)) {
      throw new ZkTimeoutException(String.format("String_Node_Str",_connection.getServers(),maxMsToWaitUntilConnected));
    }
    started=true;
  }
 catch (  InterruptedException e) {
    States state=_connection.getZookeeperState();
    throw new IllegalStateException("String_Node_Str" + state);
  }
 finally {
    getEventLock().unlock();
    if (!started) {
      close();
    }
  }
}

Fixed version (ground truth):
public synchronized void connect(final long maxMsToWaitUntilConnected,Watcher watcher){
  if (_eventThread != null) {
    return;
  }
  boolean started=false;
  try {
    getEventLock().lockInterruptibly();
    setShutdownTrigger(false);
    _eventThread=new ZkEventThread(_connection.getServers());
    _eventThread.start();
    _connection.connect(watcher);
    LOG.debug("String_Node_Str" + maxMsToWaitUntilConnected);
    if (!waitUntilConnected(maxMsToWaitUntilConnected,TimeUnit.MILLISECONDS)) {
      throw new ZkTimeoutException(String.format("String_Node_Str",_connection.getServers(),maxMsToWaitUntilConnected));
    }
    started=true;
  }
 catch (  InterruptedException e) {
    States state=_connection.getZookeeperState();
    throw new IllegalStateException("String_Node_Str" + state);
  }
 finally {
    getEventLock().unlock();
    if (!started) {
      close();
    }
  }
}
Program: 100927
Project: 100927
Buggy source:
@Before public void setUp() throws Exception {
  this.server=startZkServer("String_Node_Str" + counter.incrementAndGet(),4711);
  this.client=this.server.getZkClient();
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  this.server=startZkServer("String_Node_Str" + counter.incrementAndGet(),4711);
  this.client=this.server.getZkClient();
  assertTrue(this.client.isConnected());
}
Program: 100928
Project: 100928
Buggy source:
public void setShutdownTrigger(boolean triggerState){
  _shutdownTriggered=triggerState;
}

Fixed version (ground truth):
private void setShutdownTrigger(boolean triggerState){
  _shutdownTriggered=triggerState;
}
Program: 100929
Project: 100929
Buggy source:
public void close() throws ZkInterruptedException {
  if (_connection == null) {
    return;
  }
  LOG.debug("String_Node_Str");
  getEventLock().lock();
  try {
    setShutdownTrigger(true);
    _eventThread.interrupt();
    _eventThread.join(2000);
    _connection.close();
    _connection=null;
    _eventThread=null;
  }
 catch (  InterruptedException e) {
    throw new ZkInterruptedException(e);
  }
 finally {
    getEventLock().unlock();
  }
  LOG.debug("String_Node_Str");
}

Fixed version (ground truth):
public synchronized void close() throws ZkInterruptedException {
  if (_eventThread == null) {
    return;
  }
  LOG.debug("String_Node_Str");
  getEventLock().lock();
  try {
    setShutdownTrigger(true);
    _currentState=null;
    _eventThread.interrupt();
    _eventThread.join(2000);
    _connection.close();
    _eventThread=null;
  }
 catch (  InterruptedException e) {
    throw new ZkInterruptedException(e);
  }
 finally {
    getEventLock().unlock();
  }
  LOG.debug("String_Node_Str");
}
Program: 100930
Project: 100930
Buggy source:
public boolean getShutdownTrigger(){
  return _shutdownTriggered;
}

Fixed version (ground truth):
private boolean getShutdownTrigger(){
  return _shutdownTriggered;
}