nus-yam/ex-repair huggingface dataset:
Program: 14659
Project: 14659
Buggy source:
public static <P extends HasName<P>>TransitionAction<P> callbackAsAction(final Callback<P> callback){
  TransitionAction<P> action=new AbstractTransitionAction<P>(){
    @Override public void leave(    P parent,    Callback.Completion transitionCallback){
      try {
        callback.fire(parent);
        transitionCallback.fire();
      }
 catch (      Exception ex) {
        LOG.error(ex);
        transitionCallback.fireException(ex);
      }
    }
  }
;
  return action;
}

Fixed version (ground truth):
public static <P extends HasName<P>>TransitionAction<P> callbackAsAction(final Callback<P> callback){
  TransitionAction<P> action=new AbstractTransitionAction<P>(){
    @Override public void leave(    P parent,    Callback.Completion transitionCallback){
      try {
        callback.fire(parent);
        transitionCallback.fire();
      }
 catch (      RuntimeException ex) {
        LOG.error(ex);
        transitionCallback.fireException(ex);
      }
    }
  }
;
  return action;
}
Program: 14660
Project: 14660
Buggy source:
public static <P extends HasName<P>>TransitionListener<P> callbackAsListener(final Callback<P> p){
  return new TransitionListener<P>(){
    @Override public boolean before(    P parent){
      return true;
    }
    @Override public void leave(    P parent){
      try {
        p.fire(parent);
      }
 catch (      Exception ex) {
        LOG.error(ex,ex);
      }
    }
    @Override public void enter(    P parent){
    }
    @Override public void after(    P parent){
    }
  }
;
}

Fixed version (ground truth):
public static <P extends HasName<P>>TransitionListener<P> callbackAsListener(final Callback<P> p){
  return new TransitionListener<P>(){
    @Override public boolean before(    P parent){
      return true;
    }
    @Override public void leave(    P parent){
      try {
        p.fire(parent);
      }
 catch (      Exception ex) {
        LOG.error(ex);
        Logs.extreme().error(ex,ex);
      }
    }
    @Override public void enter(    P parent){
    }
    @Override public void after(    P parent){
    }
  }
;
}
Program: 14661
Project: 14661
Buggy source:
public static <P extends HasName<P>>TransitionAction<P> predicateAsAction(final Predicate<P> predicate){
  TransitionAction<P> action=new AbstractTransitionAction<P>(){
    @Override public void leave(    P parent,    Callback.Completion transitionCallback){
      try {
        if (!predicate.apply(parent)) {
          transitionCallback.fireException(Transitions.exceptionOnCondition("String_Node_Str" + parent + "String_Node_Str",predicate));
        }
 else {
          transitionCallback.fire();
        }
      }
 catch (      Exception ex) {
        LOG.error(ex);
        transitionCallback.fireException(ex);
      }
    }
  }
;
  return action;
}

Fixed version (ground truth):
public static <P extends HasName<P>>TransitionAction<P> predicateAsAction(final Predicate<P> predicate){
  TransitionAction<P> action=new AbstractTransitionAction<P>(){
    @Override public void leave(    P parent,    Callback.Completion transitionCallback){
      try {
        if (!predicate.apply(parent)) {
          transitionCallback.fireException(Transitions.exceptionOnCondition("String_Node_Str" + parent + "String_Node_Str",predicate));
        }
 else {
          transitionCallback.fire();
        }
      }
 catch (      RuntimeException ex) {
        Logs.extreme().error(ex,ex);
        transitionCallback.fireException(ex);
      }
    }
  }
;
  return action;
}
Program: 14663
Project: 14663
Buggy source:
@Override public void initialize(final VmRunType msg){
  try {
    this.token.submit();
  }
 catch (  final NoSuchTokenException e2) {
    LOG.debug(e2,e2);
  }
  EntityTransaction db=Entities.get(VmInstance.class);
  try {
    final VmInstance vm=VmInstances.lookup(msg.getInstanceId());
    msg.setUserId(vm.getOwnerUserId());
    msg.setOwnerId(vm.getOwnerUserId());
    msg.setAccountId(vm.getOwnerAccountNumber());
    if (VmState.STOPPED.equals(vm.getState())) {
      vm.setState(VmState.PENDING);
    }
 else     if (!VmState.PENDING.equals(vm.getState())) {
      throw new EucalyptusClusterException("String_Node_Str");
    }
    db.commit();
  }
 catch (  final Exception e) {
    this.token.abort();
    db.rollback();
    LOG.debug(e,e);
    throw new EucalyptusClusterException("String_Node_Str" + this.getRequest(),e);
  }
}

Fixed version (ground truth):
@Override public void initialize(final VmRunType msg){
  try {
    this.token.submit();
  }
 catch (  final NoSuchTokenException e2) {
    LOG.debug(e2,e2);
  }
  EntityTransaction db=Entities.get(VmInstance.class);
  try {
    final VmInstance vm=VmInstances.lookup(msg.getInstanceId());
    msg.setUserId(vm.getOwnerUserId());
    msg.setOwnerId(vm.getOwnerUserId());
    msg.setAccountId(vm.getOwnerAccountNumber());
    if (VmState.STOPPED.equals(vm.getState())) {
      vm.setState(VmState.PENDING);
    }
 else     if (!VmState.PENDING.equals(vm.getState())) {
      throw new EucalyptusClusterException("String_Node_Str");
    }
    db.commit();
  }
 catch (  final Exception e) {
    LOG.error(e);
    Logs.extreme().error(e,e);
    db.rollback();
    try {
      this.token.abort();
    }
 catch (    Exception ex) {
      LOG.error(ex);
      Logs.extreme().error(ex,ex);
    }
    throw new EucalyptusClusterException("String_Node_Str" + this.getRequest(),e);
  }
}
Program: 14665
Project: 14665
Buggy source:
public static void awaitSynchronized(){
  if (!isSynchronizing()) {
    return;
  }
 else {
    Collection<StackTraceElement> stack=Threads.filteredStack(stackFilter);
    String caller=(stack.isEmpty() ? "String_Node_Str" : stack.iterator().next().toString());
    for (int i=0; i < MAX_TX_START_SYNC_RETRIES && isSynchronizing(); i++) {
      try {
        TimeUnit.MILLISECONDS.sleep(1000);
        LOG.debug("String_Node_Str" + caller);
      }
 catch (      InterruptedException ex) {
        Exceptions.maybeInterrupted(ex);
        return;
      }
    }
    throw new DatabaseStateException("String_Node_Str" + Hosts.listDatabases() + "String_Node_Str"+ Joiner.on("String_Node_Str").join(stack));
  }
}

