nus-yam/ex-repair huggingface dataset:
Program: 14746
Project: 14746
Buggy source:
public static final <T extends ChannelHandler>void startDownstream(Integer correlationId,T handler){
  if (!StackConfiguration.STATISTICS) {
    return;
  }
 else   if (requestStatistics.containsKey(correlationId)) {
    RequestRecord record=requestStatistics.get(correlationId);
    if (record.last != null) {
      record.last.endTime=System.currentTimeMillis();
      record.last=null;
    }
    record.handlerDownstreamStats.put(handler.getClass(),record.last=new HandlerRecord(handler.getClass()));
  }
}

Fixed version (ground truth):
public static final <T extends ChannelHandler>Callable<Long> startDownstream(Integer correlationId,T handler){
  if (StackConfiguration.STATISTICS && requestStatistics.containsKey(correlationId)) {
    RequestRecord record=requestStatistics.get(correlationId);
    HandlerRecord handlerRecord=new HandlerRecord(handler.getClass());
    record.handlerDownstreamStats.put(handler.getClass(),handlerRecord);
    return handlerRecord;
  }
 else {
    return Callables.returning(0L);
  }
}
Program: 14747
Project: 14747
Buggy source:
@Override public void exceptionCaught(final ChannelHandlerContext ctx,final ExceptionEvent exceptionEvent) throws Exception {
  LOG.info("String_Node_Str" + exceptionEvent + "String_Node_Str");
  final HttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.INTERNAL_SERVER_ERROR);
  DownstreamMessageEvent newEvent=new DownstreamMessageEvent(ctx.getChannel(),ctx.getChannel().getCloseFuture(),response,null);
  ctx.sendDownstream(newEvent);
  newEvent.getFuture().addListener(ChannelFutureListener.CLOSE);
}

Fixed version (ground truth):
public void exceptionCaught(final ChannelHandlerContext ctx,final ExceptionEvent exceptionEvent) throws Exception {
  LOG.info("String_Node_Str" + exceptionEvent + "String_Node_Str");
  final HttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.INTERNAL_SERVER_ERROR);
  DownstreamMessageEvent newEvent=new DownstreamMessageEvent(ctx.getChannel(),ctx.getChannel().getCloseFuture(),response,null);
  ctx.sendDownstream(newEvent);
  newEvent.getFuture().addListener(ChannelFutureListener.CLOSE);
}
Program: 14748
Project: 14748
Buggy source:
@Override public void exceptionCaught(final ChannelHandlerContext ctx,final ExceptionEvent exceptionEvent) throws Exception {
  LOG.info("String_Node_Str" + exceptionEvent + "String_Node_Str");
  final HttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.INTERNAL_SERVER_ERROR);
  DownstreamMessageEvent newEvent=new DownstreamMessageEvent(ctx.getChannel(),ctx.getChannel().getCloseFuture(),response,null);
  ctx.sendDownstream(newEvent);
  newEvent.getFuture().addListener(ChannelFutureListener.CLOSE);
}

Fixed version (ground truth):
public void exceptionCaught(final ChannelHandlerContext ctx,final ExceptionEvent exceptionEvent) throws Exception {
  LOG.info("String_Node_Str" + exceptionEvent + "String_Node_Str");
  final HttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.INTERNAL_SERVER_ERROR);
  DownstreamMessageEvent newEvent=new DownstreamMessageEvent(ctx.getChannel(),ctx.getChannel().getCloseFuture(),response,null);
  ctx.sendDownstream(newEvent);
  newEvent.getFuture().addListener(ChannelFutureListener.CLOSE);
}
Program: 14749
Project: 14749
Buggy source:
@Override public T call() throws Exception {
  long start=System.currentTimeMillis();
  T res=call.call();
  LOG.debug(call.toString() + "String_Node_Str" + (System.currentTimeMillis() - start));
  return res;
}

Fixed version (ground truth):
@Override public T call() throws Exception {
  long start=System.currentTimeMillis();
  T res=call.call();
  LOG.debug(call.toString() + "String_Node_Str" + (System.currentTimeMillis() - start)+ "String_Node_Str");
  return res;
}
Program: 14750
Project: 14750
Buggy source:
public static <T>Callable<T> loggingWrapper(final Callable<T> call){
  return new Callable<T>(){
    @Override public T call() throws Exception {
      long start=System.currentTimeMillis();
      T res=call.call();
      LOG.debug(call.toString() + "String_Node_Str" + (System.currentTimeMillis() - start));
      return res;
    }
  }
;
}

Fixed version (ground truth):
public static <T>Callable<T> loggingWrapper(final Callable<T> call){
  return new Callable<T>(){
    @Override public T call() throws Exception {
      long start=System.currentTimeMillis();
      T res=call.call();
      LOG.debug(call.toString() + "String_Node_Str" + (System.currentTimeMillis() - start)+ "String_Node_Str");
      return res;
    }
  }
;
}
Program: 14751
Project: 14751
Buggy source:
@Override public void entrySet(final String hostKey,final Host host){
  LOG.info("String_Node_Str" + hostKey + "String_Node_Str"+ host);
  try {
    if (host.isLocalHost() && Bootstrap.isFinished()) {
      SyncDatabases.INSTANCE.apply(host);
    }
 else     if (BootstrapComponent.REMOTESETUP.apply(host)) {
      LOG.info("String_Node_Str" + host);
      if (SyncDatabases.INSTANCE.apply(host)) {
        LOG.info("String_Node_Str" + host);
      }
    }
 else     if (InitializeAsCloudController.INSTANCE.apply(host)) {
      LOG.info("String_Node_Str" + host);
    }
 else {
      LOG.debug("String_Node_Str" + host);
    }
  }
 catch (  Exception ex) {
    LOG.error(ex,ex);
  }
}

