nus-yam/ex-repair huggingface dataset:
Program: 14590
Project: 14590
Buggy source:
@Override public void leave(ServiceConfiguration parent,Completion transitionCallback){
  EventRecord.here(ServiceBuilder.class,EventType.SERVICE_TRANSITION,this.name(),parent.lookupState().toString(),parent.getFullName().toString(),parent.toString()).exhaust();
  ServiceTransitions.processTransition(parent,transitionCallback,this);
}

Fixed version (ground truth):
@Override public void leave(ServiceConfiguration parent,Completion transitionCallback){
  try {
    EventRecord.here(ServiceBuilder.class,EventType.SERVICE_TRANSITION,this.name(),parent.lookupState().toString(),parent.getFullName().toString(),parent.toString()).exhaust();
    ServiceTransitions.processTransition(parent,transitionCallback,this);
  }
 catch (  Exception ex) {
    transitionCallback.fireException(ex);
  }
}
Program: 14591
Project: 14591
Buggy source:
public void reload(){
  VolumeEntityWrapperManager volumeManager=new VolumeEntityWrapperManager();
  List<LVMVolumeInfo> volumeInfos=volumeManager.getAllVolumeInfos();
  for (  LVMVolumeInfo foundVolumeInfo : volumeInfos) {
    String loDevName=foundVolumeInfo.getLoDevName();
    if (loDevName != null) {
      String loFileName=foundVolumeInfo.getVolumeId();
      String absoluteLoFileName=DirectStorageInfo.getStorageInfo().getVolumesDir() + PATH_SEPARATOR + loFileName;
      if (!new File(absoluteLoFileName).exists()) {
        LOG.error("String_Node_Str" + absoluteLoFileName + "String_Node_Str");
        foundVolumeInfo.setStatus(StorageProperties.Status.failed.toString());
        continue;
      }
      try {
        String returnValue=getLoopback(loDevName);
        if (returnValue.length() <= 0) {
          createLoopback(absoluteLoFileName,loDevName);
        }
      }
 catch (      EucalyptusCloudException ex) {
        String error="String_Node_Str" + ex.getMessage();
        LOG.error(error);
      }
    }
  }
  try {
    LOG.info("String_Node_Str");
    scanVolumeGroups();
  }
 catch (  EucalyptusCloudException e) {
    LOG.error(e);
  }
  for (  LVMVolumeInfo foundVolumeInfo : volumeInfos) {
    try {
      volumeManager.exportVolume(foundVolumeInfo);
    }
 catch (    EucalyptusCloudException ex) {
      LOG.error("String_Node_Str" + foundVolumeInfo.getVolumeId() + ex);
    }
  }
  volumeManager.finish();
}

Fixed version (ground truth):
public void reload(){
  VolumeEntityWrapperManager volumeManager=new VolumeEntityWrapperManager();
  List<LVMVolumeInfo> volumeInfos=volumeManager.getAllVolumeInfos();
  for (  LVMVolumeInfo foundVolumeInfo : volumeInfos) {
    String loDevName=foundVolumeInfo.getLoDevName();
    if (loDevName != null) {
      String loFileName=foundVolumeInfo.getVolumeId();
      String absoluteLoFileName=DirectStorageInfo.getStorageInfo().getVolumesDir() + PATH_SEPARATOR + loFileName;
      if (!new File(absoluteLoFileName).exists()) {
        LOG.error("String_Node_Str" + absoluteLoFileName + "String_Node_Str");
        foundVolumeInfo.setStatus(StorageProperties.Status.failed.toString());
        continue;
      }
      try {
        String returnValue=getLoopback(loDevName);
        if (returnValue.length() <= 0) {
          createLoopback(absoluteLoFileName,loDevName);
        }
      }
 catch (      EucalyptusCloudException ex) {
        String error="String_Node_Str" + ex.getMessage();
        LOG.error(error);
      }
    }
  }
  try {
    LOG.info("String_Node_Str");
    scanVolumeGroups();
  }
 catch (  EucalyptusCloudException e) {
    LOG.error(e);
  }
  for (  LVMVolumeInfo foundVolumeInfo : volumeInfos) {
    try {
      if (foundVolumeInfo.getVgName() != null) {
        volumeManager.exportVolume(foundVolumeInfo);
      }
    }
 catch (    EucalyptusCloudException ex) {
      LOG.error("String_Node_Str" + foundVolumeInfo.getVolumeId() + ex);
    }
  }
  volumeManager.finish();
}
Program: 14592
Project: 14592
Buggy source:
/** 
 * @see com.eucalyptus.util.fsm.State#request(com.eucalyptus.util.fsm.TransitionRule)
 * @param rule
 * @return
 * @throws ExistingTransitionException
 */
protected ActiveTransition request(T transitionName) throws ExistingTransitionException {
  TransitionHandler<P,S,T> transition=lookupTransition(transitionName);
  TransitionRule<S,T> rule=transition.getRule();
  if (!this.state.compareAndSet(rule.getFromState(),rule.getFromState(),rule.getFromStateMark(),true)) {
    throw new ExistingTransitionException("String_Node_Str" + transitionName + "String_Node_Str"+ this.toString());
  }
 else {
    this.currentTransition.set(new ActiveTransition(this.id.incrementAndGet(),rule,transition));
    return this.currentTransition.get();
  }
}

Fixed version (ground truth):
/** 
 * @see com.eucalyptus.util.fsm.State#request(com.eucalyptus.util.fsm.TransitionRule)
 * @param rule
 * @return
 * @throws ExistingTransitionException
 */
