nus-yam/ex-repair huggingface dataset:
Program: 151551
Project: 151551
Buggy source:
@Test public void testInvokeCommand() throws Exception {
  final List<UIInput<?>> inputs=new ArrayList<UIInput<?>>();
  final UIBuilder builder=new UIBuilder(){
    @Override public UIBuilder add(    UIInput<?> input){
      inputs.add(input);
      return this;
    }
  }
;
  UIContext context=new UIContext(){
    @Override public UIBuilder getUIBuilder(){
      return builder;
    }
    @Override public <T>UISelection<T> getInitialSelection(){
      return null;
    }
  }
;
  command.initializeUI(context);
  command.getNamed().setValue("String_Node_Str");
  command.validate(new UIValidationContext(){
    @Override public UIBuilder getUIBuilder(){
      return builder;
    }
    @Override public void addValidationError(    UIInput<?> input,    String errorMessage){
    }
    @Override public <T>UISelection<T> getInitialSelection(){
      return null;
    }
  }
);
  DirectoryResource targetDirectory=command.getTargetLocation().getValue().getChildDirectory("String_Node_Str");
  Assert.assertFalse(targetDirectory.exists());
  command.execute(context);
  Assert.assertTrue(targetDirectory.exists());
  targetDirectory.delete(true);
}

Fixed version (ground truth):
@Test public void testInvokeCommand() throws Exception {
  final List<UIInputComponent<?,?>> inputs=new ArrayList<UIInputComponent<?,?>>();
  final UIBuilder builder=new UIBuilder(){
    @Override public UIBuilder add(    UIInputComponent<?,?> input){
      inputs.add(input);
      return this;
    }
  }
;
  UIContext context=new UIContext(){
    @Override public UIBuilder getUIBuilder(){
      return builder;
    }
    @Override public <T>UISelection<T> getInitialSelection(){
      return null;
    }
  }
;
  command.initializeUI(context);
  command.getNamed().setValue("String_Node_Str");
  command.validate(new UIValidationContext(){
    @Override public UIBuilder getUIBuilder(){
      return builder;
    }
    @Override public void addValidationError(    UIInputComponent<?,?> input,    String errorMessage){
    }
    @Override public <T>UISelection<T> getInitialSelection(){
      return null;
    }
  }
);
  DirectoryResource targetDirectory=command.getTargetLocation().getValue().getChildDirectory("String_Node_Str");
  Assert.assertFalse(targetDirectory.exists());
  command.execute(context);
  Assert.assertTrue(targetDirectory.exists());
  targetDirectory.delete(true);
}
Program: 151552
Project: 151552
Buggy source:
@Override public void addValidationError(UIInput<?> input,String errorMessage){
}

Fixed version (ground truth):
@Override public void addValidationError(UIInputComponent<?,?> input,String errorMessage){
}
Program: 151553
Project: 151553
Buggy source:
public void addValidationError(UIInput<?> input,String errorMessage);

Fixed version (ground truth):
public void addValidationError(UIInputComponent<?,?> input,String errorMessage);
Program: 151554
Project: 151554
Buggy source:
public static Class<?> unwrapProxyTypes(Class<?> type,ClassLoader... loaders){
  Class<?> result=type;
  if (isProxyType(result)) {
    Class<?> superclass=result.getSuperclass();
    while (superclass != null && !superclass.getName().equals(Object.class.getName()) && isProxyType(superclass)) {
      superclass=superclass.getSuperclass();
    }
    if (superclass != null && !superclass.getName().equals(Object.class.getName()))     return superclass;
    for (    ClassLoader loader : loaders) {
      try {
        if (result.getName().contains("String_Node_Str")) {
          String typeName=result.getName().replaceAll("String_Node_Str","String_Node_Str");
          result=loader.loadClass(typeName);
          break;
        }
 else         if (result.getName().contains("String_Node_Str")) {
          String typeName=result.getName().replaceAll("String_Node_Str","String_Node_Str");
          result=loader.loadClass(typeName);
          break;
        }
      }
 catch (      ClassNotFoundException e) {
      }
    }
  }
  return result;
}