Fixed version (ground truth):
@Override public void entrySet(final String hostKey,final Host host){
  LOG.info("String_Node_Str" + hostKey + "String_Node_Str"+ host);
  try {
    if (host.isLocalHost() && Bootstrap.isFinished()) {
      SyncDatabases.INSTANCE.apply(host);
    }
 else     if (BootstrapComponent.REMOTESETUP.apply(host)) {
      SyncDatabases.INSTANCE.apply(host);
    }
 else     if (InitializeAsCloudController.INSTANCE.apply(host)) {
      LOG.info("String_Node_Str" + host);
    }
 else {
      LOG.debug("String_Node_Str" + host);
    }
  }
 catch (  Exception ex) {
    LOG.error(ex,ex);
  }
}
Program: 14753
Project: 14753
Buggy source:
private static <T extends EmpyreanMessage>T sendEmpyreanRequest(final ServiceConfiguration parent,final EmpyreanMessage msg) throws Exception {
  ServiceConfiguration config=ServiceConfigurations.createEphemeral(Empyrean.INSTANCE,parent.getInetAddress());
  LOG.debug("String_Node_Str" + msg.getClass().getSimpleName() + "String_Node_Str"+ parent.getFullName());
  try {
    if (System.getProperty("String_Node_Str") == null) {
      T reply=(T)AsyncRequests.sendSync(config,msg);
      return reply;
    }
 else {
      return msg.getReply();
    }
  }
 catch (  Exception ex) {
    LOG.error(parent + "String_Node_Str" + ex.getMessage());
    Logs.extreme().error(ex,ex);
    throw ex;
  }
}

Fixed version (ground truth):
private static <T extends EmpyreanMessage>T sendEmpyreanRequest(final ServiceConfiguration parent,final EmpyreanMessage msg) throws Exception {
  ServiceConfiguration config=ServiceConfigurations.createEphemeral(Empyrean.INSTANCE,parent.getInetAddress());
  Logs.extreme().debug("String_Node_Str" + msg.getClass().getSimpleName() + "String_Node_Str"+ parent.getFullName());
  try {
    if (BootstrapArgs.debugTopology() == null) {
      T reply=(T)AsyncRequests.sendSync(config,msg);
      return reply;
    }
 else {
      return msg.getReply();
    }
  }
 catch (  Exception ex) {
    LOG.error(parent.getFullName() + "String_Node_Str" + ex.getMessage());
    Logs.extreme().error(ex,ex);
    throw ex;
  }
}
Program: 14754
Project: 14754
Buggy source:
private static Callable<ServiceConfiguration> callable(final ServiceConfiguration config,final Function<ServiceConfiguration,ServiceConfiguration> function){
  final Long queueStart=System.currentTimeMillis();
  final Callable<ServiceConfiguration> call=new Callable<ServiceConfiguration>(){
    @Override public ServiceConfiguration call() throws Exception {
      if (Bootstrap.isShuttingDown()) {
        throw Exceptions.toUndeclared("String_Node_Str");
      }
 else {
        final Long serviceStart=System.currentTimeMillis();
        Logs.extreme().debug(EventRecord.here(Topology.class,EventType.DEQUEUE,function.toString(),config.getFullName().toString(),Long.toString(serviceStart - queueStart),"String_Node_Str"));
        try {
          final ServiceConfiguration result=function.apply(config);
          Logs.extreme().debug(EventRecord.here(Topology.class,EventType.QUEUE,function.toString(),config.getFullName().toString(),Long.toString(System.currentTimeMillis() - serviceStart),"String_Node_Str"));
          return result;
        }
 catch (        final Exception ex) {
          final Throwable t=Exceptions.unwrapCause(ex);
          Logs.extreme().error(t,t);
          LOG.error(config.getFullName() + "String_Node_Str" + t);
          throw ex;
        }
      }
    }
    @Override public String toString(){
      return Topology.class.getSimpleName() + "String_Node_Str" + config.getFullName()+ "String_Node_Str"+ function.toString();
    }
  }
;
  return call;
}

Fixed version (ground truth):
private static Callable<ServiceConfiguration> callable(final ServiceConfiguration config,final Function<ServiceConfiguration,ServiceConfiguration> function){
  final Long queueStart=System.currentTimeMillis();
  final Callable<ServiceConfiguration> call=new Callable<ServiceConfiguration>(){
    @Override public ServiceConfiguration call() throws Exception {
      if (Bootstrap.isShuttingDown()) {
        throw Exceptions.toUndeclared("String_Node_Str");
      }
 else {
        final Long serviceStart=System.currentTimeMillis();
        Logs.extreme().debug(EventRecord.here(Topology.class,EventType.DEQUEUE,function.toString(),config.getFullName().toString(),Long.toString(serviceStart - queueStart),"String_Node_Str"));
        try {
          final ServiceConfiguration result=function.apply(config);
          Logs.extreme().debug(EventRecord.here(Topology.class,EventType.QUEUE,function.toString(),config.getFullName().toString(),Long.toString(System.currentTimeMillis() - serviceStart),"String_Node_Str"));
          return result;
        }
 catch (        final Exception ex) {
          final Throwable t=Exceptions.unwrapCause(ex);
          LOG.error(config.getFullName() + "String_Node_Str" + t.getMessage());
          Logs.extreme().error(t,t);
          throw ex;
        }
      }
    }
    @Override public String toString(){
      return Topology.class.getSimpleName() + "String_Node_Str" + config.getFullName()+ "String_Node_Str"+ function.toString();
    }
  }
;
  return call;
}
Program: 14755
Project: 14755
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.debug(this.toString(input,initialState,nextState,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));
    throw Exceptions.toUndeclared(ex);
  }
 finally {
    if (Bootstrap.isFinished() && !Component.State.ENABLED.equals(endResult.lookupState())) {
      Topology.guard().tryDisable(endResult);
    }
  }
}
Program: 14756
Project: 14756
Buggy source:
@Override public ServiceConfiguration call() throws Exception {
  if (Bootstrap.isShuttingDown()) {
    throw Exceptions.toUndeclared("String_Node_Str");
  }
 else {
    final Long serviceStart=System.currentTimeMillis();
    Logs.extreme().debug(EventRecord.here(Topology.class,EventType.DEQUEUE,function.toString(),config.getFullName().toString(),Long.toString(serviceStart - queueStart),"String_Node_Str"));
    try {
      final ServiceConfiguration result=function.apply(config);
      Logs.extreme().debug(EventRecord.here(Topology.class,EventType.QUEUE,function.toString(),config.getFullName().toString(),Long.toString(System.currentTimeMillis() - serviceStart),"String_Node_Str"));
      return result;
    }
 catch (    final Exception ex) {
      final Throwable t=Exceptions.unwrapCause(ex);
      Logs.extreme().error(t,t);
      LOG.error(config.getFullName() + "String_Node_Str" + t);
      throw ex;
    }
  }
}