Fixed version (ground truth):
public static void awaitSynchronized(){
  if (!isSynchronizing()) {
    return;
  }
 else {
    Collection<StackTraceElement> stack=Threads.filteredStack(stackFilter);
    String caller=(stack.isEmpty() ? "String_Node_Str" : stack.iterator().next().toString());
    for (int i=0; i < MAX_TX_START_SYNC_RETRIES && isSynchronizing(); i++) {
      try {
        TimeUnit.MILLISECONDS.sleep(1000);
        LOG.debug("String_Node_Str" + caller);
      }
 catch (      InterruptedException ex) {
        Exceptions.maybeInterrupted(ex);
        return;
      }
    }
    if (!isSynchronized()) {
      throw new DatabaseStateException("String_Node_Str" + Hosts.listDatabases() + "String_Node_Str"+ Joiner.on("String_Node_Str").join(stack));
    }
  }
}
Program: 14666
Project: 14666
Buggy source:
@Override public CheckException next(){
  return this.curr=this.curr.other;
}

Fixed version (ground truth):
@Override public CheckException next(){
  CheckException ret=this.next;
  this.next=(ret != null ? ret.other : null);
  return ret;
}
Program: 14667
Project: 14667
Buggy source:
@Override public Iterator<CheckException> iterator(){
  return new Iterator<CheckException>(){
    CheckException curr;
{
      this.curr=CheckException.this.other;
    }
    @Override public boolean hasNext(){
      return (this.curr != null) && (this.curr.other != null);
    }
    @Override public CheckException next(){
      return this.curr=this.curr.other;
    }
    @Override public void remove(){
      LOG.error("String_Node_Str");
    }
  }
;
}

Fixed version (ground truth):
@Override public Iterator<CheckException> iterator(){
  return new Iterator<CheckException>(){
    CheckException next;
{
      this.next=CheckException.this;
    }
    @Override public boolean hasNext(){
      return this.next != null;
    }
    @Override public CheckException next(){
      CheckException ret=this.next;
      this.next=(ret != null ? ret.other : null);
      return ret;
    }
    @Override public void remove(){
      LOG.error("String_Node_Str");
    }
  }
;
}
Program: 14668
Project: 14668
Buggy source:
public static void persist(final CheckException errors){
  if (errors != null && Hosts.isCoordinator()) {
    try {
      for (      final CheckException e : errors) {
        final EntityTransaction db=Entities.get(CheckException.class);
        try {
          Entities.persist(e);
          db.commit();
        }
 catch (        final Exception ex) {
          LOG.error("String_Node_Str" + ex,ex);
          db.rollback();
        }
      }
    }
 catch (    Exception ex) {
      Logs.extreme().error(ex,ex);
    }
  }
}

Fixed version (ground truth):
public static void persist(final CheckException errors){
  if (errors != null && Hosts.isCoordinator()) {
    try {
      for (      final CheckException e : errors) {
        final EntityTransaction db=Entities.get(CheckException.class);
        try {
          Entities.persist(e);
          db.commit();
        }
 catch (        final Exception ex) {
          LOG.error("String_Node_Str" + ex,ex);
          db.rollback();
        }
      }
    }
 catch (    Exception ex) {
      LOG.error("String_Node_Str" + errors);
      Logs.extreme().error(ex,ex);
    }
  }
}
Program: 14669
Project: 14669
Buggy source:
private static CheckException chain(final ServiceConfiguration config,final Severity severity,final List<? extends Throwable> exs){
  CheckException last=null;
  for (  final Throwable ex : Lists.reverse(exs)) {
    if ((last != null) && (ex instanceof CheckException)) {
      last.other=(CheckException)ex;
    }
 else     if (last == null) {
      last=new CheckException(config,severity,ex);
    }
  }
  last=(last != null ? last : new CheckException(config,Severity.DEBUG,new NullPointerException("String_Node_Str" + exs)));
  return last;
}

Fixed version (ground truth):
private static CheckException chain(final ServiceConfiguration config,final Severity severity,final List<? extends Throwable> exs){
  try {
    CheckException last=null;
    for (    final Throwable ex : Lists.reverse(exs)) {
      if ((last != null) && (ex instanceof CheckException)) {
        last.other=(CheckException)ex;
      }
 else       if (last == null) {
        last=new CheckException(config,severity,ex);
      }
    }
    last=(last != null ? last : new CheckException(config,Severity.DEBUG,new NullPointerException("String_Node_Str" + exs)));
    return last;
  }
 catch (  Exception ex) {
    LOG.error("String_Node_Str" + ex);
    Logs.extreme().error(ex,ex);
    return new CheckException(config,Severity.ERROR,ex);
  }
}
Program: 14670
Project: 14670
Buggy source:
@Override public boolean hasNext(){
  return (this.curr != null) && (this.curr.other != null);
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  return this.next != null;
}
Program: 14671
Project: 14671
Buggy source:
private static void processTransition(final ServiceConfiguration parent,final Completion transitionCallback,final TransitionActions transitionAction){
  ServiceTransitionCallback trans=null;
  try {
    if (Hosts.isServiceLocal(parent)) {
      trans=ServiceLocalTransitionCallbacks.valueOf(transitionAction.name());
    }
 else     if (Hosts.isCoordinator()) {
      trans=CloudRemoteTransitionCallbacks.valueOf(transitionAction.name());
    }
 else {
      trans=ServiceRemoteTransitionNotification.valueOf(transitionAction.name());
    }
    if (trans != null) {
      Logs.exhaust().debug("String_Node_Str" + trans.getClass() + "String_Node_Str"+ transitionAction.name()+ "String_Node_Str"+ parent);
      trans.fire(parent);
    }
    transitionCallback.fire();
  }
 catch (  Exception ex) {
    LOG.error(parent.getFullName() + "String_Node_Str" + transitionAction.name()+ "String_Node_Str"+ ex.getMessage());
    if (Faults.filter(parent,ex)) {
      transitionCallback.fireException(ex);
      Faults.persist(Faults.failure(parent,ex));
      throw Exceptions.toUndeclared(ex);
    }
 else {
      Faults.persist(Faults.advisory(parent,ex));
      transitionCallback.fire();
    }
  }
}