protected ActiveTransition request(T transitionName) throws ExistingTransitionException {
  TransitionHandler<P,S,T> transition=lookupTransition(transitionName);
  TransitionRule<S,T> rule=transition.getRule();
  if (!this.state.compareAndSet(rule.getFromState(),rule.getFromState(),rule.getFromStateMark(),true)) {
    throw new ExistingTransitionException("String_Node_Str" + transitionName + "String_Node_Str"+ this.toString());
  }
 else {
    this.currentTransition.set(this.create(rule,transition));
    return this.currentTransition.get();
  }
}
Program: 14593
Project: 14593
Buggy source:
public AtomicMarkedState(S startState,P parent,Set<TransitionHandler<P,S,T>> transitions,Multimap<S,Callback<P>> inStateListeners,Multimap<S,Callback<P>> outStateListeners){
  this.startState=startState;
  this.name=String.format("String_Node_Str",parent.getClass().getSimpleName(),parent.getName());
  this.parent=parent;
  final S[] states=State.asEnum.getEnumConstants(startState);
  this.stateTransitions=new HashMap<S,Map<S,TransitionHandler<P,S,T>>>(){
{
      for (      S s : states) {
        this.put(s,new HashMap<S,TransitionHandler<P,S,T>>());
      }
    }
  }
;
  this.immutableStates=ImmutableList.of(states);
  this.state=new AtomicMarkableReference<S>(this.startState,false);
  this.immutableTransitions=ImmutableList.copyOf(transitions);
  for (  TransitionHandler<P,S,T> t : transitions) {
    this.transitions.put(t.getName(),t);
    this.stateTransitions.get(t.getRule().getFromState()).put(t.getRule().getToState(),t);
  }
  this.inStateListeners.putAll(inStateListeners);
  this.outStateListeners.putAll(outStateListeners);
}

Fixed version (ground truth):
public AtomicMarkedState(S startState,P parent,Set<TransitionHandler<P,S,T>> transitions,Multimap<S,Callback<P>> inStateListeners,Multimap<S,Callback<P>> outStateListeners){
  this.startState=startState;
  String tempName=null;
  if (parent instanceof HasFullName) {
    try {
      tempName=((HasFullName)parent).getFullName().toString();
    }
 catch (    Exception ex) {
    }
  }
  this.name=(tempName != null ? tempName : String.format("String_Node_Str",parent.getClass().getSimpleName(),parent.getName()));
  this.parent=parent;
  final S[] states=State.asEnum.getEnumConstants(startState);
  this.stateTransitions=new HashMap<S,Map<S,TransitionHandler<P,S,T>>>(){
{
      for (      S s : states) {
        this.put(s,new HashMap<S,TransitionHandler<P,S,T>>());
      }
    }
  }
;
  this.immutableStates=ImmutableList.of(states);
  this.state=new AtomicMarkableReference<S>(this.startState,false);
  this.immutableTransitions=ImmutableList.copyOf(transitions);
  for (  TransitionHandler<P,S,T> t : transitions) {
    this.transitions.put(t.getName(),t);
    this.stateTransitions.get(t.getRule().getFromState()).put(t.getRule().getToState(),t);
  }
  this.inStateListeners.putAll(inStateListeners);
  this.outStateListeners.putAll(outStateListeners);
}
Program: 14594
Project: 14594
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.exhaust().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);
    }
  }
}

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.exhaust().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.get());
      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: 14595
Project: 14595
Buggy source:
public ActiveTransition(Long id,TransitionRule<S,T> rule,TransitionAction<P> transition){
  this.txId=id;
  this.startTime=System.nanoTime();
  this.endTime=0l;
  this.rule=rule;
  this.transition=transition;
  this.txName=AtomicMarkedState.this.getName() + "String_Node_Str" + this.rule.getName()+ "String_Node_Str"+ id;
  if (Logs.isExtrrreeeme()) {
    this.startStackTrace=Exceptions.filterStackTrace(new RuntimeException());
  }
 else {
    this.startStackTrace=null;
  }
}

Fixed version (ground truth):
private ActiveTransition(Long id,TransitionRule<S,T> rule,TransitionAction<P> transition){
  this.txId=id;
  this.startTime=System.currentTimeMillis();
  this.endTime=0l;
  this.rule=rule;
  this.transition=transition;
  this.txName=AtomicMarkedState.this.getName() + "String_Node_Str" + this.txId+ "String_Node_Str"+ this.rule.getName();
  if (Logs.isExtrrreeeme()) {
    this.startStackTrace=Threads.currentStackString();
  }
 else {
    this.startStackTrace=Threads.currentStackFrame(0).toString();
  }
  this.endStackTrace=new Supplier<String>(){
    @Override public String get(){
      if (Logs.isExtrrreeeme()) {
        return Threads.currentStackString();
      }
 else {
        return Threads.currentStackFrame(3).toString();
      }
    }
  }
;
}
Program: 14596
Project: 14596
Buggy source:
public CheckedListenableFuture<P> leave(){
  this.transition.leave(AtomicMarkedState.this.parent,this);
  return this.transitionFuture;
}

Fixed version (ground truth):
public CheckedListenableFuture<P> leave(){
  try {
    this.transition.leave(AtomicMarkedState.this.parent,this);
    return this.transitionFuture;
  }
 catch (  Exception ex) {
    this.transitionFuture.setException(ex);
    return this.transitionFuture;
  }
}
Program: 14597
Project: 14597
Buggy source:
public void fireException(Throwable t){
  if (Logs.isExtrrreeeme()) {
    Logs.extreme().trace(Exceptions.string(this.startStackTrace));
    Logs.extreme().trace(Exceptions.string(this.endStackTrace));
  }
  AtomicMarkedState.this.error(t);
}

