nus-yam/ex-repair huggingface dataset:
Program: 30282
Project: 30282
Buggy source:
private ServerPool addServerPool(ServerPoolConfig serverPoolConfig){
  ServerPoolFactory spf=services.forContract(ServerPoolFactory.class).named(serverPoolConfig.getVirtualization().getType()).get();
  if (spf == null) {
    RuntimeContext.logger.log(Level.SEVERE,"String_Node_Str" + ServerPoolFactory.class.getName() + "String_Node_Str"+ serverPoolConfig.getVirtualization().getType());
    throw new RuntimeException("String_Node_Str" + serverPoolConfig.getVirtualization().getType());
  }
  ServerPool serverPool=spf.build(serverPoolConfig);
synchronized (this) {
    groups.put(serverPoolConfig.getName(),serverPool);
  }
  return serverPool;
}

Fixed version (ground truth):
private ServerPool addServerPool(ServerPoolConfig serverPoolConfig){
  if (groups.containsKey(serverPoolConfig.getName())) {
    return groups.get(serverPoolConfig.getName());
  }
  ServerPoolFactory spf=services.forContract(ServerPoolFactory.class).named(serverPoolConfig.getVirtualization().getType()).get();
  if (spf == null) {
    RuntimeContext.logger.log(Level.SEVERE,"String_Node_Str" + ServerPoolFactory.class.getName() + "String_Node_Str"+ serverPoolConfig.getVirtualization().getType());
    throw new RuntimeException("String_Node_Str" + serverPoolConfig.getVirtualization().getType());
  }
  ServerPool serverPool=spf.build(serverPoolConfig);
synchronized (this) {
    groups.put(serverPoolConfig.getName(),serverPool);
  }
  return serverPool;
}
Program: 30283
Project: 30283
Buggy source:
@Override public UnprocessedChangeEvents changed(PropertyChangeEvent[] propertyChangeEvents){
  Virtualizations virtualizations=services.forContract(Virtualizations.class).get();
  for (  Virtualization virt : virtualizations.getVirtualizations()) {
    for (    ServerPoolConfig config : virt.getServerPools()) {
      if (!groups.containsKey(config.getName())) {
        addServerPool(config);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public UnprocessedChangeEvents changed(PropertyChangeEvent[] propertyChangeEvents){
  for (  ServerPoolConfig serverPoolConfig : target.getServerPools()) {
    addServerPool(serverPoolConfig);
  }
  return null;
}
Program: 30284
Project: 30284
Buggy source:
public LocalServerPool(ServerPoolConfig config,LocalServerPoolFactory serverPoolFactory){
  this.config=config;
  this.serverPoolFactory=serverPoolFactory;
  if (serverPoolFactory.getDomain().getClusters() != null) {
    for (    Cluster cluster : serverPoolFactory.getDomain().getClusters().getCluster()) {
      for (      VirtualMachineConfig vmc : cluster.getExtensionsByType(VirtualMachineConfig.class)) {
        if (vmc.getServerPool().equals(config)) {
          vms.put(vmc.getName(),new LocalVirtualMachine(vmc,vmc.getTemplate().getUser(),this,null,vmc.getName()));
        }
      }
    }
  }
  vmId=new AtomicLong(vms.size());
}

Fixed version (ground truth):
public LocalServerPool(ServerPoolConfig config,LocalServerPoolFactory serverPoolFactory){
  this.config=config;
  this.serverPoolFactory=serverPoolFactory;
  if (serverPoolFactory.getDomain().getClusters() != null) {
    for (    Cluster cluster : serverPoolFactory.getDomain().getClusters().getCluster()) {
      for (      VirtualMachineConfig vmc : cluster.getExtensionsByType(VirtualMachineConfig.class)) {
        if (vmc.getServerPool().getName().equals(config.getName())) {
          vms.put(vmc.getName(),new LocalVirtualMachine(vmc,vmc.getTemplate().getUser(),this,null,vmc.getName()));
        }
      }
    }
  }
  vmId=new AtomicLong(vms.size());
}
Program: 30285
Project: 30285
Buggy source:
@Override public Iterable<GroupAccess> groups(){
  return groups.values();
}

Fixed version (ground truth):
@Override public Iterable<GroupAccess> groups(){
  final Iterator<ServerPool> pools=groupMgt.iterator();
  return new Iterable<GroupAccess>(){
    @Override public Iterator<GroupAccess> iterator(){
      return new Iterator<GroupAccess>(){
        @Override public boolean hasNext(){
          return pools.hasNext();
        }
        @Override public GroupAccess next(){
          return LocalGroupAccess.from(injector,pools.next());
        }
        @Override public void remove(){
          throw new RuntimeException("String_Node_Str");
        }
      }
;
    }
  }
;
}
Program: 30286
Project: 30286
Buggy source:
@Override public GroupAccess byName(String name){
  return groups.get(name);
}

Fixed version (ground truth):
@Override public GroupAccess byName(String name){
  ServerPool serverPool=groupMgt.byName(name);
  return LocalGroupAccess.from(injector,serverPool);
}
Program: 30289
Project: 30289
Buggy source:
@Test public void testEmptySubContext(){
  try {
    String name1="String_Node_Str";
    Context ctx=newInitialContext();
    ctx.bind(name1,"String_Node_Str");
    String val=(String)ctx.lookup(name1);
    assert(false);
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + ex);
    assert(true);
  }
 finally {
  }
}

Fixed version (ground truth):
@Test(expected=Exception.class) public void testEmptySubContext() throws Exception {
  String name1="String_Node_Str";
  Context ctx=newInitialContext();
  ctx.bind(name1,"String_Node_Str");
  String val=(String)ctx.lookup(name1);
}
Program: 30290
Project: 30290
Buggy source:
private void testEmptyJavaCompEnv(){
  GlassfishNamingManagerImpl nm=null;
  InvocationManager im=new InvocationManagerImpl();
  ComponentInvocation inv=null;
  try {
    InitialContext ic=newInitialContext();
    nm=new GlassfishNamingManagerImpl(ic);
    nm.setInvocationManager(im);
    inv=new ComponentInvocation("String_Node_Str",ComponentInvocation.ComponentInvocationType.EJB_INVOCATION,null,null,null);
    im.preInvoke(inv);
    nm.bindToComponentNamespace("String_Node_Str","String_Node_Str","String_Node_Str",false,new ArrayList<Binding>());
    Context ctx=(Context)ic.lookup("String_Node_Str");
    System.out.println("String_Node_Str" + ctx);
  }
 catch (  javax.naming.NamingException nnfEx) {
    nnfEx.printStackTrace();
    assert(false);
  }
}

Fixed version (ground truth):
@Test public void testEmptyJavaCompEnv(){
  GlassfishNamingManagerImpl nm=null;
  InvocationManager im=new InvocationManagerImpl();
  ComponentInvocation inv=null;
  try {
    InitialContext ic=newInitialContext();
    triggerLoadingNamedProxies(ic);
    nm=new GlassfishNamingManagerImpl(ic);
    nm.setInvocationManager(im);
    inv=new ComponentInvocation("String_Node_Str",ComponentInvocation.ComponentInvocationType.EJB_INVOCATION,null,null,null);
    im.preInvoke(inv);
    nm.bindToComponentNamespace("String_Node_Str","String_Node_Str","String_Node_Str",false,new ArrayList<Binding>());
    Context ctx=(Context)ic.lookup("String_Node_Str");
    System.out.println("String_Node_Str" + ctx);
  }
 catch (  javax.naming.NamingException nnfEx) {
    nnfEx.printStackTrace();
    assert(false);
  }
}
Program: 30292
Project: 30292
Buggy source:
public void testBind(){
  GlassfishNamingManager nm=null;
  try {
    InvocationManager im=new InvocationManagerImpl();
    InitialContext ic=newInitialContext();
    nm=new GlassfishNamingManagerImpl(ic);
    nm.publishObject("String_Node_Str","String_Node_Str",false);
    System.out.println("String_Node_Str" + ic.lookup("String_Node_Str"));
    assert(true);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    assert(false);
  }
 finally {
    try {
      nm.unpublishObject("String_Node_Str");
    }
 catch (    Exception ex) {
    }
  }
}

Fixed version (ground truth):
@Test public void testBind(){
  GlassfishNamingManager nm=null;
  try {
    InvocationManager im=new InvocationManagerImpl();
    InitialContext ic=newInitialContext();
    nm=new GlassfishNamingManagerImpl(ic);
    nm.publishObject("String_Node_Str","String_Node_Str",false);
    System.out.println("String_Node_Str" + ic.lookup("String_Node_Str"));
    assert(true);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    assert(false);
  }
 finally {
    try {
      nm.unpublishObject("String_Node_Str");
    }
 catch (    Exception ex) {
    }
  }
}
Program: 30293
Project: 30293
Buggy source:
public void testCreateNewInitialContext(){
  try {
    newInitialContext();
    assert(true);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    assert(false);
  }
}

Fixed version (ground truth):
@Test public void testCreateNewInitialContext(){
  try {
    newInitialContext();
    assert(true);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    assert(false);
  }
}
Program: 30294
Project: 30294
Buggy source:
public void testEmptySubContext(){
  try {
    String name1="String_Node_Str";
    Context ctx=newInitialContext();
    ctx.bind(name1,"String_Node_Str");
    String val=(String)ctx.lookup(name1);
    assert(false);
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + ex);
    assert(true);
  }
 finally {
  }
}

Fixed version (ground truth):
@Test public void testEmptySubContext(){
  try {
    String name1="String_Node_Str";
    Context ctx=newInitialContext();
    ctx.bind(name1,"String_Node_Str");
    String val=(String)ctx.lookup(name1);
    assert(false);
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + ex);
    assert(true);
  }
 finally {
  }
}
Program: 30295
Project: 30295
Buggy source:
public void testEmptyJavaCompEnv(){
  GlassfishNamingManagerImpl nm=null;
  InvocationManager im=new InvocationManagerImpl();
  ComponentInvocation inv=null;
  try {
    InitialContext ic=newInitialContext();
    nm=new GlassfishNamingManagerImpl(ic);
    nm.setInvocationManager(im);
    inv=new ComponentInvocation("String_Node_Str",ComponentInvocation.ComponentInvocationType.EJB_INVOCATION,null,null,null);
    im.preInvoke(inv);
    nm.bindToComponentNamespace("String_Node_Str","String_Node_Str","String_Node_Str",false,new ArrayList<Binding>());
    Context ctx=(Context)ic.lookup("String_Node_Str");
    System.out.println("String_Node_Str" + ctx);
    assert(true);
  }
 catch (  javax.naming.NamingException nnfEx) {
    nnfEx.printStackTrace();
    assert(false);
  }
}

Fixed version (ground truth):
private void testEmptyJavaCompEnv(){
  GlassfishNamingManagerImpl nm=null;
  InvocationManager im=new InvocationManagerImpl();
  ComponentInvocation inv=null;
  try {
    InitialContext ic=newInitialContext();
    nm=new GlassfishNamingManagerImpl(ic);
    nm.setInvocationManager(im);
    inv=new ComponentInvocation("String_Node_Str",ComponentInvocation.ComponentInvocationType.EJB_INVOCATION,null,null,null);
    im.preInvoke(inv);
    nm.bindToComponentNamespace("String_Node_Str","String_Node_Str","String_Node_Str",false,new ArrayList<Binding>());
    Context ctx=(Context)ic.lookup("String_Node_Str");
    System.out.println("String_Node_Str" + ctx);
  }
 catch (  javax.naming.NamingException nnfEx) {
    nnfEx.printStackTrace();
    assert(false);
  }
}
Program: 30297
Project: 30297
Buggy source:
public void registerEndpoint(WebServiceEndpoint webserviceEndpoint,EjbEndpointFacade ejbContainer,Object servant,Class tieClass){
  String ctxtRoot=null;
  EjbRuntimeEndpointInfo endpoint=createEjbEndpointInfo(webserviceEndpoint,ejbContainer,servant,tieClass);
synchronized (webServiceEjbEndpoints) {
    String uriRaw=endpoint.getEndpointAddressUri();
    if (uriRaw != null) {
      String uri=(uriRaw.charAt(0) == '/') ? uriRaw.substring(1) : uriRaw;
      if (webServiceEjbEndpoints.containsKey(uri)) {
        logger.log(Level.SEVERE,format(rb.getString("String_Node_Str"),uri));
      }
      webServiceEjbEndpoints.put(uri,endpoint);
      regenerateEjbContextRoots();
      ctxtRoot=getContextRootForUri(uri);
      if (adapterListMap.get(ctxtRoot) == null) {
        ServletAdapterList list=new ServletAdapterList();
        adapterListMap.put(ctxtRoot,list);
      }
    }
 else     throw new WebServiceException(rb.getString("String_Node_Str"));
  }
  WebServiceEngineImpl engine=WebServiceEngineImpl.getInstance();
  if (endpoint.getEndpoint().getWebService().getMappingFileUri() != null) {
    engine.createHandler((com.sun.xml.rpc.spi.runtime.SystemHandlerDelegate)null,endpoint.getEndpoint());
  }
 else {
    engine.createHandler(endpoint.getEndpoint());
    try {
      endpoint.initRuntimeInfo((ServletAdapterList)adapterListMap.get(ctxtRoot));
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public void registerEndpoint(WebServiceEndpoint webserviceEndpoint,EjbEndpointFacade ejbContainer,Object servant,Class tieClass){
  String ctxtRoot=null;
  String uri=null;
  EjbRuntimeEndpointInfo endpoint=createEjbEndpointInfo(webserviceEndpoint,ejbContainer,servant,tieClass);
synchronized (webServiceEjbEndpoints) {
    String uriRaw=endpoint.getEndpointAddressUri();
    if (uriRaw != null) {
      uri=(uriRaw.charAt(0) == '/') ? uriRaw.substring(1) : uriRaw;
      if (webServiceEjbEndpoints.containsKey(uri)) {
        logger.log(Level.SEVERE,format(rb.getString("String_Node_Str"),uri));
      }
      webServiceEjbEndpoints.put(uri,endpoint);
      regenerateEjbContextRoots();
      ctxtRoot=getContextRootForUri(uri);
      if (adapterListMap.get(uri) == null) {
        ServletAdapterList list=new ServletAdapterList();
        adapterListMap.put(uri,list);
      }
    }
 else     throw new WebServiceException(rb.getString("String_Node_Str"));
  }
  WebServiceEngineImpl engine=WebServiceEngineImpl.getInstance();
  if (endpoint.getEndpoint().getWebService().getMappingFileUri() != null) {
    engine.createHandler((com.sun.xml.rpc.spi.runtime.SystemHandlerDelegate)null,endpoint.getEndpoint());
  }
 else {
    engine.createHandler(endpoint.getEndpoint());
    try {
      endpoint.initRuntimeInfo((ServletAdapterList)adapterListMap.get(uri));
    }
 catch (    Exception e) {
      logger.log(Level.WARNING,"String_Node_Str",e);
    }
  }
}
Program: 30298
Project: 30298
Buggy source:
public void unregisterEndpoint(String endpointAddressUri){
  EjbRuntimeEndpointInfo endpoint=null;
synchronized (webServiceEjbEndpoints) {
    String uriRaw=endpointAddressUri;
    String uri=(uriRaw.charAt(0) == '/') ? uriRaw.substring(1) : uriRaw;
    String ctxtRoot=getContextRootForUri(uri);
    ServletAdapterList list=(ServletAdapterList)adapterListMap.get(ctxtRoot);
    if (list != null) {
      Iterator<ServletAdapter> it=list.iterator();
      while (it.hasNext()) {
        ServletAdapter x=it.next();
        if (endpointAddressUri.equalsIgnoreCase(x.urlPattern)) {
          x.getEndpoint().dispose();
          it.remove();
        }
      }
      if (list.isEmpty()) {
        adapterListMap.remove(ctxtRoot);
      }
    }
    endpoint=(EjbRuntimeEndpointInfo)webServiceEjbEndpoints.remove(uri);
    regenerateEjbContextRoots();
  }
  if (endpoint == null) {
    return;
  }
  WebServiceEngineImpl engine=WebServiceEngineImpl.getInstance();
  engine.removeHandler(endpoint.getEndpoint());
}

Fixed version (ground truth):
public void unregisterEndpoint(String endpointAddressUri){
  EjbRuntimeEndpointInfo endpoint=null;
synchronized (webServiceEjbEndpoints) {
    String uriRaw=endpointAddressUri;
    String uri=(uriRaw.charAt(0) == '/') ? uriRaw.substring(1) : uriRaw;
    ServletAdapterList list=(ServletAdapterList)adapterListMap.get(uri);
    if (list != null) {
      for (      ServletAdapter x : list) {
        x.getEndpoint().dispose();
      }
      adapterListMap.remove(uri);
    }
    endpoint=(EjbRuntimeEndpointInfo)webServiceEjbEndpoints.remove(uri);
    regenerateEjbContextRoots();
  }
  if (endpoint == null) {
    return;
  }
  WebServiceEngineImpl engine=WebServiceEngineImpl.getInstance();
  engine.removeHandler(endpoint.getEndpoint());
}
Program: 30299
Project: 30299
Buggy source:
private static Properties getVersionProp(){
  String installRoot=System.getProperty(INSTALL_ROOT_PROP_NAME);
  if (installRoot != null) {
    File ir=new File(installRoot);
    File bd=new File(new File(ir,"String_Node_Str"),"String_Node_Str");
    if (bd.isDirectory()) {
      for (      File f : bd.listFiles(new FileFilter(){
        @Override public boolean accept(        File f){
          return f.getName().endsWith("String_Node_Str") && f.canRead();
        }
      }
)) {
        try {
          FileReader fr=new FileReader(f);
          Properties p=new Properties();
          p.load(fr);
          versionProps.add(p);
          fr.close();
        }
 catch (        IOException ex) {
        }
      }
    }
    Collections.sort(versionProps,new Comparator<Properties>(){
      @Override public int compare(      Properties p1,      Properties p2){
        String abp1=p1.getProperty(ABBREV_PRODUCT_NAME_KEY);
        String bo1=p1.getProperty(BASED_ON_KEY);
        String abp2=p2.getProperty(ABBREV_PRODUCT_NAME_KEY);
        String bo2=p2.getProperty(BASED_ON_KEY);
        if (bo1 != null && abp2 != null && bo1.contains(abp2)) {
          return -1;
        }
        if (bo2 != null && abp1 != null && bo2.contains(abp1)) {
          return 1;
        }
        return 0;
      }
    }
);
    if (versionProps.size() > 0) {
      return versionProps.get(0);
    }
  }
 else {
    System.out.println("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
private static Properties getVersionProp(){
  String installRoot=System.getProperty(INSTALL_ROOT_PROP_NAME);
  if (installRoot != null) {
    File ir=new File(installRoot);
    File bd=new File(new File(ir,"String_Node_Str"),"String_Node_Str");
    if (bd.isDirectory()) {
      for (      File f : bd.listFiles(new FileFilter(){
        @Override public boolean accept(        File f){
          return f.getName().endsWith("String_Node_Str") && f.canRead();
        }
      }
)) {
        FileReader fr=null;
        try {
          fr=new FileReader(f);
          Properties p=new Properties();
          p.load(fr);
          versionProps.add(p);
          fr.close();
        }
 catch (        IOException ex) {
        }
 finally {
          if (fr != null) {
            try {
              fr.close();
            }
 catch (            IOException ex) {
            }
          }
        }
      }
    }
    Collections.sort(versionProps,new Comparator<Properties>(){
      @Override public int compare(      Properties p1,      Properties p2){
        String abp1=p1.getProperty(ABBREV_PRODUCT_NAME_KEY);
        String bo1=p1.getProperty(BASED_ON_KEY);
        String abp2=p2.getProperty(ABBREV_PRODUCT_NAME_KEY);
        String bo2=p2.getProperty(BASED_ON_KEY);
        if (bo1 != null && abp2 != null && bo1.contains(abp2)) {
          return -1;
        }
        if (bo2 != null && abp1 != null && bo2.contains(abp1)) {
          return 1;
        }
        return 0;
      }
    }
);
    if (versionProps.size() > 0) {
      return versionProps.get(0);
    }
  }
 else {
    System.out.println("String_Node_Str");
  }
  return null;
}
Program: 30300
Project: 30300
Buggy source:
/** 
 * Return major_version [. minor_version [. update_version]]
 */
public static String getVersionNumber(){
  String maj=getMajorVersion();
  String min=getMinorVersion();
  String upd=getUpdateVersion();
  String v;
  try {
    if (min != null & min.length() > 0 && Integer.parseInt(min) >= 0) {
      if (upd != null && upd.length() > 0 && Integer.parseInt(upd) >= 0) {
        v=maj + "String_Node_Str" + min+ "String_Node_Str"+ upd;
      }
 else {
        v=maj + "String_Node_Str" + min;
      }
    }
 else {
      if (upd != null && upd.length() > 0 && Integer.parseInt(upd) >= 0) {
        v=maj + "String_Node_Str" + upd;
      }
 else {
        v=maj;
      }
    }
  }
 catch (  NumberFormatException nfe) {
    v=maj;
  }
  return v;
}

Fixed version (ground truth):
/** 
 * Return major_version [. minor_version [. update_version]]
 */
public static String getVersionNumber(){
  String maj=getMajorVersion();
  String min=getMinorVersion();
  String upd=getUpdateVersion();
  String v;
  try {
    if (min != null && min.length() > 0 && Integer.parseInt(min) >= 0) {
      if (upd != null && upd.length() > 0 && Integer.parseInt(upd) >= 0) {
        v=maj + "String_Node_Str" + min+ "String_Node_Str"+ upd;
      }
 else {
        v=maj + "String_Node_Str" + min;
      }
    }
 else {
      if (upd != null && upd.length() > 0 && Integer.parseInt(upd) >= 0) {
        v=maj + "String_Node_Str" + upd;
      }
 else {
        v=maj;
      }
    }
  }
 catch (  NumberFormatException nfe) {
    v=maj;
  }
  return v;
}
Program: 30301
Project: 30301
Buggy source:
/** 
 * Returns the name of the command associated with this resource,if any, for the given operation.
 * @param type the given resource operation
 * @return String the associated command name for the given operation.
 */
public static String getCommand(RestRedirect.OpType type,ConfigModel model){
  Class<? extends ConfigBeanProxy> cbp=null;
  try {
    cbp=(Class<? extends ConfigBeanProxy>)model.classLoaderHolder.get().loadClass(model.targetTypeName);
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
  RestRedirects restRedirects=cbp.getAnnotation(RestRedirects.class);
  if (restRedirects != null) {
    RestRedirect[] values=restRedirects.value();
    for (    RestRedirect r : values) {
      if (r.opType().equals(type)) {
        return r.commandName();
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the name of the command associated with this resource,if any, for the given operation.
 * @param type the given resource operation
 * @return String the associated command name for the given operation.
 */
public static String getCommand(RestRedirect.OpType type,ConfigModel model){
  Class<? extends ConfigBeanProxy> cbp=null;
  try {
    cbp=(Class<? extends ConfigBeanProxy>)model.classLoaderHolder.get().loadClass(model.targetTypeName);
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
  if (cbp != null) {
    RestRedirects restRedirects=cbp.getAnnotation(RestRedirects.class);
    if (restRedirects != null) {
      RestRedirect[] values=restRedirects.value();
      for (      RestRedirect r : values) {
        if (r.opType().equals(type)) {
          return r.commandName();
        }
      }
    }
  }
  return null;
}
Program: 30302
Project: 30302
Buggy source:
public static RestConfig getRestConfig(Habitat habitat){
  if (restConfig == null) {
    if (habitat == null) {
      return null;
    }
    Domain domain=habitat.getComponent(Domain.class);
    if (domain != null) {
      Config config=domain.getConfigNamed("String_Node_Str");
      if (config != null) {
        restConfig=config.getExtensionByType(RestConfig.class);
      }
    }
  }
  return restConfig;
}

Fixed version (ground truth):
public static synchronized RestConfig getRestConfig(Habitat habitat){
  if (restConfig == null) {
    if (habitat == null) {
      return null;
    }
    Domain domain=habitat.getComponent(Domain.class);
    if (domain != null) {
      Config config=domain.getConfigNamed("String_Node_Str");
      if (config != null) {
        restConfig=config.getExtensionByType(RestConfig.class);
      }
    }
  }
  return restConfig;
}
Program: 30303
Project: 30303
Buggy source:
/** 
 * @return true if the session has not timed out. false otherwise
 */
public boolean isSessionActive(){
  long inactiveSessionLifeTime=30 * 60 * 1000;
  RestConfig restConfig=ResourceUtil.getRestConfig(habitat);
  if (restConfig != null) {
    inactiveSessionLifeTime=Integer.parseInt(restConfig.getSessionTokenTimeout()) * 60000;
  }
  return lastAccessedTime + inactiveSessionLifeTime > System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * @return true if the session has not timed out. false otherwise
 */
public boolean isSessionActive(){
  long inactiveSessionLifeTime=30 * 60 * 1000;
  RestConfig restConfig=ResourceUtil.getRestConfig(habitat);
  if (restConfig != null) {
    inactiveSessionLifeTime=Integer.parseInt(restConfig.getSessionTokenTimeout()) * 60000L;
  }
  return lastAccessedTime + inactiveSessionLifeTime > System.currentTimeMillis();
}
Program: 30304
Project: 30304
Buggy source:
/** 
 * Returns the html for the given message.
 * @param uriInfo the uriInfo context of the request
 * @return String the html representation of the given message
 */
protected static String getHtml(String message,UriInfo uriInfo,boolean delete){
  String result=ProviderUtil.getHtmlHeader(uriInfo.getBaseUri().toASCIIString());
  String uri=uriInfo.getAbsolutePath().toString();
  if (delete) {
    uri=uri + "String_Node_Str";
  }
  String name=upperCaseFirstLetter(eleminateHypen(getName(uri,'/')));
  String parentName=upperCaseFirstLetter(eleminateHypen(getParentName(uri)));
  result=result + "String_Node_Str" + name+ "String_Node_Str";
  result=result + message;
  result=result + "String_Node_Str" + uri+ "String_Node_Str";
  result=result + "String_Node_Str";
  return result;
}

Fixed version (ground truth):
/** 
 * Returns the html for the given message.
 * @param uriInfo the uriInfo context of the request
 * @return String the html representation of the given message
 */
protected static String getHtml(String message,UriInfo uriInfo,boolean delete){
  String result=ProviderUtil.getHtmlHeader(uriInfo.getBaseUri().toASCIIString());
  String uri=uriInfo.getAbsolutePath().toString();
  if (delete) {
    uri=uri + "String_Node_Str";
  }
  String name=upperCaseFirstLetter(eleminateHypen(getName(uri,'/')));
  result=result + "String_Node_Str" + name+ "String_Node_Str";
  result=result + message;
  result=result + "String_Node_Str" + uri+ "String_Node_Str";
  result=result + "String_Node_Str";
  return result;
}
Program: 30305
Project: 30305
Buggy source:
private void exposeContext() throws EndpointRegistrationException {
  String context=getContextRoot();
  logger.log(Level.FINE,"String_Node_Str",context);
  if ((context != null) || (!"String_Node_Str".equals(context))) {
    Set<Class<?>> classes=getResourcesConfig();
    adapter=lazyJerseyInterface.exposeContext(classes,sc,habitat);
    logger.log(Level.INFO,"String_Node_Str",context);
  }
}

Fixed version (ground truth):
private void exposeContext() throws EndpointRegistrationException {
  String context=getContextRoot();
  logger.log(Level.FINE,"String_Node_Str",context);
  if ((context != null) && (!"String_Node_Str".equals(context))) {
    Set<Class<?>> classes=getResourcesConfig();
    adapter=lazyJerseyInterface.exposeContext(classes,sc,habitat);
    logger.log(Level.INFO,"String_Node_Str",context);
  }
}
Program: 30306
Project: 30306
Buggy source:
private void debug(String clsName,byte[] classData){
  clsName=clsName.replace('.','/');
  clsName=clsName.replace('\\','/');
  int index=clsName.lastIndexOf("String_Node_Str");
  if (index >= 0) {
    clsName=clsName.substring(index + 1);
  }
  try {
    String rootPath=System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY) + File.separator + "String_Node_Str"+ File.separator;
    String fileName=rootPath + clsName + "String_Node_Str";
    File file=new File(fileName);
    file.getParentFile().mkdirs();
    FileOutputStream fos=new FileOutputStream(file);
    fos.write(classData);
    fos.flush();
    fos.close();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
private void debug(String clsName,byte[] classData){
  clsName=clsName.replace('.','/');
  clsName=clsName.replace('\\','/');
  int index=clsName.lastIndexOf("String_Node_Str");
  if (index >= 0) {
    clsName=clsName.substring(index + 1);
  }
  FileOutputStream fos=null;
  try {
    String rootPath=System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY) + File.separator + "String_Node_Str"+ File.separator;
    String fileName=rootPath + clsName + "String_Node_Str";
    File file=new File(fileName);
    if (file.getParentFile().mkdirs()) {
      fos=new FileOutputStream(file);
      fos.write(classData);
      fos.flush();
    }
 else {
      Logger.getLogger(ASMClassWriter.class.getName()).log(Level.INFO,null,"String_Node_Str");
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
 finally {
    if (fos != null) {
      try {
        fos.close();
      }
 catch (      IOException ex) {
        Logger.getLogger(ASMClassWriter.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
  }
}
Program: 30307
Project: 30307
Buggy source:
public String defineClass(Class similarClass) throws Exception {
  String generatedClassName="String_Node_Str";
  generatedClassName=generatedClassName + className;
  byte[] byteContent=getByteClass();
  ProtectionDomain pd=similarClass.getProtectionDomain();
  java.lang.reflect.Method jm=null;
  for (  java.lang.reflect.Method jm2 : ClassLoader.class.getDeclaredMethods()) {
    if (jm2.getName().equals("String_Node_Str") && jm2.getParameterTypes().length == 5) {
      jm=jm2;
      break;
    }
  }
  if (jm == null) {
    throw new RuntimeException("String_Node_Str");
  }
  final java.lang.reflect.Method clM=jm;
  try {
    java.security.AccessController.doPrivileged(new java.security.PrivilegedExceptionAction(){
      public java.lang.Object run() throws Exception {
        if (!clM.isAccessible()) {
          clM.setAccessible(true);
        }
        return null;
      }
    }
);
    clM.invoke(similarClass.getClassLoader(),generatedClassName,byteContent,0,byteContent.length,pd);
    Class c=null;
    try {
      c=similarClass.getClassLoader().loadClass(generatedClassName);
    }
 catch (    ClassNotFoundException cnfEx) {
      throw new RuntimeException(cnfEx);
    }
    return generatedClassName;
  }
 catch (  PrivilegedActionException pEx) {
    throw new RuntimeException(pEx);
  }
catch (  IllegalAccessException illegalAccessException) {
    throw new RuntimeException(illegalAccessException);
  }
catch (  InvocationTargetException invtEx) {
    throw new RuntimeException(invtEx);
  }
}

Fixed version (ground truth):
public String defineClass(Class similarClass) throws Exception {
  String generatedClassName="String_Node_Str";
  generatedClassName=generatedClassName + className;
  byte[] byteContent=getByteClass();
  ProtectionDomain pd=similarClass.getProtectionDomain();
  java.lang.reflect.Method jm=null;
  for (  java.lang.reflect.Method jm2 : ClassLoader.class.getDeclaredMethods()) {
    if (jm2.getName().equals("String_Node_Str") && jm2.getParameterTypes().length == 5) {
      jm=jm2;
      break;
    }
  }
  if (jm == null) {
    throw new RuntimeException("String_Node_Str");
  }
  final java.lang.reflect.Method clM=jm;
  try {
    java.security.AccessController.doPrivileged(new java.security.PrivilegedExceptionAction(){
      public java.lang.Object run() throws Exception {
        if (!clM.isAccessible()) {
          clM.setAccessible(true);
        }
        return null;
      }
    }
);
    clM.invoke(similarClass.getClassLoader(),generatedClassName,byteContent,0,byteContent.length,pd);
    try {
      similarClass.getClassLoader().loadClass(generatedClassName);
    }
 catch (    ClassNotFoundException cnfEx) {
      throw new RuntimeException(cnfEx);
    }
    return generatedClassName;
  }
 catch (  PrivilegedActionException pEx) {
    throw new RuntimeException(pEx);
  }
catch (  IllegalAccessException illegalAccessException) {
    throw new RuntimeException(illegalAccessException);
  }
catch (  InvocationTargetException invtEx) {
    throw new RuntimeException(invtEx);
  }
}
Program: 30308
Project: 30308
Buggy source:
/** 
 * @param elementName
 * @return bean name for the given element name. The name is derived by uppercasing first letter of elementName,eliminating hyphens from elementName and uppercasing letter followed by hyphen
 */
public static String getBeanName(String elementName){
  String ret="String_Node_Str";
  boolean nextisUpper=true;
  for (int i=0; i < elementName.length(); i++) {
    if (nextisUpper == true) {
      ret=ret + elementName.substring(i,i + 1).toUpperCase(Locale.US);
      nextisUpper=false;
    }
 else {
      if (elementName.charAt(i) == '-') {
        nextisUpper=true;
      }
 else {
        nextisUpper=false;
        ret=ret + elementName.substring(i,i + 1);
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * @param elementName
 * @return bean name for the given element name. The name is derived by uppercasing first letter of elementName,eliminating hyphens from elementName and uppercasing letter followed by hyphen
 */
public static String getBeanName(String elementName){
  StringBuilder ret=new StringBuilder();
  boolean nextisUpper=true;
  for (int i=0; i < elementName.length(); i++) {
    if (nextisUpper == true) {
      ret.append(elementName.substring(i,i + 1).toUpperCase(Locale.US));
      nextisUpper=false;
    }
 else {
      if (elementName.charAt(i) == '-') {
        nextisUpper=true;
      }
 else {
        nextisUpper=false;
        ret.append(elementName.substring(i,i + 1));
      }
    }
  }
  return ret.toString();
}
Program: 30309
Project: 30309
Buggy source:
private boolean hasSingletonAnnotation(ConfigModel model){
  Class<? extends ConfigBeanProxy> cbp=null;
  try {
    cbp=(Class<? extends ConfigBeanProxy>)model.classLoaderHolder.get().loadClass(model.targetTypeName);
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
  org.glassfish.config.support.Singleton sing=cbp.getAnnotation(org.glassfish.config.support.Singleton.class);
  return (sing != null);
}

Fixed version (ground truth):
private boolean hasSingletonAnnotation(ConfigModel model){
  Class<? extends ConfigBeanProxy> cbp=null;
  try {
    cbp=(Class<? extends ConfigBeanProxy>)model.classLoaderHolder.get().loadClass(model.targetTypeName);
    if (cbp != null) {
      org.glassfish.config.support.Singleton sing=cbp.getAnnotation(org.glassfish.config.support.Singleton.class);
      return (sing != null);
    }
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
  return false;
}
Program: 30310
Project: 30310
Buggy source:
/** 
 * @param className Name of class to be generated
 * @param generationDir Absolute location where it needs to be generated
 * @param baseClassName
 * @param resourcePath
 */
public TextClassWriter(Habitat habitat,File generationDir,String className,String baseClassName,String resourcePath) throws IOException {
  this.habitat=habitat;
  File file=new File(generationDir,className + "String_Node_Str");
  file.createNewFile();
  FileWriter fstream=new FileWriter(file);
  writer=new BufferedWriter(fstream);
  writeCopyRightHeader();
  writePackageHeader();
  writeImportStatements();
  if (resourcePath != null) {
    writer.write("String_Node_Str" + resourcePath + "String_Node_Str");
  }
  writer.write("String_Node_Str" + className + "String_Node_Str"+ baseClassName+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param className Name of class to be generated
 * @param generationDir Absolute location where it needs to be generated
 * @param baseClassName
 * @param resourcePath
 */
public TextClassWriter(Habitat habitat,File generationDir,String className,String baseClassName,String resourcePath) throws IOException {
  this.habitat=habitat;
  File file=new File(generationDir,className + "String_Node_Str");
  boolean success=file.createNewFile();
  if (!success) {
    throw new IOException("String_Node_Str" + file.getAbsolutePath());
  }
  FileWriter fstream=new FileWriter(file);
  writer=new BufferedWriter(fstream);
  writeCopyRightHeader();
  writePackageHeader();
  writeImportStatements();
  if (resourcePath != null) {
    writer.write("String_Node_Str" + resourcePath + "String_Node_Str");
  }
  writer.write("String_Node_Str" + className + "String_Node_Str"+ baseClassName+ "String_Node_Str");
}
Program: 30311
Project: 30311
Buggy source:
@Override public String endGeneration(){
  File file=new File(generationDir + "String_Node_Str");
  try {
    file.createNewFile();
    FileWriter fstream=new FileWriter(file);
    BufferedWriter out=new BufferedWriter(fstream);
    out.write("String_Node_Str" + new Date() + "String_Node_Str");
    out.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return "String_Node_Str" + generationDir;
}

Fixed version (ground truth):
@Override public String endGeneration(){
  File file=new File(generationDir + "String_Node_Str");
  BufferedWriter out=null;
  try {
    if (file.createNewFile()) {
      FileWriter fstream=new FileWriter(file);
      out=new BufferedWriter(fstream);
      out.write("String_Node_Str" + new Date() + "String_Node_Str");
    }
 else {
      Logger.getLogger(TextResourcesGenerator.class.getName()).log(Level.SEVERE,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException ex) {
        Logger.getLogger(TextResourcesGenerator.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
  }
  return "String_Node_Str" + generationDir;
}
Program: 30312
Project: 30312
Buggy source:
public TextResourcesGenerator(String outputDir,Habitat habitat){
  super(habitat);
  generationDir=new File(outputDir);
  generationDir.mkdirs();
}

Fixed version (ground truth):
public TextResourcesGenerator(String outputDir,Habitat habitat){
  super(habitat);
  generationDir=new File(outputDir);
  if (!generationDir.mkdirs()) {
    throw new RuntimeException("String_Node_Str" + outputDir);
  }
}
Program: 30313
Project: 30313
Buggy source:
private String getBeanName(String elementName){
  String ret="String_Node_Str";
  boolean nextisUpper=true;
  for (int i=0; i < elementName.length(); i++) {
    if (nextisUpper == true) {
      ret=ret + elementName.substring(i,i + 1).toUpperCase(Locale.US);
      nextisUpper=false;
    }
 else {
      if (elementName.charAt(i) == '-') {
        nextisUpper=true;
      }
 else {
        nextisUpper=false;
        ret=ret + elementName.substring(i,i + 1);
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
private String getBeanName(String elementName){
  StringBuilder ret=new StringBuilder();
  boolean nextisUpper=true;
  for (int i=0; i < elementName.length(); i++) {
    if (nextisUpper == true) {
      ret.append(elementName.substring(i,i + 1).toUpperCase(Locale.US));
      nextisUpper=false;
    }
 else {
      if (elementName.charAt(i) == '-') {
        nextisUpper=true;
      }
 else {
        nextisUpper=false;
        ret.append(elementName.substring(i,i + 1));
      }
    }
  }
  return ret.toString();
}
Program: 30314
Project: 30314
Buggy source:
@GET public String get(@QueryParam("String_Node_Str") String outputDir){
  if (outputDir == null) {
    outputDir=DEFAULT_OUTPUT_DIR;
  }
  baseDirectory=new File(outputDir);
  baseDirectory.mkdirs();
  String retVal="String_Node_Str" + outputDir + "String_Node_Str";
  try {
    generateClasses();
  }
 catch (  Exception ex) {
    Logger.getLogger(GeneratorResource.class.getName()).log(Level.SEVERE,null,ex);
    retVal="String_Node_Str" + ex.toString() + "String_Node_Str";
  }
  return retVal;
}

Fixed version (ground truth):
@GET public String get(@QueryParam("String_Node_Str") String outputDir){
  String retVal="String_Node_Str" + outputDir + "String_Node_Str";
  if (outputDir == null) {
    outputDir=DEFAULT_OUTPUT_DIR;
  }
  baseDirectory=new File(outputDir);
  boolean success=baseDirectory.mkdirs();
  if (success) {
    try {
      generateClasses();
    }
 catch (    Exception ex) {
      Logger.getLogger(GeneratorResource.class.getName()).log(Level.SEVERE,null,ex);
      retVal="String_Node_Str" + ex.toString() + "String_Node_Str";
    }
  }
 else {
    retVal="String_Node_Str";
  }
  return retVal;
}
Program: 30315
Project: 30315
Buggy source:
protected void writeClassFile(String className,StringBuilder source){
  File classFile=new File(baseDirectory,className + "String_Node_Str");
  try {
    BufferedWriter bw=new BufferedWriter(new FileWriter(classFile));
    bw.write(source.toString());
    bw.close();
  }
 catch (  IOException ioe) {
    throw new RuntimeException(ioe);
  }
}

Fixed version (ground truth):
protected void writeClassFile(String className,StringBuilder source){
  File classFile=new File(baseDirectory,className + "String_Node_Str");
  BufferedWriter bw=null;
  try {
    bw=new BufferedWriter(new FileWriter(classFile));
    bw.write(source.toString());
  }
 catch (  IOException ioe) {
    throw new RuntimeException(ioe);
  }
 finally {
    if (bw != null) {
      try {
        bw.close();
      }
 catch (      IOException ex) {
        Logger.getLogger(ClientGeneratorBaseResource.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
  }
}
Program: 30318
Project: 30318
Buggy source:
public void prepareForUndeploy(String appName,ReadableArchive archive,DeploymentContext dc){
  logger.entering(getClass().getName(),"String_Node_Str");
  Set<Plugin> installedPlugins=getPlugins();
  ServiceMetadata appServiceMetadata=getServiceMetadata(appName);
  if (appServiceMetadata == null) {
    appServiceMetadata=serviceDependencyDiscovery(appName,archive,installedPlugins);
    serviceMetadata.put(appName,appServiceMetadata);
  }
  Set<ProvisionedService> appProvisionedServices=getProvisionedServices(appName);
  if (appProvisionedServices == null) {
    Set<ProvisionedService> provisionedServiceSet=retrieveProvisionedServices(installedPlugins,appServiceMetadata,dc);
    provisionedServices.put(appName,provisionedServiceSet);
  }
  dissociateProvisionedServices(installedPlugins,appServiceMetadata,appProvisionedServices,true,dc);
}

Fixed version (ground truth):
public void prepareForUndeploy(String appName,ReadableArchive archive,DeploymentContext dc){
  logger.entering(getClass().getName(),"String_Node_Str");
  Set<Plugin> installedPlugins=getPlugins();
  ServiceMetadata appServiceMetadata=getServiceMetadata(appName);
  if (appServiceMetadata == null) {
    appServiceMetadata=serviceDependencyDiscovery(appName,archive,installedPlugins);
    serviceMetadata.put(appName,appServiceMetadata);
  }
  Set<ProvisionedService> appProvisionedServices=getProvisionedServices(appName);
  if (appProvisionedServices == null) {
    appProvisionedServices=retrieveProvisionedServices(installedPlugins,appServiceMetadata,dc);
    provisionedServices.put(appName,appProvisionedServices);
  }
  dissociateProvisionedServices(installedPlugins,appServiceMetadata,appProvisionedServices,true,dc);
}
Program: 30319
Project: 30319
Buggy source:
@Override public void customize(VirtualCluster cluster,VirtualMachine virtualMachine) throws VirtException {
  ActionReport report=services.forContract(ActionReport.class).named("String_Node_Str").get();
  final String nodeName=virtualMachine.getServerPool().getName() + "String_Node_Str" + virtualMachine.getMachine().getName()+ "String_Node_Str"+ virtualMachine.getName();
  String installDir=virtualMachine.getProperty(VirtualMachine.PropertyName.INSTALL_DIR);
  rtContext.executeAdminCommand(report,"String_Node_Str",nodeName,"String_Node_Str",virtualMachine.getAddress(),"String_Node_Str",virtualMachine.getUser().getUserId(),"String_Node_Str",installDir);
  if (report.hasFailures()) {
    return;
  }
  rtContext.executeAdminCommand(report,"String_Node_Str",nodeName + "String_Node_Str","String_Node_Str",nodeName,"String_Node_Str",cluster.getConfig().getName());
}

Fixed version (ground truth):
@Override public void customize(VirtualCluster cluster,VirtualMachine virtualMachine) throws VirtException {
  ActionReport report=services.forContract(ActionReport.class).named("String_Node_Str").get();
  final String nodeName=virtualMachine.getServerPool().getName() + "String_Node_Str" + virtualMachine.getMachine().getName()+ "String_Node_Str"+ virtualMachine.getName();
  String installDir=virtualMachine.getProperty(VirtualMachine.PropertyName.INSTALL_DIR);
  rtContext.executeAdminCommand(report,"String_Node_Str",nodeName,"String_Node_Str",virtualMachine.getAddress(),"String_Node_Str",virtualMachine.getUser().getName(),"String_Node_Str",installDir);
  if (report.hasFailures()) {
    return;
  }
  rtContext.executeAdminCommand(report,"String_Node_Str",nodeName + "String_Node_Str","String_Node_Str",nodeName,"String_Node_Str",cluster.getConfig().getName());
}
Program: 30320
Project: 30320
Buggy source:
private void addDomain(Domain domain) throws VirtException {
  String domainName=domain.getName();
  if (!domains.containsKey(domainName)) {
    for (    Cluster cluster : domainConfig.getClusters().getCluster()) {
      for (      VirtualMachineConfig vmc : cluster.getExtensionsByType(VirtualMachineConfig.class)) {
        if (vmc.getName().equals(domainName)) {
          LibVirtVirtualMachine gfVM=new LibVirtVirtualMachine(this,domain);
          domains.put(domainName,gfVM);
          return;
        }
      }
    }
  }
}

Fixed version (ground truth):
private void addDomain(Domain domain,Collection<StorageVol> volumes) throws VirtException {
  String domainName=domain.getName();
  if (!domains.containsKey(domainName)) {
    for (    Cluster cluster : domainConfig.getClusters().getCluster()) {
      for (      VirtualMachineConfig vmc : cluster.getExtensionsByType(VirtualMachineConfig.class)) {
        if (vmc.getName().equals(domainName)) {
          List<StorageVol> storageVols=new ArrayList<StorageVol>();
          for (          StorageVol storageVol : volumes) {
            if (storageVol.getName().startsWith(domainName)) {
              storageVols.add(storageVol);
            }
          }
          LibVirtVirtualMachine gfVM=new LibVirtVirtualMachine(vmc.getTemplate().getUser(),this,domain,storageVols);
          domains.put(domainName,gfVM);
          return;
        }
      }
    }
  }
}
Program: 30321
Project: 30321
Buggy source:
private void populate() throws VirtException {
  if (getIpAddress() == null) {
    RuntimeContext.logger.log(Level.INFO,"String_Node_Str" + getName());
    return;
  }
  try {
    Connect connection=connection();
    if (connection != null) {
      populateStoragePools(connection().listStoragePools());
      populateDomain(connection().listDomains());
      populateDomain(connection().listDefinedDomains());
    }
  }
 catch (  VirtException e) {
    RuntimeContext.logger.log(Level.SEVERE,"String_Node_Str",e);
    throw e;
  }
}

Fixed version (ground truth):
private void populate() throws VirtException {
  if (getIpAddress() == null) {
    RuntimeContext.logger.log(Level.INFO,"String_Node_Str" + getName());
    return;
  }
  try {
    Connect connection=connection();
    if (connection != null) {
      populateStoragePools(connection().listStoragePools());
      Collection<StorageVol> storageVols=new ArrayList<StorageVol>();
      for (      StoragePool pool : storagePools.values()) {
        for (        StorageVol vol : pool.volumes()) {
          storageVols.add(vol);
        }
      }
      for (      int domainId : connection().listDomains()) {
        try {
          populateDomain(domainId,storageVols);
        }
 catch (        VirtException e) {
          for (          int d : connection().listDomains()) {
            if (d == domainId) {
              throw e;
            }
          }
        }
      }
      for (      String domainId : connection().listDefinedDomains()) {
        try {
          populateDomain(domainId,storageVols);
        }
 catch (        VirtException e) {
          for (          String d : connection().listDefinedDomains()) {
            if (d.equals(domainId)) {
              throw e;
            }
          }
        }
      }
    }
  }
 catch (  VirtException e) {
    RuntimeContext.logger.log(Level.SEVERE,"String_Node_Str",e);
    throw e;
  }
}
Program: 30322
Project: 30322
Buggy source:
private void populateDomain(String[] domainIds) throws VirtException {
  for (  String domainId : domainIds) {
    addDomain(connect.domainLookupByName(domainId));
  }
}

Fixed version (ground truth):
private void populateDomain(String domainId,Collection<StorageVol> volumes) throws VirtException {
  addDomain(connect.domainLookupByName(domainId),volumes);
}
Program: 30324
Project: 30324
Buggy source:
protected LibVirtVirtualMachine(Machine owner,Domain domain) throws VirtException {
  this.domain=domain;
  this.owner=owner;
  this.name=domain.getName();
}

Fixed version (ground truth):
protected LibVirtVirtualMachine(VirtUser user,Machine owner,Domain domain,List<StorageVol> storageVols) throws VirtException {
  super(user);
  this.domain=domain;
  this.owner=owner;
  this.name=domain.getName();
  this.storageVols=new ArrayList<StorageVol>(storageVols);
}