Fixed version (ground truth):
@Override public ServiceConfiguration call() throws Exception {
  if (Bootstrap.isShuttingDown()) {
    throw Exceptions.toUndeclared("String_Node_Str");
  }
 else {
    final Long serviceStart=System.currentTimeMillis();
    Logs.extreme().debug(EventRecord.here(Topology.class,EventType.DEQUEUE,function.toString(),config.getFullName().toString(),Long.toString(serviceStart - queueStart),"String_Node_Str"));
    try {
      final ServiceConfiguration result=function.apply(config);
      Logs.extreme().debug(EventRecord.here(Topology.class,EventType.QUEUE,function.toString(),config.getFullName().toString(),Long.toString(System.currentTimeMillis() - serviceStart),"String_Node_Str"));
      return result;
    }
 catch (    final Exception ex) {
      final Throwable t=Exceptions.unwrapCause(ex);
      LOG.error(config.getFullName() + "String_Node_Str" + t.getMessage());
      Logs.extreme().error(t,t);
      throw ex;
    }
  }
}
Program: 14757
Project: 14757
Buggy source:
public static <T>T eval(String code) throws ScriptExecutionFailedException {
  try {
    return (T)getGroovyEngine().eval(code);
  }
 catch (  Exception e) {
    LOG.debug(e,e);
    throw new ScriptExecutionFailedException("String_Node_Str" + code,e);
  }
}

Fixed version (ground truth):
public static <T>T eval(String code) throws ScriptExecutionFailedException {
  try {
    return (T)getGroovyEngine().eval(code);
  }
 catch (  Exception e) {
    LOG.debug(e,e);
    throw new ScriptExecutionFailedException("String_Node_Str" + "String_Node_Str" + code + "String_Node_Str"+ "String_Node_Str"+ Exceptions.causeString(e),e);
  }
}
Program: 14758
Project: 14758
Buggy source:
@Override public void entrySet(final String hostKey,final Host host){
  LOG.info("String_Node_Str" + hostKey + "String_Node_Str"+ host);
  try {
    if (host.isLocalHost() && Bootstrap.isFinished()) {
      LOG.info("String_Node_Str" + host);
      BootstrapComponent.SETUP.apply(host);
      if (SyncDatabases.INSTANCE.apply(host)) {
        LOG.info("String_Node_Str" + host);
      }
    }
 else     if (BootstrapComponent.REMOTESETUP.apply(host)) {
      LOG.info("String_Node_Str" + host);
      if (SyncDatabases.INSTANCE.apply(host)) {
        LOG.info("String_Node_Str" + host);
      }
    }
 else     if (InitializeAsCloudController.INSTANCE.apply(host)) {
      LOG.info("String_Node_Str" + host);
    }
 else {
      LOG.debug("String_Node_Str" + host);
    }
  }
 catch (  Exception ex) {
    LOG.error(ex,ex);
  }
  LOG.info("String_Node_Str" + printMap());
}

Fixed version (ground truth):
@Override public void entrySet(final String hostKey,final Host host){
  LOG.info("String_Node_Str" + hostKey + "String_Node_Str"+ host);
  try {
    if (host.isLocalHost() && Bootstrap.isFinished()) {
      SyncDatabases.INSTANCE.apply(host);
    }
 else     if (BootstrapComponent.REMOTESETUP.apply(host)) {
      LOG.info("String_Node_Str" + host);
      if (SyncDatabases.INSTANCE.apply(host)) {
        LOG.info("String_Node_Str" + host);
      }
    }
 else     if (InitializeAsCloudController.INSTANCE.apply(host)) {
      LOG.info("String_Node_Str" + host);
    }
 else {
      LOG.debug("String_Node_Str" + host);
    }
  }
 catch (  Exception ex) {
    LOG.error(ex,ex);
  }
}
Program: 14759
Project: 14759
Buggy source:
@Override public void fireEvent(final Hertz event){
  final Host currentHost=Hosts.localHost();
  if (!BootstrapArgs.isCloudController() && currentHost.hasBootstrapped() && Databases.shouldInitialize()) {
    System.exit(123);
  }
  if (event.isAsserted(15L)) {
    UpdateEntry.INSTANCE.apply(currentHost);
  }
  Set<Address> currentMembers=Sets.newHashSet(hostMap.getChannel().getView().getMembers());
  Map<String,Host> hostCopy=Maps.newHashMap(hostMap);
  Set<Address> currentHosts=Sets.newHashSet(Collections2.transform(hostCopy.values(),GroupAddressTransform.INSTANCE));
  Set<Address> strayHosts=Sets.difference(currentHosts,currentMembers);
  for (  Address strayHost : strayHosts) {
    Host h=hostCopy.get(strayHost);
    BootstrapComponent.TEARDOWN.apply(h);
    hostMap.remove(strayHost);
  }
}