Fixed version (ground truth):
public void fireException(Throwable t){
  if (Logs.isExtrrreeeme()) {
    Logs.extreme().error(this.startStackTrace);
    Logs.extreme().error(this.endStackTrace.get());
  }
  AtomicMarkedState.this.error(t);
}
Program: 14598
Project: 14598
Buggy source:
private final CheckedListenableFuture<P> afterLeave(final T transitionName,final ActiveTransition tid) throws IllegalStateException {
  try {
    CheckedListenableFuture<P> result=tid.leave();
    this.fireOutListeners(tid.getTransitionRule().getFromState());
    return result;
  }
 catch (  Exception t) {
    this.error(t);
    throw Exceptions.trace(new IllegalStateException(String.format("String_Node_Str",transitionName.toString(),t.getMessage()),t));
  }
}

Fixed version (ground truth):
private final CheckedListenableFuture<P> afterLeave(final T transitionName,final ActiveTransition tid) throws IllegalStateException {
  try {
    CheckedListenableFuture<P> result=tid.leave();
    try {
      this.fireOutListeners(tid.getTransitionRule().getFromState());
    }
 catch (    Exception ex) {
      Logs.extreme().error(ex,ex);
    }
    return result;
  }
 catch (  Exception t) {
    this.error(t);
    throw Exceptions.trace(new IllegalStateException(String.format("String_Node_Str",transitionName.toString(),t.getMessage()),t));
  }
}
Program: 14599
Project: 14599
Buggy source:
@Override public CheckedListenableFuture<P> transition(S nextState) throws IllegalStateException, ExistingTransitionException {
  if (this.state.isMarked()) {
    throw new ExistingTransitionException("String_Node_Str" + nextState + "String_Node_Str"+ this.toString());
  }
 else   if (!this.stateTransitions.get(this.state.getReference()).containsKey(nextState)) {
    throw new NoSuchElementException("String_Node_Str" + nextState.toString() + "String_Node_Str"+ this.toString()+ "String_Node_Str"+ this.getTransitions());
  }
 else {
    T transitionName=this.stateTransitions.get(this.state.getReference()).get(nextState).getName();
    this.checkTransition(transitionName);
    final ActiveTransition tid=this.beforeLeave(transitionName);
    CheckedListenableFuture<P> future=this.afterLeave(transitionName,tid);
    return future;
  }
}

Fixed version (ground truth):
@Override public CheckedListenableFuture<P> transition(S nextState) throws IllegalStateException, ExistingTransitionException {
  if (this.state.isMarked()) {
    throw new ExistingTransitionException("String_Node_Str" + nextState + "String_Node_Str"+ this.toString());
  }
 else   if (!this.stateTransitions.get(this.state.getReference()).containsKey(nextState)) {
    throw new NoSuchElementException("String_Node_Str" + nextState.toString() + "String_Node_Str"+ this.toString()+ "String_Node_Str"+ this.getTransitions());
  }
 else {
    T transitionName=this.stateTransitions.get(this.state.getReference()).get(nextState).getName();
    this.checkTransition(transitionName);
    final ActiveTransition tid=this.beforeLeave(transitionName);
    return this.afterLeave(transitionName,tid);
  }
}
Program: 14601
Project: 14601
Buggy source:
public static void awaitSynchronized(){
  if (!isVolatile()) {
    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 && isVolatile(); 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));
    }
  }
}

Fixed version (ground truth):
public static void awaitSynchronized(){
  if (!isVolatile()) {
    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 && isVolatile(); i++) {
      try {
        TimeUnit.MILLISECONDS.sleep(1000);
        LOG.debug("String_Node_Str" + caller);
      }
 catch (      InterruptedException ex) {
        Exceptions.maybeInterrupted(ex);
        return;
      }
    }
    if (isVolatile()) {
      throw new DatabaseStateException("String_Node_Str" + Hosts.listDatabases() + "String_Node_Str"+ Joiner.on("String_Node_Str").join(stack));
    }
  }
}
Program: 14602
Project: 14602
Buggy source:
public static void persist(final CheckException errors){
  if (errors != null && Bootstrap.isFinished() && !Databases.isVolatile() && Hosts.isCoordinator()) {
    try {
      for (      final CheckException e : errors) {
        final EntityTransaction db=Entities.get(CheckException.class);
        try {
          List<CheckException> list=Entities.query(new CheckException(e.getServiceName()));
          for (          CheckException old : list) {
            LOG.debug("String_Node_Str" + old.getMessage());
            Logs.extreme().debug("String_Node_Str" + old,old);
            Entities.delete(old);
          }
          Entities.persist(e);
          db.commit();
        }
 catch (        final Exception ex) {
          LOG.error("String_Node_Str" + errors,ex);
          db.rollback();
          final EntityTransaction db2=Entities.get(CheckException.class);
          try {
            Entities.persist(e);
            db2.commit();
          }
 catch (          final Exception ex2) {
            LOG.error("String_Node_Str" + errors,ex2);
            db2.rollback();
          }
        }
      }
    }
 catch (    Exception ex) {
      LOG.error("String_Node_Str" + errors);
      Logs.extreme().error(ex,ex);
    }
  }
}