Fixed version (ground truth):
public static Class<?> unwrapProxyTypes(Class<?> type,ClassLoader... loaders){
  Class<?> result=type;
  if (isProxyType(result)) {
    Class<?> superclass=result.getSuperclass();
    while (superclass != null && !superclass.getName().equals(Object.class.getName()) && isProxyType(superclass)) {
      superclass=superclass.getSuperclass();
    }
    if (superclass != null && !superclass.getName().equals(Object.class.getName()))     return superclass;
    String typeName=unwrapProxyClassName(result);
    for (    ClassLoader loader : loaders) {
      try {
        result=loader.loadClass(typeName);
        break;
      }
 catch (      ClassNotFoundException e) {
      }
    }
  }
  return result;
}
Program: 151555
Project: 151555
Buggy source:
@Override public Object call() throws Exception {
  try {
    convertParameterValues(args,method);
    return method.invoke(delegate,args);
  }
 catch (  Throwable e) {
    throw new ContainerException("String_Node_Str" + delegate.getClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str"+ loader+ "String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public Object call() throws Exception {
  try {
    return method.invoke(delegate,args);
  }
 catch (  Throwable e) {
    throw new ContainerException("String_Node_Str" + delegate.getClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str"+ loader+ "String_Node_Str",e);
  }
}
Program: 151556
Project: 151556
Buggy source:
@Override public Object intercept(final Object obj,final Method method,final Object[] args,final MethodProxy proxy) throws Throwable {
  Callable<Object> task=new Callable<Object>(){
    @Override public Object call() throws Exception {
      try {
        convertParameterValues(args,method);
        return method.invoke(delegate,args);
      }
 catch (      Throwable e) {
        throw new ContainerException("String_Node_Str" + delegate.getClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str"+ loader+ "String_Node_Str",e);
      }
    }
  }
;
  return ClassLoaders.executeIn(loader,task);
}

Fixed version (ground truth):
@Override public Object intercept(final Object obj,final Method method,final Object[] args,final MethodProxy proxy) throws Throwable {
  Callable<Object> task=new Callable<Object>(){
    @Override public Object call() throws Exception {
      try {
        return method.invoke(delegate,args);
      }
 catch (      Throwable e) {
        throw new ContainerException("String_Node_Str" + delegate.getClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str"+ loader+ "String_Node_Str",e);
      }
    }
  }
;
  return ClassLoaders.executeIn(loader,task);
}
Program: 151557
Project: 151557
Buggy source:
@SuppressWarnings("String_Node_Str") public Object get(final InjectionPoint injectionPoint){
  Callable<Object> task=new Callable<Object>(){
    @Override public Object call() throws Exception {
      Bean<R> bean=(Bean<R>)manager.resolve(manager.getBeans(actualType));
      context=manager.createCreationalContext(bean);
      Object delegate=manager.getInjectableReference(injectionPoint,context);
      return Enhancer.create(requestedType,new RemoteClassLoaderInterceptor(loader,delegate));
    }
  }
;
  return ClassLoaders.executeIn(loader,task);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object get(final InjectionPoint injectionPoint){
  Callable<Object> task=new Callable<Object>(){
    @Override public Object call() throws Exception {
      Bean<R> bean=(Bean<R>)manager.resolve(manager.getBeans(actualType));
      context=manager.createCreationalContext(bean);
      Object delegate=manager.getInjectableReference(injectionPoint,context);
      return Enhancer.create(requestedType,new RemoteClassLoaderInterceptor(loader,delegate));
    }
  }
;
  return (R)ClassLoaders.executeIn(loader,task);
}
Program: 151558
Project: 151558
Buggy source:
public void processRemotes(@Observes ProcessAnnotatedType<?> event) throws InstantiationException, IllegalAccessException {
  Class<?> type=event.getAnnotatedType().getJavaClass();
  if (Annotations.isAnnotationPresent(type,Exported.class)) {
    if (type.getClassLoader().equals(Thread.currentThread().getContextClassLoader())) {
      services.put(event.getAnnotatedType().getJavaClass(),event.getAnnotatedType());
    }
  }
}

Fixed version (ground truth):
public void processRemotes(@Observes ProcessAnnotatedType<?> event) throws InstantiationException, IllegalAccessException {
  Class<?> type=event.getAnnotatedType().getJavaClass();
  if (Annotations.isAnnotationPresent(type,Exported.class) && !(Modifier.isAbstract(type.getModifiers()) || Modifier.isInterface(type.getModifiers()))) {
    if (type.getClassLoader().equals(Thread.currentThread().getContextClassLoader())) {
      services.put(event.getAnnotatedType().getJavaClass(),event.getAnnotatedType());
    }
  }
}
Program: 151559
Project: 151559
Buggy source:
/** 
 * @param requestedType interface
 * @param actualType Implementation
 * @return
 */
private <T>ExportedInstance<T> getExportedInstance(Class<T> requestedType,Class<T> actualType){
  Assert.notNull(requestedType,"String_Node_Str");
  Assert.notNull(actualType,"String_Node_Str");
  Addons.waitUntilStarted(addon);
  final Class<T> requestedLoadedType;
  final Class<? extends T> actualLoadedType;
  try {
    requestedLoadedType=loadAddonClass(requestedType);
  }
 catch (  ClassNotFoundException cnfe) {
    log.fine("String_Node_Str" + requestedType.getName() + "String_Node_Str");
    return null;
  }
  try {
    actualLoadedType=loadAddonClass(actualType);
  }
 catch (  ClassNotFoundException cnfe) {
    log.fine("String_Node_Str" + actualType.getName() + "String_Node_Str");
    return null;
  }
  try {
    ExportedInstance<T> result=null;
    if (!manager.getBeans(requestedLoadedType).isEmpty()) {
      result=new ExportedInstanceImpl<T>(addon.getClassLoader(),manager,requestedLoadedType,actualLoadedType);
    }
    return result;
  }
 catch (  Exception e) {
    throw new ContainerException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * @param requestedType interface
 * @param actualType Implementation
 * @return
 */
@SuppressWarnings("String_Node_Str") private <T>ExportedInstance<T> getExportedInstance(Class<T> requestedType,Class<T> actualType){
  Assert.notNull(requestedType,"String_Node_Str");
  Assert.notNull(actualType,"String_Node_Str");
  Addons.waitUntilStarted(addon);
  final Class<T> requestedLoadedType;
  final Class<? extends T> actualLoadedType;
  try {
    requestedLoadedType=loadAddonClass(requestedType);
  }
 catch (  ClassNotFoundException cnfe) {
    log.fine("String_Node_Str" + requestedType.getName() + "String_Node_Str");
    return null;
  }
  try {
    actualLoadedType=loadAddonClass(actualType);
  }
 catch (  ClassNotFoundException cnfe) {
    log.fine("String_Node_Str" + actualType.getName() + "String_Node_Str");
    return null;
  }
  try {
    ExportedInstance<T> result=null;
    Set<Bean<?>> beans=manager.getBeans(requestedLoadedType);
    if (!beans.isEmpty()) {
      result=new ExportedInstanceImpl<T>(addon.getClassLoader(),manager,(Bean<T>)manager.resolve(beans),requestedLoadedType,actualLoadedType);
    }
    return result;
  }
 catch (  Exception e) {
    throw new ContainerException("String_Node_Str",e);
  }
}
Program: 151560
Project: 151560
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public <T>Set<ExportedInstance<T>> getExportedInstances(Class<T> requestedType){
  Addons.waitUntilStarted(addon);
  Set<ExportedInstance<T>> result=new HashSet<ExportedInstance<T>>();
  Class<T> requestedLoadedType;
  try {
    requestedLoadedType=loadAddonClass(requestedType);
  }
 catch (  ClassNotFoundException e) {
    return result;
  }
  for (  Class<?> type : services) {
    if (requestedLoadedType.isAssignableFrom(type)) {
      Class<? extends T> assignableClass=(Class<? extends T>)type;
      result.add(new ExportedInstanceImpl<T>(addon.getClassLoader(),manager,requestedLoadedType,assignableClass));
    }
  }
  return result;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public <T>Set<ExportedInstance<T>> getExportedInstances(Class<T> requestedType){
  Addons.waitUntilStarted(addon);
  Set<ExportedInstance<T>> result=new HashSet<ExportedInstance<T>>();
  Class<T> requestedLoadedType;
  try {
    requestedLoadedType=loadAddonClass(requestedType);
  }
 catch (  ClassNotFoundException e) {
    return result;
  }
  for (  Class<?> type : services) {
    if (requestedLoadedType.isAssignableFrom(type)) {
      Set<Bean<?>> beans=manager.getBeans(type);
      Class<? extends T> assignableClass=(Class<? extends T>)type;
      result.add(new ExportedInstanceImpl<T>(addon.getClassLoader(),manager,(Bean<T>)manager.resolve(beans),requestedLoadedType,assignableClass));
    }
  }
  return result;
}
Program: 151561
Project: 151561
Buggy source:
public ExportedInstanceImpl(ClassLoader loader,BeanManager manager,Class<R> requestedType,Class<? extends R> actualType){
  this.loader=loader;
  this.manager=manager;
  this.requestedType=requestedType;
  this.actualType=actualType;
}

Fixed version (ground truth):
public ExportedInstanceImpl(ClassLoader loader,BeanManager manager,Bean<R> requestedBean,Class<R> requestedType,Class<? extends R> actualType){
  this.loader=loader;
  this.manager=manager;
  this.requestedBean=requestedBean;
  this.requestedType=requestedType;
  this.actualType=actualType;
}
Program: 151562
Project: 151562
Buggy source:
@Override public Object call() throws Exception {
  try {
    return method.invoke(delegate,args);
  }
 catch (  Throwable e) {
    throw new ContainerException("String_Node_Str" + delegate.getClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str"+ loader+ "String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public Object call() throws Exception {
  try {
    convertParameterValues(args,method);
    return method.invoke(delegate,args);
  }
 catch (  Throwable e) {
    throw new ContainerException("String_Node_Str" + delegate.getClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str"+ loader+ "String_Node_Str",e);
  }
}
Program: 151563
Project: 151563
Buggy source:
@Override public Object intercept(final Object obj,final Method method,final Object[] args,final MethodProxy proxy) throws Throwable {
  Callable<Object> task=new Callable<Object>(){
    @Override public Object call() throws Exception {
      try {
        return method.invoke(delegate,args);
      }
 catch (      Throwable e) {
        throw new ContainerException("String_Node_Str" + delegate.getClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str"+ loader+ "String_Node_Str",e);
      }
    }
  }
;
  return ClassLoaders.executeIn(loader,task);
}

Fixed version (ground truth):
@Override public Object intercept(final Object obj,final Method method,final Object[] args,final MethodProxy proxy) throws Throwable {
  Callable<Object> task=new Callable<Object>(){
    @Override public Object call() throws Exception {
      try {
        convertParameterValues(args,method);
        return method.invoke(delegate,args);
      }
 catch (      Throwable e) {
        throw new ContainerException("String_Node_Str" + delegate.getClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str"+ loader+ "String_Node_Str",e);
      }
    }
  }
;
  return ClassLoaders.executeIn(loader,task);
}
Program: 151564
Project: 151564
Buggy source:
@SuppressWarnings("String_Node_Str") public Object get(final InjectionPoint injectionPoint){
  Callable<Object> task=new Callable<Object>(){
    @Override public Object call() throws Exception {
      Bean<R> bean=(Bean<R>)manager.resolve(manager.getBeans(actualType));
      context=manager.createCreationalContext(bean);
      Object delegate=manager.getInjectableReference(injectionPoint,context);
      return Enhancer.create(requestedType,new RemoteClassLoaderInterceptor(loader,delegate));
    }
  }
;
  return (R)ClassLoaders.executeIn(loader,task);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object get(final InjectionPoint injectionPoint){
  Callable<Object> task=new Callable<Object>(){
    @Override public Object call() throws Exception {
      Bean<R> bean=(Bean<R>)manager.resolve(manager.getBeans(actualType));
      context=manager.createCreationalContext(bean);
      Object delegate=manager.getInjectableReference(injectionPoint,context);
      return Enhancer.create(requestedType,new RemoteClassLoaderInterceptor(loader,delegate));
    }
  }
;
  return ClassLoaders.executeIn(loader,task);
}
Program: 151566
Project: 151566
Buggy source:
public static Class<?>[] getCompatibleClassHierarchy(ClassLoader loader,Class<?> origin){
  Set<Class<?>> hierarchy=new LinkedHashSet<Class<?>>();
  Class<?> baseClass=origin;
  while (Modifier.isFinal(baseClass.getModifiers())) {
    baseClass=baseClass.getSuperclass();
  }
  if (ClassLoaders.containsClass(loader,baseClass) && !Object.class.equals(baseClass) && isInstantiable(baseClass)) {
    hierarchy.add(ClassLoaders.loadClass(loader,baseClass));
  }
  baseClass=origin;
  while (baseClass != null) {
    for (    Class<?> type : baseClass.getInterfaces()) {
      if (ClassLoaders.containsClass(loader,type))       hierarchy.add(ClassLoaders.loadClass(loader,type));
    }
    baseClass=baseClass.getSuperclass();
  }
  return hierarchy.toArray(new Class<?>[hierarchy.size()]);
}

Fixed version (ground truth):
public static Class<?>[] getCompatibleClassHierarchy(ClassLoader loader,Class<?> origin){
  Set<Class<?>> hierarchy=new LinkedHashSet<Class<?>>();
  Class<?> baseClass=origin;
  while (Modifier.isFinal(baseClass.getModifiers())) {
    baseClass=baseClass.getSuperclass();
  }
  if (ClassLoaders.containsClass(loader,baseClass) && !Object.class.equals(baseClass) && (isInstantiable(baseClass) || baseClass.isInterface())) {
    hierarchy.add(ClassLoaders.loadClass(loader,baseClass));
  }
  baseClass=origin;
  while (baseClass != null) {
    for (    Class<?> type : baseClass.getInterfaces()) {
      if (ClassLoaders.containsClass(loader,type))       hierarchy.add(ClassLoaders.loadClass(loader,type));
    }
    baseClass=baseClass.getSuperclass();
  }
  return hierarchy.toArray(new Class<?>[hierarchy.size()]);
}
Program: 151567
Project: 151567
Buggy source:
@Override public void run(){
  ClassLoaders.executeIn(loader,new Callable<Object>(){
    @Override public Object call() throws Exception {
      forge=ServiceLoader.load(Forge.class).iterator().next();
      forge.setServerMode(true).setAddonDir(addonDir).start();
      return forge;
    }
  }
);
}

Fixed version (ground truth):
@Override public void run(){
  ClassLoaders.executeIn(loader,new Callable<Object>(){
    @Override public Object call() throws Exception {
      forge=new ForgeImpl();
      forge.setServerMode(true).setAddonDir(addonDir).start(loader);
      return forge;
    }
  }
);
}
Program: 151568
Project: 151568
Buggy source:
@Override public Object call() throws Exception {
  forge=ServiceLoader.load(Forge.class).iterator().next();
  forge.setServerMode(true).setAddonDir(addonDir).start();
  return forge;
}

Fixed version (ground truth):
@Override public Object call() throws Exception {
  forge=new ForgeImpl();
  forge.setServerMode(true).setAddonDir(addonDir).start(loader);
  return forge;
}
Program: 151569
Project: 151569
Buggy source:
@Override protected void configure(ModuleLoader loader,Builder builder){
  builder.addDependency(DependencySpec.createSystemDependencySpec(PathFilters.acceptAll(),PathFilters.any(Arrays.asList(PathFilters.is("String_Node_Str"),PathFilters.isChildOf("String_Node_Str"),PathFilters.is("String_Node_Str"),PathFilters.isChildOf("String_Node_Str"))),systemPaths));
}

Fixed version (ground truth):
@Override protected void configure(ModuleLoader loader,Builder builder){
  builder.addDependency(DependencySpec.createSystemDependencySpec(PathFilters.acceptAll(),PathFilters.any(Arrays.asList(PathFilters.is("String_Node_Str"),PathFilters.is("String_Node_Str"),PathFilters.isChildOf("String_Node_Str"),PathFilters.is("String_Node_Str"),PathFilters.isChildOf("String_Node_Str"))),systemPaths));
}
Program: 151570
Project: 151570
Buggy source:
@Override public boolean accept(DependencyNode node){
  Coordinate coordinate=node.getDependency().getCoordinate();
  return "String_Node_Str".equals(coordinate.getGroupId()) && "String_Node_Str".equals(coordinate.getArtifactId());
}

Fixed version (ground truth):
@Override public boolean accept(DependencyNode node){
  return Dependencies.isForgeAddon(node.getDependency().getCoordinate()) && !node.getDependency().isOptional();
}
Program: 151571
Project: 151571
Buggy source:
private void deploy(AddonId addon,DependencyNode root){
  List<File> resourceJars=toResourceJars(Dependencies.select(root,LocalResourceFilter.INSTANCE));
  List<AddonDependency> addonDependencies=toAddonDependencies(Dependencies.select(root,new DirectAddonFilter(root)));
  repository.deploy(addon,addonDependencies,resourceJars);
}

Fixed version (ground truth):
private void deploy(AddonId addon,DependencyNode root){
  List<File> resourceJars=toResourceJars(Dependencies.select(root,new LocalResourceFilter(root)));
  List<AddonDependency> addonDependencies=toAddonDependencies(Dependencies.select(root,new DirectAddonFilter(root)));
  repository.deploy(addon,addonDependencies,resourceJars);
}
Program: 151572
Project: 151572
Buggy source:
protected AbstractResource(final ResourceFactory factory,final Resource<?> parent){
  this.resourceFactory=factory;
  this.parent=parent;
}

Fixed version (ground truth):
protected AbstractResource(final ResourceFactory factory,final Resource<?> parent){
  if (factory == null)   throw new IllegalArgumentException("String_Node_Str");
  this.resourceFactory=factory;
  this.parent=parent;
}
Program: 151573
Project: 151573
Buggy source:
public static RegisteredAddonFilter allWaiting(){
  return new RegisteredAddonFilter(){
    @Override public boolean accept(    RegisteredAddon addon){
      return Status.STARTED.equals(addon.getStatus());
    }
  }
;
}

Fixed version (ground truth):
public static RegisteredAddonFilter allWaiting(){
  return new RegisteredAddonFilter(){
    @Override public boolean accept(    RegisteredAddon addon){
      return Status.WAITING.equals(addon.getStatus());
    }
  }
;
}
Program: 151575
Project: 151575
Buggy source:
@Command(value="String_Node_Str",help="String_Node_Str") public void installFromIndex(@Option(description="String_Node_Str",completer=IndexPluginNameCompleter.class) final String pluginName,@Option(name="String_Node_Str",description="String_Node_Str") final String version,final ShellPrintWriter out) throws Exception {
  List<PluginRef> plugins=getPluginRefs(pluginName);
  if (plugins.isEmpty()) {
    throw new RuntimeException("String_Node_Str" + pluginName + "String_Node_Str");
  }
  PluginRef ref=plugins.get(0);
  if (plugins.size() > 1) {
    boolean found=false;
    for (    PluginRef pluginRef : plugins) {
      if (pluginName.equals(pluginRef.getName())) {
        ref=pluginRef;
        found=true;
      }
    }
    if (!found)     throw new RuntimeException("String_Node_Str" + pluginName + "String_Node_Str");
  }
  installPlugin(version,out,ref);
}

Fixed version (ground truth):
@Command(value="String_Node_Str",help="String_Node_Str") public void installFromIndex(@Option(description="String_Node_Str",completer=IndexPluginNameCompleter.class) final String pluginName,@Option(name="String_Node_Str",description="String_Node_Str") final String version,final PipeOut out) throws Exception {
  List<PluginRef> plugins=PluginUtil.findPlugin(shell,configuration,pluginName);
  if (plugins.isEmpty()) {
    throw new RuntimeException("String_Node_Str" + pluginName + "String_Node_Str");
  }
 else   if (plugins.size() > 1) {
    throw new RuntimeException("String_Node_Str" + pluginName + "String_Node_Str");
  }
 else {
    PluginRef ref=plugins.get(0);
    ShellMessages.info(out,"String_Node_Str" + ref.getName());
    if (!ref.isGit()) {
      installFromMvnRepos(ref.getArtifact(),out,new DependencyRepositoryImpl("String_Node_Str",ref.getHomeRepo()));
    }
 else     if (ref.isGit()) {
      installFromGit(ref.getGitRepo(),Strings.isNullOrEmpty(version) ? ref.getGitRef() : version,null,out);
    }
  }
}
Program: 151578
Project: 151578
Buggy source:
@Command(value="String_Node_Str",help="String_Node_Str") public void find(@Option(description="String_Node_Str") final String searchString,final PipeOut out) throws Exception {
  List<PluginRef> pluginList=getPluginRefs(searchString);
  if (!pluginList.isEmpty()) {
    out.println();
  }
  for (  PluginRef ref : pluginList) {
    displayPluginDetails(out,ref);
  }
}

Fixed version (ground truth):
@Command(value="String_Node_Str",help="String_Node_Str") public void find(@Option(description="String_Node_Str") final String searchString,final PipeOut out) throws Exception {
  List<PluginRef> pluginList=PluginUtil.findPlugin(shell,configuration,searchString);
  if (!pluginList.isEmpty()) {
    out.println();
  }
  for (  PluginRef ref : pluginList) {
    out.println("String_Node_Str" + out.renderColor(ShellColor.BOLD,ref.getName()) + "String_Node_Str"+ ref.getArtifact()+ "String_Node_Str");
    out.println("String_Node_Str" + ref.getAuthor());
    out.println("String_Node_Str" + ref.getWebsite());
    out.println("String_Node_Str" + ref.getLocation());
    out.println("String_Node_Str" + ref.getTags());
    out.println("String_Node_Str" + ref.getDescription());
    out.println();
  }
}
Program: 151580
Project: 151580
Buggy source:
@Override public Import addImport(final String className){
  Import imprt;
  String simpleName=Types.toSimpleName(className);
  if (!hasImport(simpleName) && validImport(className)) {
    imprt=new ImportImpl(this).setName(className);
    unit.imports().add(imprt.getInternal());
  }
 else   if (hasImport(className)) {
    imprt=getImport(className);
  }
 else {
    if (hasImport(simpleName)) {
      throw new IllegalStateException("String_Node_Str" + className + "String_Node_Str"+ getImport(simpleName)+ "String_Node_Str");
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + className + "String_Node_Str");
    }
  }
  return imprt;
}

Fixed version (ground truth):
@Override public Import addImport(final String className){
  Import imprt;
  if (Types.isSimpleName(className) && !hasImport(className)) {
    throw new IllegalArgumentException("String_Node_Str" + className + "String_Node_Str");
  }
  if (!hasImport(className) && validImport(className)) {
    imprt=new ImportImpl(this).setName(className);
    unit.imports().add(imprt.getInternal());
  }
 else   if (hasImport(className)) {
    imprt=getImport(className);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + className + "String_Node_Str");
  }
  return imprt;
}
Program: 151581
Project: 151581
Buggy source:
@Test public void testGetInterfaces() throws Exception {
  this.source.addInterface(Serializable.class);
  this.source.addInterface("String_Node_Str");
  this.source.addInterface("String_Node_Str");
  assertEquals(3,this.source.getInterfaces().size());
  assertTrue(this.source.hasInterface("String_Node_Str"));
  assertTrue(this.source.hasInterface("String_Node_Str"));
  assertTrue(this.source.hasImport(Serializable.class));
  assertTrue(this.source.hasImport("String_Node_Str"));
  assertFalse(this.source.hasImport("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testGetInterfaces() throws Exception {
  this.source.addInterface(Serializable.class);
  this.source.addInterface("String_Node_Str");
  this.source.addInterface("String_Node_Str");
  assertEquals(3,this.source.getInterfaces().size());
  assertTrue(this.source.hasInterface("String_Node_Str"));
  assertTrue(this.source.hasInterface("String_Node_Str"));
  assertTrue(this.source.hasImport(Serializable.class));
  assertTrue(this.source.hasImport("String_Node_Str"));
  assertTrue(this.source.hasImport("String_Node_Str"));
}
Program: 151582
Project: 151582
Buggy source:
@Override public final synchronized List<Resource<?>> listResources(final ResourceFilter filter){
  List<Resource<?>> result=new ArrayList<Resource<?>>();
  for (  Resource<?> resource : doListResources()) {
    if (filter.accept(resource)) {
      result.add(resource);
    }
  }
  Collections.sort(result,new FQNResourceComparator());
  return result;
}

Fixed version (ground truth):
@Override public synchronized List<Resource<?>> listResources(final ResourceFilter filter){
  List<Resource<?>> result=new ArrayList<Resource<?>>();
  for (  Resource<?> resource : doListResources()) {
    if (filter.accept(resource)) {
      result.add(resource);
    }
  }
  Collections.sort(result,new FQNResourceComparator());
  return result;
}
Program: 151583
Project: 151583
Buggy source:
@Override public final synchronized List<Resource<?>> listResources(final ResourceFilter filter){
  List<Resource<?>> result=new ArrayList<Resource<?>>();
  for (  Resource<?> resource : doListResources()) {
    if (filter.accept(resource)) {
      result.add(resource);
    }
  }
  Collections.sort(result,new FQNResourceComparator());
  return result;
}

Fixed version (ground truth):
@Override public synchronized List<Resource<?>> listResources(final ResourceFilter filter){
  List<Resource<?>> result=new ArrayList<Resource<?>>();
  for (  Resource<?> resource : doListResources()) {
    if (filter.accept(resource)) {
      result.add(resource);
    }
  }
  Collections.sort(result,new FQNResourceComparator());
  return result;
}
Program: 151584
Project: 151584
Buggy source:
private void initReaderAndStreams() throws IOException {
  if (inputPipe == null) {
    inputPipe=new ConsoleInputSession(System.in);
  }
  if (outputStream == null) {
    outputStream=System.out;
  }
  Terminal terminal;
  if (Boolean.getBoolean("String_Node_Str")) {
    terminal=new IdeTerminal();
  }
 else   if (OSUtils.isWindows()) {
    final OutputStream ansiOut=AnsiConsole.wrapOutputStream(outputStream);
    final OutputStreamWriter writer=new OutputStreamWriter(ansiOut,System.getProperty("String_Node_Str",System.getProperty("String_Node_Str")));
    outputStream=new OutputStream(){
      @Override public void write(      int b) throws IOException {
        writer.write(b);
      }
    }
;
    TerminalFactory.configure(TerminalFactory.Type.WINDOWS);
    terminal=TerminalFactory.get();
  }
 else {
    terminal=TerminalFactory.get();
  }
  this.screenBuffer=new JLineScreenBuffer(terminal,outputStream);
  this.reader=new ConsoleReader(inputPipe.getExternalInputStream(),screenBuffer,null,terminal);
  this.reader.setHistoryEnabled(true);
  this.reader.setBellEnabled(false);
  for (  TriggeredAction action : triggeredActions) {
    this.reader.addTriggeredAction(action.getTrigger(),action.getListener());
  }
}

Fixed version (ground truth):
private void initReaderAndStreams() throws IOException {
  if (inputPipe == null) {
    inputPipe=new ConsoleInputSession(System.in);
  }
  if (outputStream == null) {
    outputStream=System.out;
  }
  Terminal terminal;
  if (Boolean.getBoolean("String_Node_Str")) {
    terminal=new IdeTerminal();
  }
 else   if (OSUtils.isWindows()) {
    final OutputStream ansiOut=AnsiConsole.wrapOutputStream(outputStream);
    final OutputStreamWriter writer=new OutputStreamWriter(ansiOut,System.getProperty("String_Node_Str",System.getProperty("String_Node_Str")));
    outputStream=new OutputStream(){
      @Override public void write(      int b) throws IOException {
        writer.write(b);
      }
    }
;
    TerminalFactory.configure(TerminalFactory.Type.WINDOWS);
    terminal=TerminalFactory.get();
  }
 else {
    terminal=TerminalFactory.get();
  }
  this.screenBuffer=new JLineScreenBuffer(terminal,outputStream);
  this.reader=new ConsoleReader(inputPipe.getExternalInputStream(),this,null,terminal);
  this.reader.setHistoryEnabled(true);
  this.reader.setBellEnabled(false);
  for (  TriggeredAction action : triggeredActions) {
    this.reader.addTriggeredAction(action.getTrigger(),action.getListener());
  }
}
Program: 151586
Project: 151586
Buggy source:
@Override public boolean complete(final ConsoleReader reader,final List<CharSequence> candidates,final int pos) throws IOException {
  CursorBuffer buf=reader.getCursorBuffer();
  PluginCommandCompleterState state=commandHolder.getState();
  if (state != null) {
    if (((candidates.size() == 1) && "String_Node_Str".equals(candidates.get(0))) || (state.isDuplicateBuffer() && state.isFinalTokenComplete())) {
      if (commandHolder.getState().getOption() != null) {
        OptionMetadata option=commandHolder.getState().getOption();
        reader.println();
        reader.println(option.getOptionDescriptor());
        if (candidates.size() == 1) {
          reader.println();
          reader.drawLine();
          return true;
        }
      }
    }
  }
  if (candidates.size() == 1) {
    CharSequence value=candidates.get(0);
    if (value.equals(buf.toString())) {
      return false;
    }
    setBuffer(reader,value,pos);
    return true;
  }
 else   if (candidates.size() > 1) {
    String value=getUnambiguousCompletions(candidates);
    setBuffer(reader,value,pos);
  }
  printCandidates(reader,candidates);
  reader.drawLine();
  return true;
}

Fixed version (ground truth):
@Override public boolean complete(final ConsoleReader reader,final List<CharSequence> candidates,final int pos) throws IOException {
  CursorBuffer buf=reader.getCursorBuffer();
  PluginCommandCompleterState state=commandHolder.getState();
  if (state != null) {
    if (((candidates.size() == 1) && "String_Node_Str".equals(candidates.get(0))) || (state.isDuplicateBuffer() && state.isFinalTokenComplete())) {
      if (commandHolder.getState().getOption() != null) {
        OptionMetadata option=commandHolder.getState().getOption();
        reader.println();
        reader.println(option.getOptionDescriptor());
        if (candidates.size() == 1) {
          reader.println();
          reader.drawLine();
          return true;
        }
      }
    }
  }
  if (candidates.size() == 1) {
    CharSequence value=candidates.get(0);
    if (value.equals(buf.toString())) {
      return false;
    }
    setBuffer(reader,value,pos);
    return true;
  }
 else   if (candidates.size() > 1) {
    String value=getUnambiguousCompletions(candidates);
    setBuffer(reader,value,pos);
  }
  printCandidates(reader,candidates);
  reader.drawLine();
  reader.flush();
  return true;
}
Program: 151587
Project: 151587
Buggy source:
public void run(){
  while (!interrupted()) {
    try {
      BufferManager out=getOutput();
      out.write(fullPrompt);
      out.flushBuffer();
      sleep(3);
    }
 catch (    InterruptedException e) {
      return;
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (!interrupted()) {
    try {
      BufferManager out=getShell().getBufferManager();
      out.write(fullPrompt);
      out.flushBuffer();
      sleep(3);
    }
 catch (    InterruptedException e) {
      return;
    }
  }
}
Program: 151588
Project: 151588
Buggy source:
private void beforeReadLine(final String prompt,final Character mask){
  if (mask != null && maskThread == null) {
    final String fullPrompt="String_Node_Str" + prompt + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ prompt;
    maskThread=new Thread(){
      public void run(){
        while (!interrupted()) {
          try {
            BufferManager out=getOutput();
            out.write(fullPrompt);
            out.flushBuffer();
            sleep(3);
          }
 catch (          InterruptedException e) {
            return;
          }
        }
      }
    }
;
    maskThread.setPriority(Thread.MAX_PRIORITY);
    maskThread.setDaemon(true);
    maskThread.start();
  }
}

Fixed version (ground truth):
private void beforeReadLine(final String prompt,final Character mask){
  if (mask != null && maskThread == null) {
    final String fullPrompt="String_Node_Str" + prompt + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ prompt;
    maskThread=new Thread(){
      public void run(){
        while (!interrupted()) {
          try {
            BufferManager out=getShell().getBufferManager();
            out.write(fullPrompt);
            out.flushBuffer();
            sleep(3);
          }
 catch (          InterruptedException e) {
            return;
          }
        }
      }
    }
;
    maskThread.setPriority(Thread.MAX_PRIORITY);
    maskThread.setDaemon(true);
    maskThread.start();
  }
}
Program: 151589
Project: 151589
Buggy source:
/** 
 * Move the cursor <i>where</i> characters, without checking the current buffer.
 * @param where the number of characters to move to the right or left.
 */
private void moveInternal(final int where) throws IOException {
  buf.cursor+=where;
  if (terminal.isAnsiSupported()) {
    if (where < 0) {
      back(Math.abs(where));
    }
 else {
      int width=getTerminal().getWidth();
      int cursor=getCursorPosition();
      int oldLine=(cursor - where) / width;
      int newLine=cursor / width;
      if (newLine > oldLine) {
        printAnsiSequence((newLine - oldLine) + "String_Node_Str");
      }
      printAnsiSequence(1 + (cursor % width) + "String_Node_Str");
    }
    return;
  }
  char c;
  if (where < 0) {
    int len=0;
    for (int i=buf.cursor; i < buf.cursor - where; i++) {
      if (buf.buffer.charAt(i) == '\t') {
        len+=TAB_WIDTH;
      }
 else {
        len++;
      }
    }
    char chars[]=new char[len];
    Arrays.fill(chars,(char)BACKSPACE);
    outBuffer.write(new String(chars));
    return;
  }
 else   if (buf.cursor == 0) {
    return;
  }
 else   if (mask != null) {
    c=mask;
  }
 else {
    print(buf.buffer.substring(buf.cursor - where,buf.cursor).getBytes());
    return;
  }
  if (mask == NULL_MASK) {
    return;
  }
  print(c,Math.abs(where));
}

Fixed version (ground truth):
/** 
 * Move the cursor <i>where</i> characters, without checking the current buffer.
 * @param where the number of characters to move to the right or left.
 */
private void moveInternal(final int where) throws IOException {
  buf.cursor+=where;
  if (terminal.isAnsiSupported()) {
    if (where < 0) {
      back(Math.abs(where));
    }
 else {
      int width=getTerminal().getWidth();
      int cursor=getCursorPosition();
      int oldLine=(cursor - where) / width;
      int newLine=cursor / width;
      if (newLine > oldLine) {
        printAnsiSequence((newLine - oldLine) + "String_Node_Str");
      }
      printAnsiSequence(1 + (cursor % width) + "String_Node_Str");
    }
    return;
  }
  char c;
  if (where < 0) {
    int len=0;
    for (int i=buf.cursor; i < buf.cursor - where; i++) {
      if (buf.buffer.charAt(i) == '\t') {
        len+=TAB_WIDTH;
      }
 else {
        len++;
      }
    }
    char chars[]=new char[len];
    Arrays.fill(chars,(char)BACKSPACE);
    ;
    shell.print(new String(chars));
    return;
  }
 else   if (buf.cursor == 0) {
    return;
  }
 else   if (mask != null) {
    c=mask;
  }
 else {
    print(buf.buffer.substring(buf.cursor - where,buf.cursor).getBytes());
    return;
  }
  if (mask == NULL_MASK) {
    return;
  }
  print(c,Math.abs(where));
}
Program: 151590
Project: 151590
Buggy source:
/** 
 * Flush the console output stream. This is important for printout out single characters (like a backspace or keyboard) that we want the console to handle immediately.
 */
public void flush() throws IOException {
  outBuffer.flushBuffer();
}

Fixed version (ground truth):
/** 
 * Flush the console output stream. This is important for printout out single characters (like a backspace or keyboard) that we want the console to handle immediately.
 */
public void flush() throws IOException {
  shell.flush();
}
Program: 151591
Project: 151591
Buggy source:
private void printAnsiSequence(String sequence) throws IOException {
  print(27);
  print('[');
  print(sequence);
}

Fixed version (ground truth):
private void printAnsiSequence(String sequence) throws IOException {
  print(ESCAPE_STR + sequence);
}
Program: 151592
Project: 151592
Buggy source:
public ConsoleReader(final InputStream in,final BufferManager out,final org.jboss.forge.shell.console.jline.Terminal term) throws IOException {
  this(in,out,null,term);
}

Fixed version (ground truth):
public ConsoleReader(final InputStream in,final Shell shell,final org.jboss.forge.shell.console.jline.Terminal term) throws IOException {
  this(in,shell,null,term);
}
Program: 151593
Project: 151593
Buggy source:
/** 
 * Reads the console input and returns an array of the form [raw, key binding].
 */
private int[] readBinding() throws IOException {
  int c=readVirtualKey();
  if (c == -1) {
    return null;
  }
  short code=keyBindings[c];
  org.jboss.forge.shell.console.jline.internal.Log.trace("String_Node_Str",c,"String_Node_Str",code);
  return new int[]{c,code};
}

Fixed version (ground truth):
/** 
 * Reads the console input and returns an array of the form [raw, key binding].
 */
private int[] readBinding() throws IOException {
  int c=readVirtualKey();
  for (  KeyListener listener : keyListeners) {
    if (listener.keyPress(c)) {
      return null;
    }
  }
  if (c == -1) {
    return null;
  }
  short code=keyBindings[c];
  org.jboss.forge.shell.console.jline.internal.Log.trace("String_Node_Str",c,"String_Node_Str",code);
  return new int[]{c,code};
}
Program: 151594
Project: 151594
Buggy source:
void doShell(@Observes final AcceptUserInput event) throws Exception {
  String line;
  reader.setPrompt(getPrompt());
  while (!exitRequested) {
    try {
      line=readLine();
      screenBuffer.flushBuffer();
      if (line != null) {
        if (!"String_Node_Str".equals(line.trim())) {
          writeToHistory(line);
          execute(line);
        }
        reader.setPrompt(getPrompt());
      }
    }
 catch (    Exception e) {
      handleException(e);
    }
  }
}

Fixed version (ground truth):
void doShell(@Observes final AcceptUserInput event) throws Exception {
  String line;
  reader.setPrompt(getPrompt());
  while (!exitRequested) {
    try {
      line=readLine();
      try {
        bufferingMode();
        if (line != null) {
          if (!"String_Node_Str".equals(line.trim())) {
            writeToHistory(line);
            execute(line);
          }
          reader.setPrompt(getPrompt());
        }
      }
  finally {
        directWriteMode();
      }
    }
 catch (    Exception e) {
      handleException(e);
    }
  }
}
Program: 151595
Project: 151595
Buggy source:
@Override public void flushBuffer(){
  try {
    reader.flush();
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public synchronized void flushBuffer(){
  try {
    byte[] buf=new byte[2048];
    buffer.rewind();
    do {
      int i=0;
      for (; i < buf.length && bufferSize > 0; i++) {
        bufferSize--;
        buf[i]=buffer.get();
      }
      reader.print(new String(buf,0,i));
    }
 while (bufferSize > 0);
    bufferSize=0;
    buffer.clear();
    reader.flush();
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 151596
Project: 151596
Buggy source:
public JLineScreenBuffer(ConsoleReader reader){
  this.reader=reader;
  this.terminal=reader.getTerminal();
}

Fixed version (ground truth):
public JLineScreenBuffer(ConsoleReader reader){
  this.reader=reader;
  this.terminal=reader.getTerminal();
  this.buffer=ByteBuffer.allocateDirect(maxBufferSize);
}
Program: 151597
Project: 151597
Buggy source:
@Override public void write(String s){
  try {
    reader.print(s);
    if (directWrite)     reader.flush();
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public synchronized void write(String s){
  try {
    reader.print(s);
    if (directWrite) {
      reader.flush();
    }
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 151599
Project: 151599
Buggy source:
/** 
 * Execute a native system command as if it were run from the given path.
 * @param command the system command to execute
 * @param parms the command parameters
 * @param out a print writer to which command output will be streamed
 * @param path the path from which to execute the command
 * @return 0 on successful completion, any other return code denotes failure
 */
public static int execFromPath(final String command,final String[] parms,final ShellPrintWriter out,final DirectoryResource path) throws IOException {
  try {
    String[] commandTokens=parms == null ? new String[1] : new String[parms.length + 1];
    commandTokens[0]=command;
    if (commandTokens.length > 1) {
      System.arraycopy(parms,0,commandTokens,1,parms.length);
    }
    ProcessBuilder builder=new ProcessBuilder(commandTokens);
    builder.directory(path.getUnderlyingResourceObject());
    builder.redirectErrorStream();
    Process p=builder.start();
    InputStream stdout=p.getInputStream();
    InputStream stderr=p.getErrorStream();
    Thread outThread=new Thread(new Receiver(stdout,out));
    Thread errThread=new Thread(new Receiver(stderr,out));
    outThread.start();
    errThread.start();
    outThread.join();
    errThread.join();
    return p.waitFor();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    return -1;
  }
}

Fixed version (ground truth):
/** 
 * Execute a native system command as if it were run from the given path.
 * @param command the system command to execute
 * @param parms the command parameters
 * @param out a print writer to which command output will be streamed
 * @param path the path from which to execute the command
 * @return 0 on successful completion, any other return code denotes failure
 */
public static int execFromPath(final String command,final String[] parms,final ShellPrintWriter out,final DirectoryResource path) throws IOException {
  try {
    String[] commandTokens=parms == null ? new String[1] : new String[parms.length + 1];
    commandTokens[0]=command;
    if (commandTokens.length > 1) {
      System.arraycopy(parms,0,commandTokens,1,parms.length);
    }
    ProcessBuilder builder=new ProcessBuilder(commandTokens);
    builder.directory(path.getUnderlyingResourceObject());
    builder.redirectErrorStream(true);
    Process p=builder.start();
    InputStream stdout=p.getInputStream();
    Thread outThread=new Thread(new Receiver(stdout,out));
    outThread.start();
    outThread.join();
    return p.waitFor();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    return -1;
  }
}
Program: 151600
Project: 151600
Buggy source:
/** 
 * Return this   {@link JavaSource} file as a String
 */
@Override public String toString(){
  try {
    TextEdit edit=unit.rewrite(document,null);
    edit.apply(document);
  }
 catch (  Exception e) {
    throw new ParserException("String_Node_Str" + unit.toString(),e);
  }
  String documentString=document.get();
  return documentString;
}

Fixed version (ground truth):
/** 
 * Return this   {@link JavaSource} file as a String
 */
@Override public String toString(){
  Document document=new Document(this.document.get());
  try {
    TextEdit edit=unit.rewrite(document,null);
    edit.apply(document);
  }
 catch (  Exception e) {
    throw new ParserException("String_Node_Str" + unit.toString(),e);
  }
  String documentString=document.get();
  return documentString;
}
Program: 151601
Project: 151601
Buggy source:
/** 
 * Ask the current   {@link InputStream} for input, masking keystrokes in the console with the given mask.
 * @param mask The sequence to use for masking input
 * @return any read data as a string, or null if none available.
 * @throws IOException on error
 */
String readLine(String mask) throws IOException ;

Fixed version (ground truth):
/** 
 * Ask the current   {@link InputStream} for input, masking keystrokes in the console with the given mask.
 * @param mask The character to use for masking input
 * @return any read data as a string, or null if none available.
 * @throws IOException on error
 */
String readLine(Character mask) throws IOException ;