Fixed version (ground truth):
@Override public void fireEvent(final Hertz event){
  final Host currentHost=Hosts.localHost();
  if (!BootstrapArgs.isCloudController() && currentHost.hasBootstrapped() && Databases.shouldInitialize()) {
    System.exit(123);
  }
  if (event.isAsserted(15L)) {
    UpdateEntry.INSTANCE.apply(currentHost);
  }
}
Program: 14761
Project: 14761
Buggy source:
@Override public void entryRemoved(final String input){
  LOG.info("String_Node_Str" + input);
  LOG.info("String_Node_Str" + printMap());
}

Fixed version (ground truth):
@Override public void entryRemoved(final String input){
  LOG.info("String_Node_Str" + input);
}
Program: 14762
Project: 14762
Buggy source:
@Override public void viewChange(final View currentView,final Vector<Address> joinMembers,final Vector<Address> partMembers){
  LOG.info("String_Node_Str" + Joiner.on("String_Node_Str").join(currentView.getMembers()));
  if (!joinMembers.isEmpty())   LOG.info("String_Node_Str" + Joiner.on("String_Node_Str").join(joinMembers));
  if (!partMembers.isEmpty())   LOG.info("String_Node_Str" + Joiner.on("String_Node_Str").join(partMembers));
  for (  final Host h : Hosts.list()) {
    if (Iterables.contains(partMembers,h.getGroupsId())) {
      BootstrapComponent.TEARDOWN.apply(h);
      LOG.info("String_Node_Str" + h);
    }
  }
  LOG.info("String_Node_Str" + printMap());
}

Fixed version (ground truth):
@Override public void viewChange(final View currentView,final Vector<Address> joinMembers,final Vector<Address> partMembers){
  LOG.info("String_Node_Str" + printMap());
  LOG.info("String_Node_Str" + Joiner.on("String_Node_Str").join(currentView.getMembers()));
  if (!joinMembers.isEmpty())   LOG.info("String_Node_Str" + Joiner.on("String_Node_Str").join(joinMembers));
  if (!partMembers.isEmpty())   LOG.info("String_Node_Str" + Joiner.on("String_Node_Str").join(partMembers));
  for (  final Host h : Hosts.list()) {
    if (Iterables.contains(partMembers,h.getGroupsId())) {
      BootstrapComponent.TEARDOWN.apply(h);
      LOG.info("String_Node_Str" + h);
    }
  }
}
Program: 14764
Project: 14764
Buggy source:
public static boolean isReachable(InetAddress addr,int timeout) throws IOException {
  try {
    return (Boolean)Groovyness.eval(String.format("String_Node_Str",timeout / 1000.0,addr.getHostAddress()));
  }
 catch (  ScriptExecutionFailedException ex) {
    Logs.extreme().error(ex,ex);
    return addr.isReachable(timeout);
  }
}

Fixed version (ground truth):
public static boolean isReachable(InetAddress addr,int timeoutMillis) throws IOException {
  try {
    timeoutMillis=timeoutMillis / 1000;
    return (Boolean)Groovyness.eval(String.format("String_Node_Str",timeoutMillis,addr.getHostAddress()));
  }
 catch (  ScriptExecutionFailedException ex) {
    Logs.extreme().error(ex,ex);
    return addr.isReachable(timeoutMillis);
  }
}
Program: 14765
Project: 14765
Buggy source:
public static boolean isReachable(InetAddress addr,int timeout) throws IOException {
  try {
    return (Boolean)Groovyness.eval(String.format("String_Node_Str",timeout / 1000.0,addr.getHostAddress()));
  }
 catch (  ScriptExecutionFailedException ex) {
    Logs.extreme().error(ex,ex);
    return addr.isReachable(timeout);
  }
}

Fixed version (ground truth):
public static boolean isReachable(InetAddress addr,int timeoutMillis) throws IOException {
  try {
    timeoutMillis=timeoutMillis / 1000;
    return (Boolean)Groovyness.eval(String.format("String_Node_Str",timeoutMillis,addr.getHostAddress()));
  }
 catch (  ScriptExecutionFailedException ex) {
    Logs.extreme().error(ex,ex);
    return addr.isReachable(timeoutMillis);
  }
}
Program: 14766
Project: 14766
Buggy source:
@Override public void run(){
  try {
    final InetAddress addr=InetAddress.getByName(hostName);
    if (addr.isReachable(2000)) {
      ArbitratorControl.error.remove(hostName);
      ArbitratorControl.okay.put(hostName,config);
    }
  }
 catch (  final UnknownHostException e) {
    ArbitratorControl.error.put(config,Exceptions.filterStackTrace(e));
    ArbitratorControl.okay.remove(hostName);
  }
catch (  final IOException e) {
    ArbitratorControl.error.put(config,Exceptions.filterStackTrace(e));
    ArbitratorControl.okay.remove(hostName);
  }
  EventRecord.here(ArbitratorControl.class,EventType.BOOTSTRAPPER_CHECK,hostName,"String_Node_Str",error.get(hostName).toString()).debug();
}