Fixed version (ground truth):
public static void persist(final ServiceConfiguration parent,final CheckException errors){
  if (errors != null && Hosts.isCoordinator() && Bootstrap.isFinished() && !Databases.isVolatile()) {
    try {
      final EntityTransaction db=Entities.get(CheckException.class);
      try {
        List<CheckException> list=Entities.query(new CheckException(parent.getFullName().toString()));
        for (        CheckException old : list) {
          Logs.extreme().debug("String_Node_Str" + old,old);
          Entities.delete(old);
        }
        db.commit();
      }
 catch (      final Exception ex) {
        LOG.error("String_Node_Str" + errors,ex);
        db.rollback();
      }
      for (      final CheckException e : errors) {
        final EntityTransaction db2=Entities.get(CheckException.class);
        try {
          Entities.persist(e);
          db2.commit();
        }
 catch (        final Exception ex) {
          LOG.error("String_Node_Str" + errors,ex);
          db2.rollback();
        }
      }
    }
 catch (    Exception ex) {
      LOG.error("String_Node_Str" + errors);
      Logs.extreme().error(ex,ex);
    }
  }
}
Program: 14603
Project: 14603
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 {
      transitionCallback.fire();
      Faults.persist(Faults.advisory(parent,ex));
    }
  }
}

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(parent,Faults.failure(parent,ex));
      throw Exceptions.toUndeclared(ex);
    }
 else {
      transitionCallback.fire();
      Faults.persist(parent,Faults.advisory(parent,ex));
    }
  }
}
Program: 14604
Project: 14604
Buggy source:
static boolean enable(final Host host){
  if (!host.hasDatabase() || !Bootstrap.isLoaded()) {
    return false;
  }
 else {
    if (host.isLocalHost()) {
      if (SyncState.SYNCING.set()) {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          SyncState.SYNCED.set();
          return true;
        }
 catch (        Exception ex) {
          SyncState.NOTSYNCED.set();
          LOG.error(ex,ex);
          ActivateHostFunction.rollback(host,ex);
          return false;
        }
      }
 else {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          return true;
        }
 catch (        Exception ex) {
          Logs.extreme().debug(ex);
          ActivateHostFunction.rollback(host,ex);
          return false;
        }
      }
    }
 else     if (!ActiveHostSet.ACTIVATED.get().contains(host.getDisplayName())) {
      try {
        runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
        return true;
      }
 catch (      Exception ex) {
        Logs.extreme().debug(ex);
        ActivateHostFunction.rollback(host,ex);
        return false;
      }
    }
 else {
      return ActiveHostSet.ACTIVATED.get().contains(host.getDisplayName());
    }
  }
}

Fixed version (ground truth):
static boolean enable(final Host host){
  if (!host.hasDatabase() || !Bootstrap.isLoaded()) {
    return false;
  }
 else {
    if (host.isLocalHost()) {
      if (SyncState.SYNCING.set()) {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          SyncState.SYNCED.set();
          return true;
        }
 catch (        LockTimeoutException ex) {
          SyncState.NOTSYNCED.set();
          return false;
        }
catch (        Exception ex) {
          SyncState.NOTSYNCED.set();
          LOG.error(ex,ex);
          return false;
        }
      }
 else {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          return true;
        }
 catch (        LockTimeoutException ex) {
          return false;
        }
catch (        Exception ex) {
          Logs.extreme().debug(ex);
          return false;
        }
      }
    }
 else     if (!ActiveHostSet.ACTIVATED.get().contains(host.getDisplayName())) {
      try {
        runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
        return true;
      }
 catch (      LockTimeoutException ex) {
        return false;
      }
catch (      Exception ex) {
        Logs.extreme().debug(ex);
        ActivateHostFunction.rollback(host,ex);
        return false;
      }
    }
 else {
      return ActiveHostSet.ACTIVATED.get().contains(host.getDisplayName());
    }
  }
}
Program: 14606
Project: 14606
Buggy source:
static boolean enable(final Host host){
  if (!host.hasDatabase() || !Bootstrap.isLoaded()) {
    return false;
  }
 else {
    if (host.isLocalHost()) {
      if (SyncState.SYNCING.set()) {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          SyncState.SYNCED.set();
          return true;
        }
 catch (        Exception ex) {
          SyncState.NOTSYNCED.set();
          Logs.extreme().debug(ex);
          ActivateHostFunction.rollback(host,ex);
          return false;
        }
      }
 else {
        return false;
      }
    }
 else     if (!ActiveHostSet.ACTIVATED.get().contains(host.getDisplayName())) {
      try {
        runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
        return true;
      }
 catch (      Exception ex) {
        Logs.extreme().debug(ex);
        ActivateHostFunction.rollback(host,ex);
        return false;
      }
    }
 else {
      return ActiveHostSet.ACTIVATED.get().contains(host.getDisplayName());
    }
  }
}