Fixed version (ground truth):
private static void processTransition(final ServiceConfiguration parent,final Completion transitionCallback,final TransitionActions transitionAction){
  ServiceTransitionCallback trans=null;
  try {
    if (Hosts.isServiceLocal(parent)) {
      trans=ServiceLocalTransitionCallbacks.valueOf(transitionAction.name());
    }
 else     if (Hosts.isCoordinator()) {
      trans=CloudRemoteTransitionCallbacks.valueOf(transitionAction.name());
    }
 else {
      trans=ServiceRemoteTransitionNotification.valueOf(transitionAction.name());
    }
    if (trans != null) {
      Logs.exhaust().debug("String_Node_Str" + trans.getClass() + "String_Node_Str"+ transitionAction.name()+ "String_Node_Str"+ parent);
      trans.fire(parent);
    }
    transitionCallback.fire();
  }
 catch (  Exception ex) {
    LOG.error(parent.getFullName() + "String_Node_Str" + transitionAction.name()+ "String_Node_Str"+ ex.getMessage());
    if (Faults.filter(parent,ex)) {
      transitionCallback.fireException(ex);
      Faults.persist(Faults.failure(parent,ex));
      throw Exceptions.toUndeclared(ex);
    }
 else {
      transitionCallback.fire();
      Faults.persist(Faults.advisory(parent,ex));
    }
  }
}
Program: 14672
Project: 14672
Buggy source:
private void error(Throwable t){
  Logs.extreme().error("String_Node_Str" + this.toString(),t);
  if (!this.state.isMarked()) {
    IllegalStateException ex=new IllegalStateException("String_Node_Str" + this.toString(),t);
    Logs.extreme().error(ex);
    ActiveTransition tr=this.currentTransition.getAndSet(null);
    if (tr != null) {
      tr.getTransitionFuture().setException(t);
      this.state.set(tr.getTransitionRule().getErrorState(),false);
    }
  }
 else {
    ActiveTransition tr=this.currentTransition.getAndSet(null);
    Logs.extreme().error("String_Node_Str" + this.toString() + "String_Node_Str"+ tr.startStackTrace);
    Logs.extreme().error("String_Node_Str" + this.toString() + "String_Node_Str"+ tr.endStackTrace);
    this.state.set(tr.getTransitionRule().getErrorState(),tr.getTransitionRule().getErrorStateMark());
    if (!tr.getTransitionRule().getFromState().equals(tr.getTransitionRule().getErrorState())) {
      this.state.set(tr.getTransitionRule().getErrorState(),false);
      this.fireInListeners(tr.getTransitionRule().getErrorState());
    }
 else {
      this.state.set(tr.getTransitionRule().getErrorState(),false);
    }
    EventRecord.caller(this.getClass(),EventType.TRANSITION_FUTURE,"String_Node_Str" + t.getClass().getCanonicalName() + "String_Node_Str"+ t.getMessage()).trace();
    tr.getTransitionFuture().setException(t);
  }
}

Fixed version (ground truth):
private void error(Throwable t){
  Logs.extreme().error("String_Node_Str" + this.toString(),t);
  if (!this.state.isMarked()) {
    IllegalStateException ex=new IllegalStateException("String_Node_Str" + this.toString(),t);
    Logs.extreme().error(ex);
    ActiveTransition tr=this.currentTransition.getAndSet(null);
    if (tr != null) {
      tr.getTransitionFuture().setException(t);
      this.state.set(tr.getTransitionRule().getErrorState(),false);
    }
  }
 else {
    ActiveTransition tr=this.currentTransition.getAndSet(null);
    if (tr != null) {
      Logs.extreme().error("String_Node_Str" + this.toString() + "String_Node_Str"+ tr.startStackTrace);
      Logs.extreme().error("String_Node_Str" + this.toString() + "String_Node_Str"+ tr.endStackTrace);
      this.state.set(tr.getTransitionRule().getErrorState(),tr.getTransitionRule().getErrorStateMark());
      if (!tr.getTransitionRule().getFromState().equals(tr.getTransitionRule().getErrorState())) {
        this.state.set(tr.getTransitionRule().getErrorState(),false);
        this.fireInListeners(tr.getTransitionRule().getErrorState());
      }
 else {
        this.state.set(tr.getTransitionRule().getErrorState(),false);
      }
      EventRecord.caller(this.getClass(),EventType.TRANSITION_FUTURE,"String_Node_Str" + t.getClass().getCanonicalName() + "String_Node_Str"+ t.getMessage()).trace();
      tr.getTransitionFuture().setException(t);
    }
  }
}
Program: 14673
Project: 14673
Buggy source:
private void rollback(Throwable t){
  LOG.debug("String_Node_Str" + this.toString());
  if (!this.state.isMarked()) {
    Exceptions.trace(new IllegalStateException("String_Node_Str" + this.toString()));
  }
 else {
    ActiveTransition tr=this.currentTransition.getAndSet(null);
    this.state.set(tr.getTransitionRule().getFromState(),false);
  }
}

Fixed version (ground truth):
private void rollback(Throwable t){
  LOG.debug("String_Node_Str" + this.toString());
  if (!this.state.isMarked()) {
    Exceptions.trace(new IllegalStateException("String_Node_Str" + this.toString()));
  }
 else {
    ActiveTransition tr=this.currentTransition.getAndSet(null);
    if (tr != null) {
      this.state.set(tr.getTransitionRule().getFromState(),false);
    }
  }
}
Program: 14674
Project: 14674
Buggy source:
private static void runDbStateChange(Function<String,Runnable> runnableFunction){
  LOG.info("String_Node_Str" + runnableFunction);
  try {
    if (canHas.writeLock().tryLock(30000L,TimeUnit.MILLISECONDS)) {
      try {
        Map<Runnable,Future<Runnable>> runnables=Maps.newHashMap();
        for (        final String ctx : PersistenceContexts.list()) {
          Runnable run=runnableFunction.apply(ctx);
          runnables.put(run,ExecuteRunnable.INSTANCE.apply(run));
        }
        Map<Runnable,Future<Runnable>> succeeded=Futures.waitAll(runnables);
        MapDifference<Runnable,Future<Runnable>> failed=Maps.difference(runnables,succeeded);
        StringBuilder builder=new StringBuilder();
        builder.append(Joiner.on("String_Node_Str").join(succeeded.keySet()));
        builder.append(Joiner.on("String_Node_Str").join(failed.entriesOnlyOnLeft().keySet()));
        Logs.extreme().debug(builder.toString());
        if (!failed.entriesOnlyOnLeft().isEmpty()) {
          throw Exceptions.toUndeclared(builder.toString());
        }
      }
  finally {
        canHas.writeLock().unlock();
      }
    }
 else {
      throw Exceptions.toUndeclared("String_Node_Str" + runnableFunction);
    }
  }
 catch (  InterruptedException ex) {
    Exceptions.maybeInterrupted(ex);
  }
catch (  RuntimeException ex) {
    LOG.error(ex);
    Logs.extreme().error(ex,ex);
    throw ex;
  }
}