Fixed version (ground truth):
@Override public void run(){
  try {
    final InetAddress addr=InetAddress.getByName(hostName);
    if (Internets.isReachable(addr,2000)) {
      ArbitratorControl.error.remove(hostName);
      ArbitratorControl.okay.put(hostName,config);
    }
 else {
      ArbitratorControl.error.put(config,Exceptions.filterStackTrace(new NoRouteToHostException(addr.toString())));
      ArbitratorControl.okay.remove(hostName);
    }
  }
 catch (  final UnknownHostException e) {
    ArbitratorControl.error.put(config,Exceptions.filterStackTrace(e));
    ArbitratorControl.okay.remove(hostName);
  }
catch (  final IOException e) {
    ArbitratorControl.error.put(config,Exceptions.filterStackTrace(e));
    ArbitratorControl.okay.remove(hostName);
  }
  EventRecord.here(ArbitratorControl.class,EventType.BOOTSTRAPPER_CHECK,hostName,"String_Node_Str",error.get(hostName).toString()).debug();
}
Program: 14768
Project: 14768
Buggy source:
@Override public void fireEnable(ServiceConfiguration config) throws ServiceRegistrationException {
  if (!config.isVmLocal()) {
    for (    Host h : Hosts.list()) {
      if (h.getHostAddresses().contains(config.getInetAddress())) {
        EventRecord.here(EucalyptusBuilder.class,EventType.COMPONENT_SERVICE_ENABLED,config.toString()).info();
        return;
      }
    }
    throw new ServiceRegistrationException("String_Node_Str" + config.getFullName() + "String_Node_Str"+ Hosts.list());
  }
}

Fixed version (ground truth):
@Override public void fireEnable(ServiceConfiguration config) throws ServiceRegistrationException {
  if (!config.isVmLocal()) {
    for (    Host h : Hosts.list()) {
      if (h.getHostAddresses().contains(config.getInetAddress())) {
        EventRecord.here(EucalyptusBuilder.class,EventType.COMPONENT_SERVICE_ENABLED,config.toString()).info();
        return;
      }
    }
    throw new ServiceRegistrationException("String_Node_Str" + config.getFullName() + "String_Node_Str"+ Hosts.list());
  }
 else   if (!Hosts.Coordinator.INSTANCE.isLocalhost()) {
    throw new ServiceRegistrationException("String_Node_Str" + config.getFullName() + "String_Node_Str"+ Hosts.list());
  }
}
Program: 14769
Project: 14769
Buggy source:
private String createUniqueName(){
  return (this.ownerAccountName != null && this.getDisplayName() != null) ? this.ownerAccountName + "String_Node_Str" + this.getDisplayName() : null;
}

Fixed version (ground truth):
private String createUniqueName(){
  return (this.ownerAccountNumber != null && this.getDisplayName() != null) ? this.ownerAccountNumber + "String_Node_Str" + this.getDisplayName() : null;
}
Program: 14770
Project: 14770
Buggy source:
@Override public void addUserByName(String userName) throws AuthException {
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity groupEntity=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    UserEntity userEntity=DatabaseAuthUtils.getUniqueUser(db,userName,groupEntity.getAccount().getName());
    groupEntity.getUsers().add(userEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + userName + "String_Node_Str"+ this.delegate);
    throw new AuthException(e);
  }
}

Fixed version (ground truth):
@Override public void addUserByName(String userName) throws AuthException {
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity groupEntity=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    UserEntity userEntity=DatabaseAuthUtils.getUniqueUser(db,userName,groupEntity.getAccount().getName());
    groupEntity.getUsers().add(userEntity);
    userEntity.getGroups().add(groupEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + userName + "String_Node_Str"+ this.delegate);
    throw new AuthException(e);
  }
}
Program: 14771
Project: 14771
Buggy source:
@Override public void removePolicy(String name) throws AuthException {
  if (name == null) {
    throw new AuthException("String_Node_Str");
  }
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity group=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    PolicyEntity policy=DatabaseAuthUtils.removeGroupPolicy(group,name);
    if (policy != null) {
      db.recast(PolicyEntity.class).delete(policy);
    }
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + name + "String_Node_Str"+ this.delegate);
    throw new AuthException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void removePolicy(String name) throws AuthException {
  if (name == null) {
    throw new AuthException(AuthException.EMPTY_POLICY_NAME);
  }
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity group=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    PolicyEntity policy=DatabaseAuthUtils.removeGroupPolicy(group,name);
    if (policy != null) {
      db.recast(PolicyEntity.class).delete(policy);
    }
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + name + "String_Node_Str"+ this.delegate);
    throw new AuthException("String_Node_Str",e);
  }
}
Program: 14772
Project: 14772
Buggy source:
@Override public void removeUserByName(String userName) throws AuthException {
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity groupEntity=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    UserEntity userEntity=DatabaseAuthUtils.getUniqueUser(db,userName,groupEntity.getAccount().getName());
    groupEntity.getUsers().remove(userEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + userName + "String_Node_Str"+ this.delegate);
    throw new AuthException(e);
  }
}

Fixed version (ground truth):
@Override public void removeUserByName(String userName) throws AuthException {
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity groupEntity=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    UserEntity userEntity=DatabaseAuthUtils.getUniqueUser(db,userName,groupEntity.getAccount().getName());
    groupEntity.getUsers().remove(userEntity);
    userEntity.getGroups().remove(groupEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + userName + "String_Node_Str"+ this.delegate);
    throw new AuthException(e);
  }
}
Program: 14773
Project: 14773
Buggy source:
@Override public void removeKey(final String keyId) throws AuthException {
  EntityWrapper<UserEntity> db=EntityWrapper.get(UserEntity.class);
  try {
    UserEntity user=db.getUnique(UserEntity.newInstanceWithUserId(this.delegate.getUserId()));
    AccessKeyEntity keyEntity=db.recast(AccessKeyEntity.class).getUnique(AccessKeyEntity.newInstanceWithAccessKeyId(keyId));
    user.getKeys().remove(keyEntity);
    db.recast(AccessKeyEntity.class).delete(keyEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + keyId);
    throw new AuthException(e);
  }
}