Fixed version (ground truth):
static boolean enable(final Host host){
  if (!host.hasDatabase() || !Bootstrap.isLoaded()) {
    return false;
  }
 else {
    if (host.isLocalHost()) {
      if (SyncState.SYNCING.set()) {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          SyncState.SYNCED.set();
          return true;
        }
 catch (        Exception ex) {
          SyncState.NOTSYNCED.set();
          LOG.error(ex,ex);
          ActivateHostFunction.rollback(host,ex);
          return false;
        }
      }
 else {
        try {
          runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
          return true;
        }
 catch (        Exception ex) {
          Logs.extreme().debug(ex);
          ActivateHostFunction.rollback(host,ex);
          return false;
        }
      }
    }
 else     if (!ActiveHostSet.ACTIVATED.get().contains(host.getDisplayName())) {
      try {
        runDbStateChange(ActivateHostFunction.INSTANCE.apply(host));
        return true;
      }
 catch (      Exception ex) {
        Logs.extreme().debug(ex);
        ActivateHostFunction.rollback(host,ex);
        return false;
      }
    }
 else {
      return ActiveHostSet.ACTIVATED.get().contains(host.getDisplayName());
    }
  }
}
Program: 14607
Project: 14607
Buggy source:
private static List<ServiceConfiguration> submitTransitions(final List<ServiceConfiguration> allServices,final Predicate<ServiceConfiguration> proceedToDisableFilter,final Function<ServiceConfiguration,Future<ServiceConfiguration>> submitFunction){
  final Collection<ServiceConfiguration> filteredServices=Collections2.filter(allServices,proceedToDisableFilter);
  final Collection<Future<ServiceConfiguration>> submittedCallables=Collections2.transform(filteredServices,submitFunction);
  final Collection<Future<ServiceConfiguration>> completedServices=Collections2.filter(submittedCallables,WaitForResults.INSTANCE);
  List<ServiceConfiguration> results=Lists.newArrayList(Collections2.transform(completedServices,ExtractFuture.INSTANCE));
  printCheckInfo(submitFunction.toString(),results);
  final Collection<Future<ServiceConfiguration>> failedCheckServices=Collections2.filter(submittedCallables,FilterErrorResults.INSTANCE);
  List<Exception> failedResults=Lists.newArrayList(Collections2.transform(failedCheckServices,ExtractErrorFuture.INSTANCE));
  for (  Exception ex : failedResults) {
    if (ex != null) {
      if (ex instanceof CheckException) {
        Faults.persist((CheckException)ex);
      }
 else {
        LOG.error("String_Node_Str" + ex);
      }
    }
  }
  return results;
}