Fixed version (ground truth):
private static void runDbStateChange(Function<String,Runnable> runnableFunction){
  LOG.info("String_Node_Str" + runnableFunction);
  try {
    if (canHas.writeLock().tryLock()) {
      try {
        Map<Runnable,Future<Runnable>> runnables=Maps.newHashMap();
        for (        final String ctx : PersistenceContexts.list()) {
          Runnable run=runnableFunction.apply(ctx);
          runnables.put(run,ExecuteRunnable.INSTANCE.apply(run));
        }
        Map<Runnable,Future<Runnable>> succeeded=Futures.waitAll(runnables);
        MapDifference<Runnable,Future<Runnable>> failed=Maps.difference(runnables,succeeded);
        StringBuilder builder=new StringBuilder();
        builder.append(Joiner.on("String_Node_Str").join(succeeded.keySet()));
        builder.append(Joiner.on("String_Node_Str").join(failed.entriesOnlyOnLeft().keySet()));
        Logs.extreme().debug(builder.toString());
        if (!failed.entriesOnlyOnLeft().isEmpty()) {
          throw Exceptions.toUndeclared(builder.toString());
        }
      }
  finally {
        canHas.writeLock().unlock();
      }
    }
 else {
      throw Exceptions.toUndeclared("String_Node_Str" + runnableFunction);
    }
  }
 catch (  RuntimeException ex) {
    LOG.error(ex);
    Logs.extreme().error(ex,ex);
    throw ex;
  }
}
Program: 14675
Project: 14675
Buggy source:
static boolean enable(final Host host){
  if (!host.hasDatabase() || !Bootstrap.isLoaded()) {
    return false;
  }
 else {
    if (host.isLocalHost()) {
      if (syncState.compareAndSet(SyncState.NOTSYNCED,SyncState.SYNCING)) {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          syncState.set(SyncState.SYNCED);
          return true;
        }
 catch (        Exception ex) {
          runDbStateChange(DeactivateHostFunction.INSTANCE.apply(host.getDisplayName()));
          syncState.set(SyncState.NOTSYNCED);
          return false;
        }
      }
 else {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          return true;
        }
 catch (        Exception ex) {
          return false;
        }
      }
    }
 else {
      try {
        runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
        return true;
      }
 catch (      Exception ex) {
        return false;
      }
    }
  }
}