Fixed version (ground truth):
@Override public void removeKey(final String keyId) throws AuthException {
  if (Strings.isNullOrEmpty(keyId)) {
    throw new AuthException(AuthException.EMPTY_KEY_ID);
  }
  EntityWrapper<UserEntity> db=EntityWrapper.get(UserEntity.class);
  try {
    UserEntity user=db.getUnique(UserEntity.newInstanceWithUserId(this.delegate.getUserId()));
    AccessKeyEntity keyEntity=db.recast(AccessKeyEntity.class).getUnique(AccessKeyEntity.newInstanceWithAccessKeyId(keyId));
    user.getKeys().remove(keyEntity);
    db.recast(AccessKeyEntity.class).delete(keyEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + keyId);
    throw new AuthException(e);
  }
}
Program: 14774
Project: 14774
Buggy source:
@Override public void removePolicy(String name) throws AuthException {
  if (name == null) {
    throw new AuthException("String_Node_Str");
  }
  EntityWrapper<UserEntity> db=EntityWrapper.get(UserEntity.class);
  try {
    UserEntity user=db.getUnique(UserEntity.newInstanceWithUserId(this.delegate.getUserId()));
    GroupEntity group=getUserGroupEntity(user);
    if (group == null) {
      throw new RuntimeException("String_Node_Str" + this.delegate.getName());
    }
    PolicyEntity policy=DatabaseAuthUtils.removeGroupPolicy(group,name);
    if (policy != null) {
      db.recast(PolicyEntity.class).delete(policy);
    }
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + name + "String_Node_Str"+ this.delegate);
    throw new AuthException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void removePolicy(String name) throws AuthException {
  if (Strings.isNullOrEmpty(name)) {
    throw new AuthException(AuthException.EMPTY_POLICY_NAME);
  }
  EntityWrapper<UserEntity> db=EntityWrapper.get(UserEntity.class);
  try {
    UserEntity user=db.getUnique(UserEntity.newInstanceWithUserId(this.delegate.getUserId()));
    GroupEntity group=getUserGroupEntity(user);
    if (group == null) {
      throw new RuntimeException("String_Node_Str" + this.delegate.getName());
    }
    PolicyEntity policy=DatabaseAuthUtils.removeGroupPolicy(group,name);
    if (policy != null) {
      db.recast(PolicyEntity.class).delete(policy);
    }
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + name + "String_Node_Str"+ this.delegate);
    throw new AuthException("String_Node_Str",e);
  }
}
Program: 14775
Project: 14775
Buggy source:
@Override public void removeCertificate(final String certficateId) throws AuthException {
  EntityWrapper<CertificateEntity> db=EntityWrapper.get(CertificateEntity.class);
  try {
    CertificateEntity certificateEntity=db.getUnique(CertificateEntity.newInstanceWithId(certficateId));
    certificateEntity.setRevoked(true);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + certficateId);
    throw new AuthException(e);
  }
}

Fixed version (ground truth):
@Override public void removeCertificate(final String certficateId) throws AuthException {
  if (Strings.isNullOrEmpty(certficateId)) {
    throw new AuthException(AuthException.EMPTY_CERT_ID);
  }
  EntityWrapper<CertificateEntity> db=EntityWrapper.get(CertificateEntity.class);
  try {
    CertificateEntity certificateEntity=db.getUnique(CertificateEntity.newInstanceWithId(certficateId));
    certificateEntity.setRevoked(true);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + certficateId);
    throw new AuthException(e);
  }
}
Program: 14777
Project: 14777
Buggy source:
@Override public void addUserByName(String userName) throws AuthException {
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity groupEntity=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    UserEntity userEntity=DatabaseAuthUtils.getUniqueUser(db,userName,groupEntity.getAccount().getName());
    groupEntity.getUsers().add(userEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + userName + "String_Node_Str"+ this.delegate);
    throw new AuthException(e);
  }
}

Fixed version (ground truth):
@Override public void addUserByName(String userName) throws AuthException {
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity groupEntity=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    UserEntity userEntity=DatabaseAuthUtils.getUniqueUser(db,userName,groupEntity.getAccount().getName());
    groupEntity.getUsers().add(userEntity);
    userEntity.getGroups().add(groupEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + userName + "String_Node_Str"+ this.delegate);
    throw new AuthException(e);
  }
}
Program: 14778
Project: 14778
Buggy source:
@Override public void removeUserByName(String userName) throws AuthException {
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity groupEntity=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    UserEntity userEntity=DatabaseAuthUtils.getUniqueUser(db,userName,groupEntity.getAccount().getName());
    groupEntity.getUsers().remove(userEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + userName + "String_Node_Str"+ this.delegate);
    throw new AuthException(e);
  }
}

Fixed version (ground truth):
@Override public void removeUserByName(String userName) throws AuthException {
  EntityWrapper<GroupEntity> db=EntityWrapper.get(GroupEntity.class);
  try {
    GroupEntity groupEntity=db.getUnique(GroupEntity.newInstanceWithGroupId(this.delegate.getGroupId()));
    UserEntity userEntity=DatabaseAuthUtils.getUniqueUser(db,userName,groupEntity.getAccount().getName());
    groupEntity.getUsers().remove(userEntity);
    userEntity.getGroups().remove(groupEntity);
    db.commit();
  }
 catch (  Exception e) {
    db.rollback();
    Debugging.logError(LOG,e,"String_Node_Str" + userName + "String_Node_Str"+ this.delegate);
    throw new AuthException(e);
  }
}
Program: 14780
Project: 14780
Buggy source:
public static RegisterComponentResponseType registerComponent(final RegisterComponentType request) throws EucalyptusCloudException {
  ServiceBuilder<? extends ServiceConfiguration> builder=ServiceBuilders.handles(request.getClass());
  final ComponentId componentId=builder.getComponentId();
  final RegisterComponentResponseType reply=request.getReply();
  final String name=request.getName();
  final String hostName=request.getHost();
  final Integer port=request.getPort();
  assertThat("String_Node_Str" + request,name,notNullValue());
  assertThat("String_Node_Str" + request,hostName,notNullValue());
  assertThat("String_Node_Str" + request,port,notNullValue());
  String partition=request.getPartition();
  if (!componentId.isPartitioned()) {
    partition=componentId.getPartition();
    LOG.error("String_Node_Str" + componentId.getName() + "String_Node_Str"+ partition+ "String_Node_Str"+ request);
  }
 else   if (componentId.isPartitioned() && (partition == null)) {
    partition=name;
    LOG.error("String_Node_Str" + partition + "String_Node_Str"+ request);
  }
  try {
    reply.set_return(ComponentRegistrationHandler.register(componentId,partition,name,hostName,port));
  }
 catch (  final Throwable ex) {
    throw new EucalyptusCloudException("String_Node_Str" + ex.getMessage(),ex);
  }
  return reply;
}