Fixed version (ground truth):
private static List<ServiceConfiguration> submitTransitions(final List<ServiceConfiguration> allServices,final Predicate<ServiceConfiguration> proceedToDisableFilter,final Function<ServiceConfiguration,Future<ServiceConfiguration>> submitFunction){
  final Collection<ServiceConfiguration> filteredServices=Collections2.filter(allServices,proceedToDisableFilter);
  final Collection<Future<ServiceConfiguration>> submittedCallables=Collections2.transform(filteredServices,submitFunction);
  final Collection<Future<ServiceConfiguration>> completedServices=Collections2.filter(submittedCallables,WaitForResults.INSTANCE);
  List<ServiceConfiguration> results=Lists.newArrayList(Collections2.transform(completedServices,ExtractFuture.INSTANCE));
  printCheckInfo(submitFunction.toString(),results);
  return results;
}
Program: 14608
Project: 14608
Buggy source:
public String getByKey(final String pathArg){
  final Map<String,String> m=this.getMetadataMap();
  String path=(pathArg != null) ? pathArg : "String_Node_Str";
  LOG.debug("String_Node_Str" + path + "String_Node_Str"+ m.get(path));
  if (m.containsKey(path + "String_Node_Str"))   path+="String_Node_Str";
  return m.get(path).replaceAll("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public String getByKey(final String pathArg){
  final Map<String,String> m=this.getMetadataMap();
  String path=(pathArg != null) ? pathArg : "String_Node_Str";
  LOG.debug("String_Node_Str" + path + "String_Node_Str"+ m.get(path));
  if (m.containsKey(path + "String_Node_Str"))   path+="String_Node_Str";
  if (!m.containsKey(path)) {
    throw new NoSuchElementException("String_Node_Str" + path);
  }
 else {
    return m.get(path).replaceAll("String_Node_Str","String_Node_Str");
  }
}
Program: 14609
Project: 14609
Buggy source:
public byte[] handle(String path){
  String[] parts=path.split("String_Node_Str");
  try {
    MetadataRequest request=new MetadataRequest(parts[0],parts.length == 2 ? parts[1] : "String_Node_Str");
    if (instanceMetadataEndpoints.containsKey(request.getMetadataName()) && request.isInstance()) {
      return instanceMetadataEndpoints.get(request.getMetadataName()).apply(request).getBytes();
    }
 else     if (systemMetadataEndpoints.containsKey(request.getMetadataName()) && request.isSystem()) {
      return systemMetadataEndpoints.get(request.getMetadataName()).apply(request).getBytes();
    }
 else     if (publicMetadataEndpoints.containsKey(request.getMetadataName())) {
      return publicMetadataEndpoints.get(request.getMetadataName()).apply(request).getBytes();
    }
 else {
      return "String_Node_Str".getBytes();
    }
  }
 catch (  Exception ex) {
    String errorMsg="String_Node_Str" + path + (Logs.isExtrrreeeme() ? "String_Node_Str" + ex.getMessage() : "String_Node_Str");
    LOG.error(errorMsg,ex);
    throw Exceptions.toUndeclared(ex);
  }
}

Fixed version (ground truth):
public byte[] handle(String path){
  String[] parts=path.split("String_Node_Str");
  try {
    MetadataRequest request=new MetadataRequest(parts[0],parts.length == 2 ? parts[1] : "String_Node_Str");
    if (instanceMetadataEndpoints.containsKey(request.getMetadataName()) && request.isInstance()) {
      return instanceMetadataEndpoints.get(request.getMetadataName()).apply(request).getBytes();
    }
 else     if (systemMetadataEndpoints.containsKey(request.getMetadataName()) && request.isSystem()) {
      return systemMetadataEndpoints.get(request.getMetadataName()).apply(request).getBytes();
    }
 else     if (publicMetadataEndpoints.containsKey(request.getMetadataName())) {
      return publicMetadataEndpoints.get(request.getMetadataName()).apply(request).getBytes();
    }
 else {
      return "String_Node_Str".getBytes();
    }
  }
 catch (  NoSuchElementException ex) {
    throw ex;
  }
catch (  Exception ex) {
    String errorMsg="String_Node_Str" + path + (Logs.isExtrrreeeme() ? "String_Node_Str" + ex.getMessage() : "String_Node_Str");
    LOG.error(errorMsg,ex);
    throw Exceptions.toUndeclared(ex);
  }
}
Program: 14611
Project: 14611
Buggy source:
@Override public T newInstance(){
  try {
    if (subject != null) {
      try {
        T callback=callbackClass.getConstructor(subject.getClass()).newInstance(subject);
        return callback;
      }
 catch (      NoSuchMethodException nsmex) {
        T callback=callbackClass.newInstance();
        callback.setSubject(subject);
        return callback;
      }
    }
 else {
      T callback=callbackClass.newInstance();
      LOG.error("String_Node_Str" + subject + "String_Node_Str"+ callbackClass.getCanonicalName());
      return callback;
    }
  }
 catch (  final Exception ex) {
    LOG.error(ex);
    Logs.exhaust().error(ex,ex);
    throw new RuntimeException(ex);
  }
}

Fixed version (ground truth):
@Override public T newInstance(){
  try {
    if (subject != null) {
      try {
        T callback=Classes.builder(callbackClass).arg(subject).newInstance();
        return callback;
      }
 catch (      UndeclaredThrowableException ex) {
        if (ex.getCause() instanceof CancellationException) {
          throw (CancellationException)ex.getCause();
        }
 else         if (ex.getCause() instanceof NoSuchMethodException) {
          try {
            T callback=Classes.builder(callbackClass).newInstance();
            callback.setSubject(subject);
            return callback;
          }
 catch (          Exception ex1) {
            if (ex.getCause() instanceof CancellationException) {
              throw (CancellationException)ex.getCause();
            }
 else             if (ex.getCause() instanceof NoSuchMethodException) {
              throw ex;
            }
 else {
              throw Exceptions.toUndeclared(ex1);
            }
          }
        }
 else {
          T callback=callbackClass.newInstance();
          LOG.error("String_Node_Str" + subject + "String_Node_Str"+ callbackClass.getCanonicalName());
          return callback;
        }
      }
    }
 else {
      T callback=callbackClass.newInstance();
      LOG.error("String_Node_Str" + subject + "String_Node_Str"+ callbackClass.getCanonicalName());
      return callback;
    }
  }
 catch (  final CancellationException ex) {
    LOG.debug(ex);
    throw ex;
  }
catch (  final Exception ex) {
    LOG.error(ex);
    Logs.exhaust().error(ex,ex);
    throw Exceptions.toUndeclared(ex);
  }
}
Program: 14613
Project: 14613
Buggy source:
private static void fireCallback(final Cluster parent,final ServiceConfiguration config,final boolean doCoordinatorCheck,final SubjectRemoteCallbackFactory<RemoteCallback,Cluster> factory,final Callback.Completion transitionCallback){
  RemoteCallback messageCallback=null;
  try {
    if (!doCoordinatorCheck || checkCoordinator(transitionCallback)) {
      try {
        messageCallback=factory.newInstance();
        try {
          BaseMessage baseMessage=AsyncRequests.newRequest(messageCallback).sendSync(config);
          transitionCallback.fire();
          if (Logs.isExtrrreeeme()) {
            Logs.extreme().debug(baseMessage);
          }
        }
 catch (        final Exception t) {
          if (!parent.swallowException(t)) {
            transitionCallback.fireException(Exceptions.unwrapCause(t));
          }
 else {
            transitionCallback.fire();
          }
        }
      }
 catch (      Exception ex) {
        transitionCallback.fireException(ex);
      }
    }
  }
  finally {
    if (!transitionCallback.isDone()) {
      LOG.debug(parent.getFullName() + "String_Node_Str" + messageCallback);
      Logs.exhaust().debug(Exceptions.toUndeclared(parent.getFullName() + "String_Node_Str" + messageCallback));
      transitionCallback.fire();
    }
  }
}

Fixed version (ground truth):
private static void fireCallback(final Cluster parent,final ServiceConfiguration config,final boolean doCoordinatorCheck,final SubjectRemoteCallbackFactory<RemoteCallback,Cluster> factory,final Callback.Completion transitionCallback){
  RemoteCallback messageCallback=null;
  try {
    if (!doCoordinatorCheck || checkCoordinator(transitionCallback)) {
      try {
        messageCallback=factory.newInstance();
        try {
          BaseMessage baseMessage=AsyncRequests.newRequest(messageCallback).sendSync(config);
          transitionCallback.fire();
          if (Logs.isExtrrreeeme()) {
            Logs.extreme().debug(baseMessage);
          }
        }
 catch (        final Exception t) {
          if (!parent.swallowException(t)) {
            transitionCallback.fireException(Exceptions.unwrapCause(t));
          }
 else {
            transitionCallback.fire();
          }
        }
      }
 catch (      CancellationException ex) {
        transitionCallback.fire();
      }
catch (      Exception ex) {
        transitionCallback.fireException(ex);
      }
    }
  }
  finally {
    if (!transitionCallback.isDone()) {
      LOG.debug(parent.getFullName() + "String_Node_Str" + messageCallback);
      Logs.exhaust().debug(Exceptions.toUndeclared(parent.getFullName() + "String_Node_Str" + messageCallback));
      transitionCallback.fire();
    }
  }
}
Program: 14614
Project: 14614
Buggy source:
private void handleClassFile(final File f,final JarEntry j) throws IOException, RuntimeException {
  final String classGuess=j.getName().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
  try {
    final Class candidate=ClassLoader.getSystemClassLoader().loadClass(classGuess);
    classList.put(candidate,f.getAbsolutePath());
    if (ServiceJarDiscovery.class.isAssignableFrom(candidate) && !ServiceJarDiscovery.class.equals(candidate)) {
      try {
        final ServiceJarDiscovery discover=(ServiceJarDiscovery)candidate.newInstance();
        discovery.add(discover);
      }
 catch (      final Exception e) {
        LOG.fatal(e,e);
        throw new RuntimeException(e);
      }
    }
  }
 catch (  final ClassNotFoundException e) {
    LOG.debug(e,e);
  }
}

Fixed version (ground truth):
private void handleClassFile(final File f,final JarEntry j) throws IOException, RuntimeException {
  final String classGuess=j.getName().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
  try {
    final Class candidate=ClassLoader.getSystemClassLoader().loadClass(classGuess);
    classList.put(candidate,f.getAbsolutePath());
    if (ServiceJarDiscovery.class.isAssignableFrom(candidate) && !ServiceJarDiscovery.class.equals(candidate)) {
      try {
        final ServiceJarDiscovery discover=(ServiceJarDiscovery)candidate.newInstance();
        discovery.add(discover);
      }
 catch (      final Exception e) {
        LOG.fatal(e,e);
        throw new RuntimeException(e);
      }
    }
 else     if (Ats.from(candidate).has(Bootstrap.Discovery.class) && Predicate.class.isAssignableFrom(candidate)) {
      try {
        final Bootstrap.Discovery annote=Ats.from(candidate).get(Bootstrap.Discovery.class);
        @SuppressWarnings({"String_Node_Str","String_Node_Str"}) final Predicate<Class> instance=(Predicate<Class>)Classes.builder(candidate).newInstance();
        final ServiceJarDiscovery discover=new ServiceJarDiscovery(){
          @Override public boolean processClass(          Class discoveryCandidate) throws Exception {
            boolean classFiltered=annote.value().length != 0 ? Iterables.any(Arrays.asList(annote.value()),Classes.assignableTo(discoveryCandidate)) : true;
            if (classFiltered) {
              boolean annotationFiltered=annote.annotations().length != 0 ? Iterables.any(Arrays.asList(annote.annotations()),Ats.from(discoveryCandidate)) : true;
              if (annotationFiltered) {
                return instance.apply(discoveryCandidate);
              }
 else {
                return false;
              }
            }
 else {
              return false;
            }
          }
          @Override public Double getPriority(){
            return annote.priority();
          }
        }
;
        discovery.add(discover);
      }
 catch (      final Exception e) {
        LOG.fatal(e,e);
        throw new RuntimeException(e);
      }
    }
  }
 catch (  final ClassNotFoundException e) {
    LOG.debug(e,e);
  }
}
Program: 14615
Project: 14615
Buggy source:
public void disable() throws ServiceRegistrationException {
  try {
    if (State.NOTREADY.equals(this.getStateMachine().getState())) {
      Automata.sequenceTransitions(this,State.NOTREADY,State.DISABLED).call().get();
    }
 else     if (State.ENABLED.equals(this.getStateMachine().getState())) {
      Automata.sequenceTransitions(this,State.ENABLED,State.DISABLED).call().get();
    }
  }
 catch (  final InterruptedException ex) {
    Thread.currentThread().interrupt();
  }
catch (  final Exception ex) {
    Logs.exhaust().debug(ex,ex);
    throw new ServiceRegistrationException("String_Node_Str" + this.configuration + "String_Node_Str"+ ex.getMessage(),ex);
  }
 finally {
    try {
      Clusters.getInstance().deregister(this.getName());
    }
 catch (    Exception ex) {
    }
  }
}

Fixed version (ground truth):
public void disable() throws ServiceRegistrationException {
  try {
    if (State.NOTREADY.equals(this.getStateMachine().getState())) {
      Automata.sequenceTransitions(this,State.NOTREADY,State.DISABLED).call().get();
    }
 else     if (State.ENABLED.equals(this.getStateMachine().getState())) {
      Automata.sequenceTransitions(this,State.ENABLED,State.DISABLED).call().get();
    }
  }
 catch (  final InterruptedException ex) {
    Thread.currentThread().interrupt();
  }
catch (  final Exception ex) {
    Logs.exhaust().debug(ex,ex);
    throw new ServiceRegistrationException("String_Node_Str" + this.configuration + "String_Node_Str"+ ex.getMessage(),ex);
  }
 finally {
    try {
      Clusters.getInstance().disable(this.getName());
    }
 catch (    Exception ex) {
    }
  }
}
Program: 14616
Project: 14616
Buggy source:
private boolean hasMessage(Class<? extends Throwable> ex){
  if (this.map != null) {
    return this.map.containsKey(ex);
  }
 else {
    return this.map.containsKey(ex);
  }
}

Fixed version (ground truth):
private boolean hasMessage(Class<? extends Throwable> ex){
  if (this.map != null) {
    return this.map.containsKey(ex);
  }
 else {
    return false;
  }
}
Program: 14617
Project: 14617
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public boolean apply(Class input){
  if (Function.class.isAssignableFrom(input) && Ats.from(input).has(ErrorMessages.class)) {
    try {
      Function<Class,String> errorFunction=(Function<Class,String>)Classes.builder(input).newInstance();
      ConcurrentMap<Class,String> errorMap=new MapMaker().expireAfterAccess(60,TimeUnit.SECONDS).makeComputingMap(errorFunction);
      classErrorMessages.put(input,errorMap);
      return true;
    }
 catch (    UndeclaredThrowableException ex) {
      LOG.error(ex,ex);
      return false;
    }
  }
 else {
    Discovery discovery=Ats.from(ErrorMessageDiscovery.class).get(Discovery.class);
    LOG.error("String_Node_Str" + discovery.value() + "String_Node_Str"+ discovery.annotations());
    return false;
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public boolean apply(Class input){
  if (Function.class.isAssignableFrom(input) && Ats.from(input).has(ErrorMessages.class)) {
    try {
      ErrorMessages annote=Ats.from(input).get(ErrorMessages.class);
      Function<Class,String> errorFunction=(Function<Class,String>)Classes.builder(input).newInstance();
      ConcurrentMap<Class,String> errorMap=new MapMaker().expireAfterAccess(60,TimeUnit.SECONDS).makeComputingMap(errorFunction);
      classErrorMessages.put(annote.value(),errorMap);
      return true;
    }
 catch (    UndeclaredThrowableException ex) {
      LOG.error(ex,ex);
      return false;
    }
  }
 else {
    Discovery discovery=Ats.from(ErrorMessageDiscovery.class).get(Discovery.class);
    LOG.error("String_Node_Str" + discovery.value() + "String_Node_Str"+ discovery.annotations());
    return false;
  }
}
Program: 14618
Project: 14618
Buggy source:
public void check() throws Faults.CheckException, IllegalStateException {
  final Cluster.State currentState=this.stateMachine.getState();
  final List<Throwable> currentErrors=Lists.newArrayList();
  try {
    Refresh.SERVICEREADY.fire(this);
  }
 catch (  Exception ex) {
  }
  currentErrors.addAll(this.pendingErrors);
  final Component.State externalState=this.configuration.lookupState();
  if (!currentErrors.isEmpty()) {
    throw Faults.failure(this.configuration,currentErrors);
  }
 else   if (Component.State.ENABLED.equals(externalState) && (Cluster.State.ENABLING.ordinal() >= currentState.ordinal())) {
    final IllegalStateException ex=new IllegalStateException("String_Node_Str" + externalState + "String_Node_Str"+ currentState+ "String_Node_Str");
    this.pendingErrors.add(ex);
    currentErrors.add(ex);
    throw Faults.failure(this.configuration,currentErrors);
  }
}

Fixed version (ground truth):
public void check() throws Faults.CheckException, IllegalStateException {
  final Cluster.State currentState=this.stateMachine.getState();
  final List<Throwable> currentErrors=Lists.newArrayList();
  try {
    Refresh.SERVICEREADY.fire(this);
  }
 catch (  Exception ex) {
    if (ex.getCause() instanceof CancellationException) {
    }
 else {
      this.pendingErrors.add(ex);
    }
  }
  currentErrors.addAll(this.pendingErrors);
  final Component.State externalState=this.configuration.lookupState();
  if (!currentErrors.isEmpty()) {
    throw Faults.failure(this.configuration,currentErrors);
  }
 else   if (Component.State.ENABLED.equals(externalState) && (Cluster.State.ENABLING.ordinal() >= currentState.ordinal())) {
    final IllegalStateException ex=new IllegalStateException("String_Node_Str" + externalState + "String_Node_Str"+ currentState+ "String_Node_Str");
    this.pendingErrors.add(ex);
    currentErrors.add(ex);
    throw Faults.failure(this.configuration,currentErrors);
  }
}
Program: 14619
Project: 14619
Buggy source:
private ServiceConfiguration doTopologyChange(final ServiceConfiguration input,final State nextState) throws RuntimeException {
  final State initialState=input.lookupState();
  ServiceConfiguration endResult=input;
  try {
    endResult=ServiceTransitions.pathTo(input,nextState).get();
    Logs.exhaust().debug(this.toString(endResult,initialState,nextState));
    return endResult;
  }
 catch (  final Exception ex) {
    Exceptions.maybeInterrupted(ex);
    LOG.error(ex,Throwables.getRootCause(ex));
    LOG.error(this.toString(input,initialState,nextState,ex));
    Logs.extreme().error(ex,ex);
    throw Exceptions.toUndeclared(ex);
  }
 finally {
    if (Bootstrap.isFinished() && !Component.State.ENABLED.equals(endResult.lookupState())) {
      Topology.guard().tryDisable(endResult);
    }
  }
}

Fixed version (ground truth):
private ServiceConfiguration doTopologyChange(final ServiceConfiguration input,final State nextState) throws RuntimeException {
  final State initialState=input.lookupState();
  ServiceConfiguration endResult=input;
  try {
    endResult=ServiceTransitions.pathTo(input,nextState).get();
    Logs.exhaust().debug(this.toString(endResult,initialState,nextState));
    return endResult;
  }
 catch (  final Exception ex) {
    Exceptions.maybeInterrupted(ex);
    LOG.error(this.toString(input,initialState,nextState,ex));
    Logs.extreme().error(ex,Throwables.getRootCause(ex));
    Logs.extreme().error(ex,ex);
    throw Exceptions.toUndeclared(ex);
  }
 finally {
    if (Bootstrap.isFinished() && !Component.State.ENABLED.equals(endResult.lookupState())) {
      Topology.guard().tryDisable(endResult);
    }
  }
}