Fixed version (ground truth):
static boolean enable(final Host host){
  if (!host.hasDatabase() || !Bootstrap.isLoaded()) {
    return false;
  }
 else {
    if (host.isLocalHost()) {
      if (syncState.compareAndSet(SyncState.NOTSYNCED,SyncState.SYNCING)) {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          syncState.set(SyncState.SYNCED);
          return true;
        }
 catch (        Exception ex) {
          try {
            runDbStateChange(DeactivateHostFunction.INSTANCE.apply(host.getDisplayName()));
          }
 catch (          Exception ex1) {
            LOG.error("String_Node_Str" + ex.getMessage());
            Logs.extreme().error(ex,ex);
          }
 finally {
            syncState.set(SyncState.NOTSYNCED);
          }
          return false;
        }
      }
 else {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          return true;
        }
 catch (        Exception ex) {
          return false;
        }
      }
    }
 else {
      try {
        runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
        return true;
      }
 catch (      Exception ex) {
        return false;
      }
    }
  }
}
Program: 14677
Project: 14677
Buggy source:
BasicService(final ServiceConfiguration serviceConfiguration){
  super();
  this.serviceConfiguration=serviceConfiguration;
  this.stateMachine=new ServiceState(this.serviceConfiguration);
  URI remoteUri;
  if (this.getServiceConfiguration().isVmLocal()) {
    remoteUri=ServiceUris.internal(this.getServiceConfiguration().getComponentId());
  }
 else {
    remoteUri=ServiceUris.internal(this.getServiceConfiguration());
  }
  if (this.serviceConfiguration.isVmLocal()) {
    ComponentId compId=BasicService.this.serviceConfiguration.getComponentId();
    if (compId.isAlwaysLocal()) {
      compId=Eucalyptus.INSTANCE;
    }
    OrderedShutdown.registerShutdownHook(compId.getClass(),new Runnable(){
      @Override public void run(){
        try {
          LOG.warn("String_Node_Str" + BasicService.this.serviceConfiguration.getName());
          ServiceTransitions.pathTo(BasicService.this.serviceConfiguration,Component.State.PRIMORDIAL).get();
        }
 catch (        final InterruptedException ex) {
          Thread.currentThread().interrupt();
        }
catch (        final ExecutionException ex) {
          LOG.error(ex,ex);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
BasicService(final ServiceConfiguration serviceConfiguration){
  super();
  this.serviceConfiguration=serviceConfiguration;
  this.stateMachine=new ServiceState(this.serviceConfiguration);
  URI remoteUri;
  if (this.getServiceConfiguration().isVmLocal()) {
    remoteUri=ServiceUris.internal(this.getServiceConfiguration().getComponentId());
  }
 else {
    remoteUri=ServiceUris.internal(this.getServiceConfiguration());
  }
  if (this.serviceConfiguration.isVmLocal()) {
    ComponentId compId=BasicService.this.serviceConfiguration.getComponentId();
    OrderedShutdown.registerShutdownHook(compId.getClass(),new Runnable(){
      @Override public void run(){
        try {
          LOG.warn("String_Node_Str" + BasicService.this.serviceConfiguration.getName());
          ServiceTransitions.pathTo(BasicService.this.serviceConfiguration,Component.State.PRIMORDIAL).get();
        }
 catch (        final InterruptedException ex) {
          Thread.currentThread().interrupt();
        }
catch (        final ExecutionException ex) {
          LOG.error(ex,ex);
        }
      }
    }
);
  }
}
Program: 14678
Project: 14678
Buggy source:
private ServiceContextManager(){
  this.canHasRead=this.canHas.readLock();
  this.canHasWrite=this.canHas.writeLock();
  OrderedShutdown.registerShutdownHook(Empyrean.class,new Runnable(){
    @Override public void run(){
      ServiceContextManager.shutdown();
    }
  }
);
}

Fixed version (ground truth):
private ServiceContextManager(){
  this.canHasRead=this.canHas.readLock();
  this.canHasWrite=this.canHas.writeLock();
  OrderedShutdown.registerPreShutdownHook(new Runnable(){
    @Override public void run(){
      ServiceContextManager.shutdown();
    }
  }
);
}
Program: 14679
Project: 14679
Buggy source:
public static void setupTimer(){
synchronized (SystemClock.class) {
    if (timer == null) {
      timer=new Timer("String_Node_Str");
      hzTimer=new Timer("String_Node_Str");
      clock=new SystemClock();
      hertz=new HzClock();
      ListenerRegistry.getInstance().register(ClockTick.class,new Dummy());
      ListenerRegistry.getInstance().register(Hertz.class,new Dummy());
      timer.scheduleAtFixedRate(clock,0,10000);
      hzTimer.scheduleAtFixedRate(hertz,0,1000);
      OrderedShutdown.registerShutdownHook(Empyrean.class,new Runnable(){
        @Override public void run(){
          timer.cancel();
        }
      }
);
      OrderedShutdown.registerShutdownHook(Empyrean.class,new Runnable(){
        @Override public void run(){
          hzTimer.cancel();
        }
      }
);
    }
  }
}

Fixed version (ground truth):
public static void setupTimer(){
synchronized (SystemClock.class) {
    if (timer == null) {
      timer=new Timer("String_Node_Str");
      hzTimer=new Timer("String_Node_Str");
      clock=new SystemClock();
      hertz=new HzClock();
      ListenerRegistry.getInstance().register(ClockTick.class,new Dummy());
      ListenerRegistry.getInstance().register(Hertz.class,new Dummy());
      timer.scheduleAtFixedRate(clock,0,10000);
      hzTimer.scheduleAtFixedRate(hertz,0,1000);
      OrderedShutdown.registerPreShutdownHook(new Runnable(){
        @Override public void run(){
          timer.cancel();
        }
      }
);
      OrderedShutdown.registerPreShutdownHook(new Runnable(){
        @Override public void run(){
          hzTimer.cancel();
        }
      }
);
    }
  }
}
Program: 14680
Project: 14680
Buggy source:
private ThreadPool(final String groupPrefix){
  this.creationPoint=Thread.currentThread().getStackTrace();
  this.name=groupPrefix;
  this.group=new ThreadGroup(this.name);
  this.pool=this.makePool();
  OrderedShutdown.registerShutdownHook(Empyrean.class,new Runnable(){
    @Override public void run(){
      LOG.warn("String_Node_Str" + ThreadPool.this.name + "String_Node_Str");
      if (ThreadPool.this.pool != null) {
        ThreadPool.this.free();
      }
    }
  }
);
}

Fixed version (ground truth):
private ThreadPool(final String groupPrefix){
  this.creationPoint=Thread.currentThread().getStackTrace();
  this.name=groupPrefix;
  this.group=new ThreadGroup(this.name);
  this.pool=this.makePool();
  OrderedShutdown.registerPostShutdownHook(new Runnable(){
    @Override public void run(){
      LOG.warn("String_Node_Str" + ThreadPool.this.name + "String_Node_Str");
      if (ThreadPool.this.pool != null) {
        ThreadPool.this.free();
      }
    }
  }
);
}
Program: 14682
Project: 14682
Buggy source:
@Override public String matchAndApply(String target,HttpServletRequest req,HttpServletResponse resp) throws IOException {
  String redirectHost=null;
  if (!Topology.isEnabledLocally(Eucalyptus.class)) {
    try {
      ServiceConfiguration clc=Topology.lookup(Eucalyptus.class);
      if (clc == null) {
        throw new RuntimeException("String_Node_Str");
      }
      redirectHost=clc.getHostName();
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
      throw new IOException("String_Node_Str");
    }
  }
  String urlStr=req.getRequestURL().toString();
  if (!urlStr.startsWith("String_Node_Str")) {
    redirectHost=(new URL(urlStr)).getHost();
  }
  if (redirectHost != null) {
    resp.sendRedirect(getRedirectUrl(redirectHost,req));
  }
  return target;
}

Fixed version (ground truth):
@Override public String matchAndApply(String target,HttpServletRequest req,HttpServletResponse resp) throws IOException {
  String redirectHost=null;
  if (!Topology.isEnabledLocally(Eucalyptus.class)) {
    try {
      ServiceConfiguration clc=Topology.lookup(Eucalyptus.class);
      if (clc == null) {
        throw new RuntimeException("String_Node_Str");
      }
      redirectHost=clc.getHostName();
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",e);
      throw new IOException("String_Node_Str");
    }
  }
  String urlStr=req.getRequestURL().toString();
  if (redirectHost == null && !urlStr.startsWith("String_Node_Str")) {
    redirectHost=(new URL(urlStr)).getHost();
  }
  if (redirectHost != null) {
    String redirectUrl=getRedirectUrl(redirectHost,req);
    LOG.debug("String_Node_Str" + redirectUrl);
    resp.sendRedirect(redirectUrl);
  }
  return target;
}
Program: 14683
Project: 14683
Buggy source:
/** 
 * Reconstruct the correct redirect URL.
 * @param redirectHost
 * @param req
 * @return
 * @throws MalformedURLException
 */
private static String getRedirectUrl(String redirectHost,HttpServletRequest req) throws MalformedURLException {
  URL url=new URL(req.getRequestURL().toString());
  return String.format("String_Node_Str",redirectHost,HttpServerBootstrapper.HTTPS_PORT,url.getPath() + ((req.getQueryString() != null) ? "String_Node_Str" + req.getQueryString() : "String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Reconstruct the correct redirect URL.
 * @param redirectHost
 * @param req
 * @return
 * @throws MalformedURLException
 */
private static String getRedirectUrl(String redirectHost,HttpServletRequest req) throws MalformedURLException {
  URL url=new URL(req.getRequestURL().toString());
  return "String_Node_Str" + String.format("String_Node_Str",redirectHost,HttpServerBootstrapper.HTTPS_PORT,url.getPath() + ((req.getQueryString() != null) ? "String_Node_Str" + req.getQueryString() : "String_Node_Str")).replaceAll("String_Node_Str","String_Node_Str");
}
Program: 14684
Project: 14684
Buggy source:
private static void runDbStateChange(Function<String,Runnable> runnableFunction){
  LOG.debug("String_Node_Str" + runnableFunction);
  try {
    if (canHas.writeLock().tryLock(30000L,TimeUnit.MILLISECONDS)) {
      try {
        Map<Runnable,Future<Runnable>> runnables=Maps.newHashMap();
        for (        final String ctx : PersistenceContexts.list()) {
          Runnable run=runnableFunction.apply(ctx);
          runnables.put(run,ExecuteRunnable.INSTANCE.apply(run));
        }
        Map<Runnable,Future<Runnable>> succeeded=Futures.waitAll(runnables);
        MapDifference<Runnable,Future<Runnable>> failed=Maps.difference(runnables,succeeded);
        StringBuilder builder=new StringBuilder();
        builder.append(Joiner.on("String_Node_Str").join(succeeded.keySet()));
        builder.append(Joiner.on("String_Node_Str").join(failed.entriesOnlyOnLeft().keySet()));
        LOG.debug(builder.toString());
        if (!failed.entriesOnlyOnLeft().isEmpty()) {
          throw Exceptions.toUndeclared(builder.toString());
        }
      }
  finally {
        canHas.writeLock().unlock();
      }
    }
 else {
      LOG.debug("String_Node_Str" + runnableFunction);
    }
  }
 catch (  InterruptedException ex) {
    Exceptions.maybeInterrupted(ex);
  }
catch (  RuntimeException ex) {
    LOG.error(ex);
    Logs.extreme().error(ex,ex);
    throw ex;
  }
}

Fixed version (ground truth):
private static void runDbStateChange(Function<String,Runnable> runnableFunction){
  LOG.debug("String_Node_Str" + runnableFunction);
  try {
    if (canHas.writeLock().tryLock(30000L,TimeUnit.MILLISECONDS)) {
      try {
        Map<Runnable,Future<Runnable>> runnables=Maps.newHashMap();
        for (        final String ctx : PersistenceContexts.list()) {
          Runnable run=runnableFunction.apply(ctx);
          runnables.put(run,ExecuteRunnable.INSTANCE.apply(run));
        }
        Map<Runnable,Future<Runnable>> succeeded=Futures.waitAll(runnables);
        MapDifference<Runnable,Future<Runnable>> failed=Maps.difference(runnables,succeeded);
        StringBuilder builder=new StringBuilder();
        builder.append(Joiner.on("String_Node_Str").join(succeeded.keySet()));
        builder.append(Joiner.on("String_Node_Str").join(failed.entriesOnlyOnLeft().keySet()));
        LOG.debug(builder.toString());
        if (!failed.entriesOnlyOnLeft().isEmpty()) {
          throw Exceptions.toUndeclared(builder.toString());
        }
      }
  finally {
        canHas.writeLock().unlock();
      }
    }
 else {
      throw Exceptions.toUndeclared("String_Node_Str" + runnableFunction);
    }
  }
 catch (  InterruptedException ex) {
    Exceptions.maybeInterrupted(ex);
  }
catch (  RuntimeException ex) {
    LOG.error(ex);
    Logs.extreme().error(ex,ex);
    throw ex;
  }
}
Program: 14685
Project: 14685
Buggy source:
public CreateSnapshotResponseType create(CreateSnapshotType request) throws EucalyptusCloudException, NoSuchComponentException, DuplicateMetadataException, AuthException, IllegalContextAccessException, NoSuchElementException, PersistenceException, TransactionException {
  final Context ctx=Contexts.lookup();
  EntityWrapper<Snapshot> db=EntityWrapper.get(Snapshot.class);
  Volume vol=Transactions.find(Volume.named(ctx.getUserFullName().asAccountFullName(),request.getVolumeId()));
  final ServiceConfiguration sc=Partitions.lookupService(Storage.class,vol.getPartition());
  final Volume volReady=Volumes.checkVolumeReady(vol);
  Supplier<Snapshot> allocator=new Supplier<Snapshot>(){
    @Override public Snapshot get(){
      try {
        return Snapshots.initializeSnapshot(ctx.getUserFullName(),volReady,sc);
      }
 catch (      EucalyptusCloudException ex) {
        throw new RuntimeException(ex);
      }
    }
  }
;
  Snapshot snap=RestrictedTypes.allocateUnitlessResource(allocator);
  snap=Snapshots.startCreateSnapshot(volReady,snap);
  CreateSnapshotResponseType reply=(CreateSnapshotResponseType)request.getReply();
  edu.ucsb.eucalyptus.msgs.Snapshot snapMsg=snap.morph(new edu.ucsb.eucalyptus.msgs.Snapshot());
  snapMsg.setProgress("String_Node_Str");
  snapMsg.setOwnerId(snap.getOwnerAccountNumber());
  snapMsg.setVolumeSize(volReady.getSize().toString());
  reply.setSnapshot(snapMsg);
  return reply;
}

Fixed version (ground truth):
public CreateSnapshotResponseType create(CreateSnapshotType request) throws EucalyptusCloudException, NoSuchComponentException, DuplicateMetadataException, AuthException, IllegalContextAccessException, NoSuchElementException, PersistenceException, TransactionException {
  final Context ctx=Contexts.lookup();
  EntityWrapper<Snapshot> db=EntityWrapper.get(Snapshot.class);
  Volume vol=Transactions.find(Volume.named(ctx.getUserFullName().asAccountFullName(),request.getVolumeId()));
  final ServiceConfiguration sc=Topology.lookup(Storage.class,Partitions.lookupByName(vol.getPartition()));
  final Volume volReady=Volumes.checkVolumeReady(vol);
  Supplier<Snapshot> allocator=new Supplier<Snapshot>(){
    @Override public Snapshot get(){
      try {
        return Snapshots.initializeSnapshot(ctx.getUserFullName(),volReady,sc);
      }
 catch (      EucalyptusCloudException ex) {
        throw new RuntimeException(ex);
      }
    }
  }
;
  Snapshot snap=RestrictedTypes.allocateUnitlessResource(allocator);
  snap=Snapshots.startCreateSnapshot(volReady,snap);
  CreateSnapshotResponseType reply=(CreateSnapshotResponseType)request.getReply();
  edu.ucsb.eucalyptus.msgs.Snapshot snapMsg=snap.morph(new edu.ucsb.eucalyptus.msgs.Snapshot());
  snapMsg.setProgress("String_Node_Str");
  snapMsg.setOwnerId(snap.getOwnerAccountNumber());
  snapMsg.setVolumeSize(volReady.getSize().toString());
  reply.setSnapshot(snapMsg);
  return reply;
}
Program: 14688
Project: 14688
Buggy source:
static Snapshot startCreateSnapshot(final Volume vol,final Snapshot snap) throws EucalyptusCloudException, DuplicateMetadataException {
  final ServiceConfiguration sc=Partitions.lookupService(Storage.class,vol.getPartition());
  try {
    Snapshot snapState=Transactions.save(snap,new Callback<Snapshot>(){
      @Override public void fire(      Snapshot s){
        try {
          CreateStorageSnapshotType scRequest=new CreateStorageSnapshotType(vol.getDisplayName(),snap.getDisplayName());
          CreateStorageSnapshotResponseType scReply=ServiceDispatcher.lookup(sc).send(scRequest);
          s.setMappedState(scReply.getStatus());
        }
 catch (        EucalyptusCloudException ex) {
          throw Exceptions.toUndeclared(ex);
        }
      }
    }
);
  }
 catch (  ConstraintViolationException ex) {
    throw new DuplicateMetadataException("String_Node_Str" + snap + "String_Node_Str"+ ex.getMessage(),ex);
  }
catch (  ExecutionException ex) {
    LOG.error(ex.getCause(),ex.getCause());
    throw new EucalyptusCloudException(ex);
  }
  try {
    ListenerRegistry.getInstance().fireEvent(new StorageEvent(StorageEvent.EventType.EbsSnapshot,true,snap.getVolumeSize(),snap.getOwnerUserId(),snap.getOwnerUserName(),snap.getOwnerAccountNumber(),snap.getOwnerAccountName(),snap.getVolumeCluster(),snap.getVolumePartition()));
  }
 catch (  EventFailedException ex) {
    LOG.error(ex,ex);
  }
  return snap;
}

Fixed version (ground truth):
static Snapshot startCreateSnapshot(final Volume vol,final Snapshot snap) throws EucalyptusCloudException, DuplicateMetadataException {
  final ServiceConfiguration sc=Topology.lookup(Storage.class,Partitions.lookupByName(vol.getPartition()));
  try {
    Snapshot snapState=Transactions.save(snap,new Callback<Snapshot>(){
      @Override public void fire(      Snapshot s){
        try {
          CreateStorageSnapshotType scRequest=new CreateStorageSnapshotType(vol.getDisplayName(),snap.getDisplayName());
          CreateStorageSnapshotResponseType scReply=ServiceDispatcher.lookup(sc).send(scRequest);
          s.setMappedState(scReply.getStatus());
        }
 catch (        EucalyptusCloudException ex) {
          throw Exceptions.toUndeclared(ex);
        }
      }
    }
);
  }
 catch (  ConstraintViolationException ex) {
    throw new DuplicateMetadataException("String_Node_Str" + snap + "String_Node_Str"+ ex.getMessage(),ex);
  }
catch (  ExecutionException ex) {
    LOG.error(ex.getCause(),ex.getCause());
    throw new EucalyptusCloudException(ex);
  }
  try {
    ListenerRegistry.getInstance().fireEvent(new StorageEvent(StorageEvent.EventType.EbsSnapshot,true,snap.getVolumeSize(),snap.getOwnerUserId(),snap.getOwnerUserName(),snap.getOwnerAccountNumber(),snap.getOwnerAccountName(),snap.getVolumeCluster(),snap.getVolumePartition()));
  }
 catch (  EventFailedException ex) {
    LOG.error(ex,ex);
  }
  return snap;
}
Program: 14693
Project: 14693
Buggy source:
public static Volume checkVolumeReady(final Volume vol) throws EucalyptusCloudException {
  if (vol.isReady()) {
    return vol;
  }
 else {
    final ServiceConfiguration sc=Partitions.lookupService(Storage.class,vol.getPartition());
    final DescribeStorageVolumesType descVols=new DescribeStorageVolumesType(Lists.newArrayList(vol.getDisplayName()));
    try {
      Transactions.one(Volume.named(null,vol.getDisplayName()),new Callback<Volume>(){
        @Override public void fire(        final Volume t){
          try {
            final DescribeStorageVolumesResponseType volState=ServiceDispatcher.lookup(sc).send(descVols);
            if (!volState.getVolumeSet().isEmpty()) {
              vol.setMappedState(volState.getVolumeSet().get(0).getStatus());
            }
          }
 catch (          final EucalyptusCloudException ex) {
            LOG.error(ex,ex);
            throw Exceptions.toUndeclared("String_Node_Str" + vol.getDisplayName() + "String_Node_Str",ex);
          }
        }
      }
);
    }
 catch (    final ExecutionException ex) {
      throw new EucalyptusCloudException(ex.getCause());
    }
    if (!vol.isReady()) {
      throw new EucalyptusCloudException("String_Node_Str" + vol.getDisplayName() + "String_Node_Str");
    }
    return vol;
  }
}

Fixed version (ground truth):
public static Volume checkVolumeReady(final Volume vol) throws EucalyptusCloudException {
  if (vol.isReady()) {
    return vol;
  }
 else {
    final ServiceConfiguration sc=Topology.lookup(Storage.class,Partitions.lookupByName(vol.getPartition()));
    final DescribeStorageVolumesType descVols=new DescribeStorageVolumesType(Lists.newArrayList(vol.getDisplayName()));
    try {
      Transactions.one(Volume.named(null,vol.getDisplayName()),new Callback<Volume>(){
        @Override public void fire(        final Volume t){
          try {
            final DescribeStorageVolumesResponseType volState=ServiceDispatcher.lookup(sc).send(descVols);
            if (!volState.getVolumeSet().isEmpty()) {
              vol.setMappedState(volState.getVolumeSet().get(0).getStatus());
            }
          }
 catch (          final EucalyptusCloudException ex) {
            LOG.error(ex,ex);
            throw Exceptions.toUndeclared("String_Node_Str" + vol.getDisplayName() + "String_Node_Str",ex);
          }
        }
      }
);
    }
 catch (    final ExecutionException ex) {
      throw new EucalyptusCloudException(ex.getCause());
    }
    if (!vol.isReady()) {
      throw new EucalyptusCloudException("String_Node_Str" + vol.getDisplayName() + "String_Node_Str");
    }
    return vol;
  }
}
Program: 14694
Project: 14694
Buggy source:
public void submit() throws NoSuchTokenException {
  Clusters.lookup(this.getAllocationInfo().getPartition()).getNodeState().submitToken(this);
}

Fixed version (ground truth):
public void submit() throws NoSuchTokenException {
  Clusters.lookup(Topology.lookup(ClusterController.class,this.getAllocationInfo().getPartition())).getNodeState().submitToken(this);
}
Program: 14695
Project: 14695
Buggy source:
public void release() throws NoSuchTokenException {
  Clusters.lookup(this.getAllocationInfo().getPartition()).getNodeState().releaseToken(this);
}

Fixed version (ground truth):
public void release() throws NoSuchTokenException {
  Clusters.lookup(Topology.lookup(ClusterController.class,this.getAllocationInfo().getPartition())).getNodeState().releaseToken(this);
}
Program: 14696
Project: 14696
Buggy source:
public void redeem() throws NoSuchTokenException {
  Clusters.lookup(this.getAllocationInfo().getPartition()).getNodeState().redeemToken(this);
}

Fixed version (ground truth):
public void redeem() throws NoSuchTokenException {
  Clusters.lookup(Topology.lookup(ClusterController.class,this.getAllocationInfo().getPartition())).getNodeState().redeemToken(this);
}
Program: 14697
Project: 14697
Buggy source:
private List<Cluster> doPrivilegedLookup(String partitionName,String vmTypeName) throws NotEnoughResourcesException {
  if ("String_Node_Str".equals(partitionName)) {
    Iterable<Cluster> authorizedClusters=Iterables.filter(Clusters.getInstance().listValues(),RestrictedTypes.filterPrivileged());
    Multimap<VmTypeAvailability,Cluster> sorted=TreeMultimap.create();
    for (    Cluster c : authorizedClusters) {
      sorted.put(c.getNodeState().getAvailability(vmTypeName),c);
    }
    if (sorted.isEmpty()) {
      throw new NotEnoughResourcesException("String_Node_Str");
    }
 else {
      return Lists.newArrayList(sorted.values());
    }
  }
 else {
    Cluster cluster=Clusters.getInstance().lookup(Partitions.lookupService(ClusterController.class,partitionName));
    if (cluster == null) {
      throw new NotEnoughResourcesException("String_Node_Str" + partitionName);
    }
    return Lists.newArrayList(cluster);
  }
}

Fixed version (ground truth):
private List<Cluster> doPrivilegedLookup(String partitionName,String vmTypeName) throws NotEnoughResourcesException {
  if ("String_Node_Str".equals(partitionName)) {
    Iterable<Cluster> authorizedClusters=Iterables.filter(Clusters.getInstance().listValues(),RestrictedTypes.filterPrivileged());
    Multimap<VmTypeAvailability,Cluster> sorted=TreeMultimap.create();
    for (    Cluster c : authorizedClusters) {
      sorted.put(c.getNodeState().getAvailability(vmTypeName),c);
    }
    if (sorted.isEmpty()) {
      throw new NotEnoughResourcesException("String_Node_Str");
    }
 else {
      return Lists.newArrayList(sorted.values());
    }
  }
 else {
    ServiceConfiguration ccConfig=Topology.lookup(ClusterController.class,Partitions.lookupByName(partitionName));
    Cluster cluster=Clusters.lookup(ccConfig);
    if (cluster == null) {
      throw new NotEnoughResourcesException("String_Node_Str" + partitionName);
    }
    return Lists.newArrayList(cluster);
  }
}
Program: 14698
Project: 14698
Buggy source:
private void setupVolumeMessages() throws NoSuchElementException, MetadataException, ExecutionException {
  if (this.allocInfo.getBootSet().getMachine() instanceof BlockStorageImageInfo) {
    final ServiceConfiguration sc=Partitions.lookupService(Storage.class,this.cluster.getPartition());
    final VirtualBootRecord root=this.allocInfo.getVmTypeInfo().lookupRoot();
    if (root.isBlockStorage()) {
      for (int i=0; i < this.allocInfo.getAllocationTokens().size(); i++) {
        final BlockStorageImageInfo imgInfo=((BlockStorageImageInfo)this.allocInfo.getBootSet().getMachine());
        final int sizeGb=(int)Math.ceil(imgInfo.getImageSizeBytes() / (1024l * 1024l * 1024l));
        LOG.debug("String_Node_Str" + imgInfo + "String_Node_Str"+ root);
        final Volume vol=Volumes.createStorageVolume(sc,this.allocInfo.getOwnerFullName(),imgInfo.getSnapshotId(),sizeGb,this.allocInfo.getRequest());
        if (imgInfo.getDeleteOnTerminate()) {
          this.allocInfo.getTransientVolumes().add(vol);
        }
 else {
          this.allocInfo.getPersistentVolumes().add(vol);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void setupVolumeMessages() throws NoSuchElementException, MetadataException, ExecutionException {
  if (this.allocInfo.getBootSet().getMachine() instanceof BlockStorageImageInfo) {
    final ServiceConfiguration sc=Topology.lookup(Storage.class,this.cluster.getConfiguration().lookupPartition());
    final VirtualBootRecord root=this.allocInfo.getVmTypeInfo().lookupRoot();
    if (root.isBlockStorage()) {
      for (int i=0; i < this.allocInfo.getAllocationTokens().size(); i++) {
        final BlockStorageImageInfo imgInfo=((BlockStorageImageInfo)this.allocInfo.getBootSet().getMachine());
        final int sizeGb=(int)Math.ceil(imgInfo.getImageSizeBytes() / (1024l * 1024l * 1024l));
        LOG.debug("String_Node_Str" + imgInfo + "String_Node_Str"+ root);
        final Volume vol=Volumes.createStorageVolume(sc,this.allocInfo.getOwnerFullName(),imgInfo.getSnapshotId(),sizeGb,this.allocInfo.getRequest());
        if (imgInfo.getDeleteOnTerminate()) {
          this.allocInfo.getTransientVolumes().add(vol);
        }
 else {
          this.allocInfo.getPersistentVolumes().add(vol);
        }
      }
    }
  }
}