Fixed version (ground truth):
public static RegisterComponentResponseType registerComponent(final RegisterComponentType request) throws EucalyptusCloudException {
  ServiceBuilder<? extends ServiceConfiguration> builder=ServiceBuilders.handles(request.getClass());
  final ComponentId componentId=builder.getComponentId();
  final RegisterComponentResponseType reply=request.getReply();
  final String name=request.getName();
  final String hostName=request.getHost();
  final Integer port=request.getPort();
  assertThat("String_Node_Str" + request,name,notNullValue());
  assertThat("String_Node_Str" + request,hostName,notNullValue());
  assertThat("String_Node_Str" + request,port,notNullValue());
  String partition=request.getPartition();
  if (!componentId.isPartitioned()) {
    partition=componentId.getPartition();
    LOG.error("String_Node_Str" + componentId.getName() + "String_Node_Str"+ partition+ "String_Node_Str"+ request);
  }
 else   if (componentId.isPartitioned() && (partition == null)) {
    partition=name;
    LOG.error("String_Node_Str" + partition + "String_Node_Str"+ request);
  }
  try {
    reply.set_return(ComponentRegistrationHandler.register(componentId,partition,name,hostName,port));
  }
 catch (  final Throwable ex) {
    reply.set_return(false);
    reply.setStatusMessage(ex.getMessage());
  }
  return reply;
}
Program: 14781
Project: 14781
Buggy source:
public static DeregisterComponentResponseType deregisterComponent(final DeregisterComponentType request) throws EucalyptusCloudException {
  ServiceBuilder<? extends ServiceConfiguration> builder=ServiceBuilders.handles(request.getClass());
  final ComponentId componentId=builder.getComponentId();
  final DeregisterComponentResponseType reply=(DeregisterComponentResponseType)request.getReply();
  try {
    reply.set_return(ComponentRegistrationHandler.deregister(componentId,request.getName()));
  }
 catch (  final Throwable ex) {
    throw new EucalyptusCloudException("String_Node_Str" + ex.getMessage(),ex);
  }
  return reply;
}

Fixed version (ground truth):
public static DeregisterComponentResponseType deregisterComponent(final DeregisterComponentType request) throws EucalyptusCloudException {
  ServiceBuilder<? extends ServiceConfiguration> builder=ServiceBuilders.handles(request.getClass());
  final ComponentId componentId=builder.getComponentId();
  final DeregisterComponentResponseType reply=(DeregisterComponentResponseType)request.getReply();
  try {
    reply.set_return(ComponentRegistrationHandler.deregister(componentId,request.getName()));
  }
 catch (  final Throwable ex) {
    reply.set_return(false);
    reply.setStatusMessage(ex.getMessage());
  }
  return reply;
}
Program: 14782
Project: 14782
Buggy source:
public static boolean deregister(final ComponentId compId,String name) throws ServiceRegistrationException, EucalyptusCloudException {
  final ServiceBuilder<?> builder=ServiceBuilders.lookup(compId);
  LOG.info("String_Node_Str" + builder.getClass().getSimpleName());
  try {
    if (!checkRemove(builder,name)) {
      LOG.info(builder.getClass().getSimpleName() + "String_Node_Str");
      throw new ServiceRegistrationException(builder.getClass().getSimpleName() + "String_Node_Str" + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    LOG.info(builder.getClass().getSimpleName() + "String_Node_Str");
    throw new ServiceRegistrationException(builder.getClass().getSimpleName() + "String_Node_Str" + e.getMessage(),e);
  }
  final ServiceConfiguration conf=ServiceConfigurations.lookupByName(compId.getClass(),name);
  Topology.destroy(conf);
  ServiceConfigurations.remove(conf);
  return true;
}

Fixed version (ground truth):
public static boolean deregister(final ComponentId compId,String name) throws ServiceRegistrationException, EucalyptusCloudException {
  final ServiceBuilder<?> builder=ServiceBuilders.lookup(compId);
  LOG.info("String_Node_Str" + builder.getClass().getSimpleName());
  try {
    if (!checkRemove(builder,name)) {
      LOG.info(builder.getClass().getSimpleName() + "String_Node_Str");
      throw new ServiceRegistrationException(builder.getClass().getSimpleName() + "String_Node_Str" + "String_Node_Str");
    }
  }
 catch (  Exception e) {
    LOG.info(builder.getClass().getSimpleName() + "String_Node_Str");
    throw new ServiceRegistrationException(builder.getClass().getSimpleName() + "String_Node_Str" + e.getMessage(),e);
  }
  try {
    final ServiceConfiguration conf=ServiceConfigurations.lookupByName(compId.getClass(),name);
    Topology.destroy(conf);
    Components.lookup(compId).destroy(conf);
    ServiceConfigurations.remove(conf);
  }
 catch (  Exception e) {
    LOG.info(builder.getClass().getSimpleName() + "String_Node_Str" + e.getMessage());
    throw new ServiceRegistrationException(builder.getClass().getSimpleName() + "String_Node_Str" + e.getMessage(),e);
  }
  return true;
}
Program: 14784
Project: 14784
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=super.hashCode();
  result=prime * result + ((this.name == null) ? 0 : this.name.hashCode());
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=0;
  result=prime * result + ((this.name == null) ? 0 : this.name.hashCode());
  return result;
}
Program: 14785
Project: 14785
Buggy source:
public AllocateAddressResponseType allocate(final AllocateAddressType request) throws Exception {
  AllocateAddressResponseType reply=(AllocateAddressResponseType)request.getReply();
  Address address=RestrictedTypes.allocateNamedUnitlessResources(1,Addresses.Allocator.INSTANCE,Addresses.Allocator.INSTANCE).get(0);
  reply.setPublicIp(address.getName());
  return reply;
}

Fixed version (ground truth):
public AllocateAddressResponseType allocate(final AllocateAddressType request) throws Exception {
  AllocateAddressResponseType reply=(AllocateAddressResponseType)request.getReply();
  try {
    Address address=RestrictedTypes.allocateNamedUnitlessResources(1,Addresses.Allocator.INSTANCE,Addresses.Allocator.INSTANCE).get(0);
    reply.setPublicIp(address.getName());
  }
 catch (  RuntimeException e) {
    if (e.getCause() != null)     throw new EucalyptusCloudException(e.getCause());
 else     throw new EucalyptusCloudException("String_Node_Str");
  }
catch (  Exception e) {
    throw e;
  }
  return reply;
}
Program: 14786
Project: 14786
Buggy source:
/** 
 * Allocate   {@code quantity} unitless resources, correctly rolling their allocation back in thecase of partial failures.
 */
private static <T>List<T> runAllocator(int quantity,Supplier<T> allocator,Predicate<T> rollback){
  List<T> res=Lists.newArrayList();
  try {
    for (int i=0; i < quantity; i++) {
      res.add(allocator.get());
    }
  }
 catch (  Exception ex) {
    for (    T rsc : res) {
      try {
        rollback.apply(rsc);
      }
 catch (      Exception ex1) {
        LOG.trace(ex1,ex1);
      }
    }
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Allocate   {@code quantity} unitless resources, correctly rolling their allocation back in thecase of partial failures.
 */
private static <T>List<T> runAllocator(int quantity,Supplier<T> allocator,Predicate<T> rollback){
  List<T> res=Lists.newArrayList();
  try {
    for (int i=0; i < quantity; i++) {
      T rsc=allocator.get();
      if (rsc == null)       throw new NoSuchElementException("String_Node_Str" + quantity + "String_Node_Str");
      res.add(rsc);
    }
  }
 catch (  Exception ex) {
    for (    T rsc : res) {
      try {
        rollback.apply(rsc);
      }
 catch (      Exception ex1) {
        LOG.trace(ex1,ex1);
      }
    }
    if (ex.getCause() != null)     throw Exceptions.toUndeclared(ex.getCause());
 else     throw Exceptions.toUndeclared(ex);
  }
  return res;
}
Program: 14787
Project: 14787
Buggy source:
public AllocateAddressResponseType allocate(final AllocateAddressType request) throws Exception {
  AllocateAddressResponseType reply=(AllocateAddressResponseType)request.getReply();
  Address address=RestrictedTypes.allocateNamedUnitlessResources(1,Addresses.Allocator.INSTANCE,Addresses.Allocator.INSTANCE).get(0);
  reply.setPublicIp(address.getName());
  return reply;
}

Fixed version (ground truth):
public AllocateAddressResponseType allocate(final AllocateAddressType request) throws Exception {
  AllocateAddressResponseType reply=(AllocateAddressResponseType)request.getReply();
  try {
    Address address=RestrictedTypes.allocateNamedUnitlessResources(1,Addresses.Allocator.INSTANCE,Addresses.Allocator.INSTANCE).get(0);
    reply.setPublicIp(address.getName());
  }
 catch (  RuntimeException e) {
    if (e.getCause() != null)     throw new EucalyptusCloudException(e.getCause());
 else     throw new EucalyptusCloudException("String_Node_Str");
  }
catch (  Exception e) {
    throw e;
  }
  return reply;
}
Program: 14788
Project: 14788
Buggy source:
/** 
 * Allocate   {@code quantity} unitless resources, correctly rolling their allocation back in thecase of partial failures.
 */
private static <T>List<T> runAllocator(int quantity,Supplier<T> allocator,Predicate<T> rollback){
  List<T> res=Lists.newArrayList();
  try {
    for (int i=0; i < quantity; i++) {
      res.add(allocator.get());
    }
  }
 catch (  Exception ex) {
    for (    T rsc : res) {
      try {
        rollback.apply(rsc);
      }
 catch (      Exception ex1) {
        LOG.trace(ex1,ex1);
      }
    }
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Allocate   {@code quantity} unitless resources, correctly rolling their allocation back in thecase of partial failures.
 */
private static <T>List<T> runAllocator(int quantity,Supplier<T> allocator,Predicate<T> rollback){
  List<T> res=Lists.newArrayList();
  try {
    for (int i=0; i < quantity; i++) {
      T rsc=allocator.get();
      if (rsc == null)       throw new NoSuchElementException("String_Node_Str" + quantity + "String_Node_Str");
      res.add(rsc);
    }
  }
 catch (  Exception ex) {
    for (    T rsc : res) {
      try {
        rollback.apply(rsc);
      }
 catch (      Exception ex1) {
        LOG.trace(ex1,ex1);
      }
    }
    if (ex.getCause() != null)     throw Exceptions.toUndeclared(ex.getCause());
 else     throw Exceptions.toUndeclared(ex);
  }
  return res;
}