nus-yam/ex-repair huggingface dataset:
Program: 14154
Project: 14154
Buggy source:
public static DirectStorageInfo getStorageInfo(){
  DirectStorageInfo conf=null;
  TransactionResource tran=Entities.transactionFor(DirectStorageInfo.class);
  try {
    conf=Entities.uniqueResult(new DirectStorageInfo(StorageProperties.NAME));
    if (null == conf.getTimeoutInMillis()) {
      conf.setTimeoutInMillis(StorageProperties.timeoutInMillis);
      Entities.merge(conf);
    }
    tran.commit();
  }
 catch (  NoSuchElementException e) {
    LOG.warn("String_Node_Str" + StorageProperties.NAME + "String_Node_Str");
    conf=new DirectStorageInfo(StorageProperties.NAME,StorageProperties.iface,StorageProperties.storageRootDirectory,StorageProperties.zeroFillVolumes,StorageProperties.timeoutInMillis);
    Entities.persist(conf);
    tran.commit();
  }
catch (  Exception t) {
    LOG.error("String_Node_Str" + StorageProperties.NAME);
    tran.rollback();
    return new DirectStorageInfo(StorageProperties.NAME,StorageProperties.iface,StorageProperties.storageRootDirectory,StorageProperties.zeroFillVolumes,StorageProperties.timeoutInMillis);
  }
  return conf;
}

Fixed version (ground truth):
public static DirectStorageInfo getStorageInfo(){
  DirectStorageInfo conf=null;
  try {
    conf=Transactions.find(new DirectStorageInfo());
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str" + StorageProperties.NAME + "String_Node_Str");
    try {
      conf=Transactions.saveDirect(new DirectStorageInfo(StorageProperties.NAME,StorageProperties.iface,StorageProperties.storageRootDirectory,StorageProperties.zeroFillVolumes,StorageProperties.timeoutInMillis));
    }
 catch (    Exception e1) {
      try {
        conf=Transactions.find(new DirectStorageInfo());
      }
 catch (      Exception e2) {
        LOG.warn("String_Node_Str");
      }
    }
  }
  if (conf == null) {
    conf=new DirectStorageInfo(StorageProperties.NAME,StorageProperties.iface,StorageProperties.storageRootDirectory,StorageProperties.zeroFillVolumes,StorageProperties.timeoutInMillis);
  }
  return conf;
}
Program: 14157
Project: 14157
Buggy source:
static String getServerUserData(String ntpServer,String logServer,String logServerPort){
  Map<String,String> kvMap=new HashMap<String,String>();
  if (ntpServer != null)   kvMap.put("String_Node_Str",ntpServer);
  if (logServer != null)   kvMap.put("String_Node_Str",logServer);
  if (logServerPort != null)   kvMap.put("String_Node_Str",logServerPort);
  kvMap.put("String_Node_Str",String.format("String_Node_Str",DNSProperties.DOMAIN));
  kvMap.put("String_Node_Str",String.format("String_Node_Str",DNSProperties.DOMAIN));
  final StringBuilder sb=new StringBuilder();
  for (  String key : kvMap.keySet()) {
    String value=kvMap.get(key);
    sb.append(String.format("String_Node_Str",key,value));
  }
  return sb.toString();
}

Fixed version (ground truth):
static String getServerUserData(final String volumeId,final String ntpServer,final String logServer,final String logServerPort){
  Map<String,String> kvMap=new HashMap<String,String>();
  if (volumeId != null)   kvMap.put("String_Node_Str",volumeId);
  if (ntpServer != null)   kvMap.put("String_Node_Str",ntpServer);
  if (logServer != null)   kvMap.put("String_Node_Str",logServer);
  if (logServerPort != null)   kvMap.put("String_Node_Str",logServerPort);
  kvMap.put("String_Node_Str",String.format("String_Node_Str",DNSProperties.DOMAIN));
  kvMap.put("String_Node_Str",String.format("String_Node_Str",DNSProperties.DOMAIN));
  final StringBuilder sb=new StringBuilder();
  for (  String key : kvMap.keySet()) {
    String value=kvMap.get(key);
    sb.append(String.format("String_Node_Str",key,value));
  }
  return sb.toString();
}
Program: 14158
Project: 14158
Buggy source:
@Override public void fireChange(ConfigurableProperty t,String newValue) throws ConfigurablePropertyException {
  try {
    if (newValue instanceof String) {
      if (((String)newValue).contains("String_Node_Str")) {
        final String[] addresses=((String)newValue).split("String_Node_Str");
        if ((addresses.length - 1) != StringUtils.countOccurrencesOf((String)newValue,"String_Node_Str"))         throw new EucalyptusCloudException("String_Node_Str");
        for (        final String address : addresses) {
          if (!HostSpecifier.isValid(String.format("String_Node_Str",address)))           throw new EucalyptusCloudException("String_Node_Str");
        }
      }
 else {
        final String address=(String)newValue;
        if (address != null && !address.equals("String_Node_Str")) {
          if (!HostSpecifier.isValid(String.format("String_Node_Str",address)))           throw new EucalyptusCloudException("String_Node_Str");
        }
      }
    }
 else     throw new EucalyptusCloudException("String_Node_Str");
    onPropertyChange(null,null,null,(String)newValue,null,null);
  }
 catch (  final Exception e) {
    throw new ConfigurablePropertyException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void fireChange(ConfigurableProperty t,String newValue) throws ConfigurablePropertyException {
  try {
    if (newValue instanceof String) {
      if (((String)newValue).contains("String_Node_Str")) {
        final String[] addresses=((String)newValue).split("String_Node_Str");
        if ((addresses.length - 1) != StringUtils.countOccurrencesOf((String)newValue,"String_Node_Str"))         throw new EucalyptusCloudException("String_Node_Str");
        for (        final String address : addresses) {
          if (!HostSpecifier.isValid(String.format("String_Node_Str",address)))           throw new EucalyptusCloudException("String_Node_Str");
        }
      }
 else {
        final String address=(String)newValue;
        if (address != null && !address.equals("String_Node_Str")) {
          if (!HostSpecifier.isValid(String.format("String_Node_Str",address)))           throw new EucalyptusCloudException("String_Node_Str");
        }
      }
    }
 else     throw new EucalyptusCloudException("String_Node_Str");
    onPropertyChange(null,null,null,null,(String)newValue,null,null);
  }
 catch (  final Exception e) {
    throw new ConfigurablePropertyException("String_Node_Str",e);
  }
}
Program: 14159
Project: 14159
Buggy source:
private boolean pingDatabase(final String jdbcUrl,final String userName,final String password){
  try (final Connection conn=DriverManager.getConnection(jdbcUrl,userName,password)){
    try (final PreparedStatement statement=conn.prepareStatement("String_Node_Str")){
      try (final ResultSet result=statement.executeQuery()){
        return true;
      }
     }
   }
 catch (  final Exception ex) {
    return false;
  }
}

Fixed version (ground truth):
public static boolean pingDatabase(final String jdbcUrl,final String userName,final String password){
  try (final Connection conn=DriverManager.getConnection(jdbcUrl,userName,password)){
    try (final PreparedStatement statement=conn.prepareStatement("String_Node_Str")){
      try (final ResultSet result=statement.executeQuery()){
        return true;
      }
     }
   }
 catch (  final Exception ex) {
    return false;
  }
}
Program: 14160
Project: 14160
Buggy source:
static String getServerUserData(String ntpServer,String logServer,String logServerPort){
  Map<String,String> kvMap=new HashMap<String,String>();
  if (ntpServer != null)   kvMap.put("String_Node_Str",ntpServer);
  if (logServer != null)   kvMap.put("String_Node_Str",logServer);
  if (logServerPort != null)   kvMap.put("String_Node_Str",logServerPort);
  kvMap.put("String_Node_Str",String.format("String_Node_Str",DNSProperties.DOMAIN));
  final StringBuilder sb=new StringBuilder();
  for (  String key : kvMap.keySet()) {
    String value=kvMap.get(key);
    sb.append(String.format("String_Node_Str",key,value));
  }
  return sb.toString();
}

Fixed version (ground truth):
static String getServerUserData(String ntpServer,String logServer,String logServerPort){
  Map<String,String> kvMap=new HashMap<String,String>();
  if (ntpServer != null)   kvMap.put("String_Node_Str",ntpServer);
  if (logServer != null)   kvMap.put("String_Node_Str",logServer);
  if (logServerPort != null)   kvMap.put("String_Node_Str",logServerPort);
  kvMap.put("String_Node_Str",String.format("String_Node_Str",DNSProperties.DOMAIN));
  kvMap.put("String_Node_Str",String.format("String_Node_Str",DNSProperties.DOMAIN));
  final StringBuilder sb=new StringBuilder();
  for (  String key : kvMap.keySet()) {
    String value=kvMap.get(key);
    sb.append(String.format("String_Node_Str",key,value));
  }
  return sb.toString();
}
Program: 14161
Project: 14161
Buggy source:
public void setAppendOnlySsl(final Boolean ssl){
  this.appendOnlySsl=ssl;
  resetDatabase();
}

Fixed version (ground truth):
public void setAppendOnlySsl(final Boolean ssl){
  this.appendOnlySsl=ssl;
}
Program: 14162
Project: 14162
Buggy source:
public void setAppendOnlyPort(final String port){
  this.appendOnlyPort=port;
  resetDatabase();
}

Fixed version (ground truth):
public void setAppendOnlyPort(final String port){
  this.appendOnlyPort=port;
}
Program: 14163
Project: 14163
Buggy source:
public void setAppendOnlyPassword(final String password){
  try {
    final X509Certificate cloudCert=SystemCredentials.lookup(Eucalyptus.class).getCertificate();
    final Cipher cipher=Ciphers.RSA_PKCS1.get();
    cipher.init(Cipher.ENCRYPT_MODE,cloudCert.getPublicKey(),Crypto.getSecureRandomSupplier().get());
    byte[] bencPassword=cipher.doFinal(password.getBytes());
    final String encryptedPassword=new String(Base64.encode(bencPassword));
    this.appendOnlyPassword=encryptedPassword;
  }
 catch (  final Exception ex) {
    LOG.error("String_Node_Str");
  }
  resetDatabase();
}

Fixed version (ground truth):
public void setAppendOnlyPassword(final String password){
  try {
    final X509Certificate cloudCert=SystemCredentials.lookup(Eucalyptus.class).getCertificate();
    final Cipher cipher=Ciphers.RSA_PKCS1.get();
    cipher.init(Cipher.ENCRYPT_MODE,cloudCert.getPublicKey(),Crypto.getSecureRandomSupplier().get());
    byte[] bencPassword=cipher.doFinal(password.getBytes());
    final String encryptedPassword=new String(Base64.encode(bencPassword));
    this.appendOnlyPassword=encryptedPassword;
  }
 catch (  final Exception ex) {
    LOG.error("String_Node_Str");
  }
}
Program: 14164
Project: 14164
Buggy source:
public void setAppendOnlyUser(final String user){
  this.appendOnlyUser=user;
  resetDatabase();
}

Fixed version (ground truth):
public void setAppendOnlyUser(final String user){
  this.appendOnlyUser=user;
}
Program: 14166
Project: 14166
Buggy source:
/** 
 * @see org.jboss.netty.channel.ChannelEvent()
 */
@Override public void connectRequested(final ChannelHandlerContext ctx,ChannelStateEvent e) throws Exception {
  try {
    final InetSocketAddress remoteAddress=((InetSocketAddress)e.getValue());
    final Semaphore sem=counters.getUnchecked(remoteAddress.getAddress());
    final int semAvailable=sem.availablePermits();
    final int semQueued=sem.getQueueLength();
    final long start=System.nanoTime();
    sem.acquire();
    final long waitTime=System.nanoTime();
    e.getChannel().getCloseFuture().addListener(new ChannelFutureListener(){
      @Override public void operationComplete(      ChannelFuture future) throws Exception {
        try {
          final long end=System.nanoTime();
          LOG.trace(Joiner.on("String_Node_Str").join(uuid,remoteAddress,String.format("String_Node_Str",semAvailable,CLUSTER_CLIENT_PERMITS,semQueued),String.format("String_Node_Str",TimeUnit.NANOSECONDS.toMillis(waitTime - start),TimeUnit.NANOSECONDS.toMillis(end - waitTime),TimeUnit.NANOSECONDS.toMillis(end - start))));
        }
 catch (        Exception e1) {
          LOG.trace(e1);
        }
 finally {
          sem.release();
        }
      }
    }
);
  }
 catch (  Exception e1) {
    LOG.trace(e1);
  }
  super.connectRequested(ctx,e);
}

Fixed version (ground truth):
/** 
 * @see org.jboss.netty.channel.ChannelEvent()
 */
@Override public void connectRequested(final ChannelHandlerContext ctx,ChannelStateEvent e) throws Exception {
  try {
    final InetSocketAddress remoteAddress=((InetSocketAddress)e.getValue());
    final Semaphore sem=counters.getUnchecked(remoteAddress.getAddress());
    final int semAvailable=sem.availablePermits();
    final int semQueued=sem.getQueueLength();
    final long start=System.nanoTime();
    sem.acquire();
    final long waitTime=System.nanoTime();
    e.getChannel().getCloseFuture().addListener(new ChannelFutureListener(){
      @Override public void operationComplete(      ChannelFuture future) throws Exception {
        try {
          final long end=System.nanoTime();
          LOG.trace(Joiner.on("String_Node_Str").join(uuid,remoteAddress,String.format("String_Node_Str",semAvailable,CLUSTER_CLIENT_PERMITS.get(),semQueued),String.format("String_Node_Str",TimeUnit.NANOSECONDS.toMillis(waitTime - start),TimeUnit.NANOSECONDS.toMillis(end - waitTime),TimeUnit.NANOSECONDS.toMillis(end - start))));
        }
 catch (        Exception e1) {
          LOG.trace(e1);
        }
 finally {
          sem.release();
        }
      }
    }
);
  }
 catch (  Exception e1) {
    LOG.trace(e1);
  }
  super.connectRequested(ctx,e);
}
Program: 14167
Project: 14167
Buggy source:
@Override public void operationComplete(ChannelFuture future) throws Exception {
  try {
    final long end=System.nanoTime();
    LOG.trace(Joiner.on("String_Node_Str").join(uuid,remoteAddress,String.format("String_Node_Str",semAvailable,CLUSTER_CLIENT_PERMITS,semQueued),String.format("String_Node_Str",TimeUnit.NANOSECONDS.toMillis(waitTime - start),TimeUnit.NANOSECONDS.toMillis(end - waitTime),TimeUnit.NANOSECONDS.toMillis(end - start))));
  }
 catch (  Exception e1) {
    LOG.trace(e1);
  }
 finally {
    sem.release();
  }
}

Fixed version (ground truth):
@Override public void operationComplete(ChannelFuture future) throws Exception {
  try {
    final long end=System.nanoTime();
    LOG.trace(Joiner.on("String_Node_Str").join(uuid,remoteAddress,String.format("String_Node_Str",semAvailable,CLUSTER_CLIENT_PERMITS.get(),semQueued),String.format("String_Node_Str",TimeUnit.NANOSECONDS.toMillis(waitTime - start),TimeUnit.NANOSECONDS.toMillis(end - waitTime),TimeUnit.NANOSECONDS.toMillis(end - start))));
  }
 catch (  Exception e1) {
    LOG.trace(e1);
  }
 finally {
    sem.release();
  }
}
Program: 14168
Project: 14168
Buggy source:
@Override public SetBucketVersioningStatusResponseType setBucketVersioningStatus(final SetBucketVersioningStatusType request) throws S3Exception {
  Bucket bucket=getBucketAndCheckAuthorization(request);
  ObjectStorageProperties.VersioningStatus versionStatus=ObjectStorageProperties.VersioningStatus.valueOf(request.getVersioningStatus());
  try {
    BucketMetadataManagers.getInstance().setVersioning(bucket,versionStatus);
  }
 catch (  IllegalResourceStateException e) {
    throw new IllegalVersioningConfigurationException(request.getVersioningStatus());
  }
catch (  MetadataOperationFailureException e) {
    throw new InternalErrorException(e);
  }
catch (  NoSuchEntityException e) {
    throw new NoSuchBucketException(request.getBucket());
  }
  SetBucketVersioningStatusResponseType reply=request.getReply();
  return reply;
}

Fixed version (ground truth):
@Override public SetBucketVersioningStatusResponseType setBucketVersioningStatus(final SetBucketVersioningStatusType request) throws S3Exception {
  Bucket bucket=getBucketAndCheckAuthorization(request);
  try {
    ObjectStorageProperties.VersioningStatus versionStatus=ObjectStorageProperties.VersioningStatus.valueOf(request.getVersioningStatus());
    BucketMetadataManagers.getInstance().setVersioning(bucket,versionStatus);
  }
 catch (  IllegalArgumentException|IllegalResourceStateException e) {
    throw new IllegalVersioningConfigurationException(request.getVersioningStatus());
  }
catch (  MetadataOperationFailureException e) {
    throw new InternalErrorException(e);
  }
catch (  NoSuchEntityException e) {
    throw new NoSuchBucketException(request.getBucket());
  }
  SetBucketVersioningStatusResponseType reply=request.getReply();
  return reply;
}
Program: 14170
Project: 14170
Buggy source:
public boolean apply(Bucket bucket){
  DeleteBucketResponseType response;
  DeleteBucketType deleteRequest=new DeleteBucketType();
  deleteRequest.setBucket(bucket.getBucketUuid());
  try {
    backendProvider.deleteBucket(deleteRequest);
  }
 catch (  NoSuchEntityException|NoSuchBucketException e) {
  }
catch (  S3Exception e) {
    if (!HttpResponseStatus.NOT_FOUND.equals(e.getStatus())) {
      LOG.warn("String_Node_Str",e);
      return false;
    }
  }
  try {
    BucketMetadataManagers.getInstance().deleteBucketMetadata(bucket);
    return true;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str" + bucket.getBucketUuid() + "String_Node_Str");
  }
  return false;
}

Fixed version (ground truth):
public boolean apply(Bucket bucket){
  DeleteBucketResponseType response;
  DeleteBucketType deleteRequest=new DeleteBucketType();
  deleteRequest.setBucket(bucket.getBucketUuid());
  try {
    backendProvider.deleteBucket(deleteRequest);
  }
 catch (  NoSuchEntityException|NoSuchBucketException e) {
  }
catch (  S3Exception e) {
    if (!HttpResponseStatus.NOT_FOUND.equals(e.getStatus())) {
      LOG.warn("String_Node_Str",e);
      return false;
    }
  }
  try {
    BucketMetadataManagers.getInstance().deleteBucketMetadata(bucket);
    return true;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str" + bucket.getBucketUuid() + "String_Node_Str",e);
  }
  return false;
}
Program: 14173
Project: 14173
Buggy source:
/** 
 * Returns valid URI with port, will assign 80 if not specified explicitly and will add a 'http' scheme if none found.
 * @param raw
 * @return
 */
protected URI convertToFullURI(@Nonnull String raw){
  URI tmp=URI.create(raw);
  if (!"String_Node_Str".equals(tmp.getScheme()) && !"String_Node_Str".equals(tmp.getScheme())) {
    raw="String_Node_Str" + raw;
    tmp=URI.create(raw);
  }
  if (tmp.getPort() != -1) {
    return tmp;
  }
 else {
    return URI.create(raw + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Returns valid URI with port, will assign 80 if not specified explicitly and will add a 'http' scheme if none found.
 * @param raw
 * @return
 */
protected URI convertToFullURI(@Nonnull String raw){
  URI tmp;
  if (!raw.startsWith("String_Node_Str") && !raw.startsWith("String_Node_Str")) {
    raw="String_Node_Str" + raw;
  }
  tmp=URI.create(raw);
  if (tmp.getPort() != -1) {
    return tmp;
  }
 else {
    return URI.create(raw + "String_Node_Str");
  }
}
Program: 14176
Project: 14176
Buggy source:
JsonNode evaluateFunction(ValidateResult validateResult,StackEntity stackEntity,Map<String,ResourceInfo> resourceInfoMap,FunctionEvaluation.TemplateSection templateSection) throws CloudFormationException ;

Fixed version (ground truth):
JsonNode evaluateFunction(ValidateResult validateResult,StackEntity stackEntity,Map<String,ResourceInfo> resourceInfoMap) throws CloudFormationException ;
Program: 14177
Project: 14177
Buggy source:
private Date newestDate(Date... dates){
  Date latestDate=null;
  for (  Date date : dates) {
    if (date == null)     continue;
    if (date != null && latestDate == null) {
      latestDate=null;
      continue;
    }
    if (date.after(latestDate)) {
      latestDate=date;
    }
  }
  return latestDate;
}

Fixed version (ground truth):
private Date newestDate(Date... dates){
  Date latestDate=null;
  for (  Date date : dates) {
    if (date == null)     continue;
    if (date != null && latestDate == null) {
      latestDate=date;
      continue;
    }
    if (date.after(latestDate)) {
      latestDate=date;
    }
  }
  return latestDate;
}
Program: 14179
Project: 14179
Buggy source:
public DescribeKeyPairsResponseType describe(DescribeKeyPairsType request) throws Exception {
  final DescribeKeyPairsResponseType reply=request.getReply();
  final Context ctx=Contexts.lookup();
  final boolean showAll=request.getKeySet().remove("String_Node_Str");
  final OwnerFullName ownerFullName=ctx.isAdministrator() && showAll ? null : Contexts.lookup().getUserFullName().asAccountFullName();
  final Filter filter=Filters.generate(request.getFilterSet(),SshKeyPair.class);
  final Predicate<? super SshKeyPair> requestedAndAccessible=CloudMetadatas.filteringFor(SshKeyPair.class).byId(request.getKeySet()).byPredicate(filter.asPredicate()).byPrivileges().buildPredicate();
  for (  final SshKeyPair kp : KeyPairs.list(ownerFullName,requestedAndAccessible,filter.asCriterion(),filter.getAliases())) {
    reply.getKeySet().add(new DescribeKeyPairsResponseItemType(kp.getDisplayName(),kp.getFingerPrint()));
  }
  return reply;
}

Fixed version (ground truth):
public DescribeKeyPairsResponseType describe(DescribeKeyPairsType request) throws Exception {
  final DescribeKeyPairsResponseType reply=request.getReply();
  final Context ctx=Contexts.lookup();
  final boolean showAll=request.getKeySet().remove("String_Node_Str");
  final OwnerFullName ownerFullName=ctx.isAdministrator() && showAll ? null : Contexts.lookup().getUserFullName().asAccountFullName();
  final Filter filter=Filters.generate(request.getFilterSet(),SshKeyPair.class);
  final Predicate<? super SshKeyPair> requestedAndAccessible=CloudMetadatas.filteringFor(SshKeyPair.class).byId(request.getKeySet()).byPredicate(filter.asPredicate()).byPrivileges().buildPredicate();
  final List<String> foundKeyNameList=new ArrayList<String>();
  for (  final SshKeyPair kp : KeyPairs.list(ownerFullName,requestedAndAccessible,filter.asCriterion(),filter.getAliases())) {
    reply.getKeySet().add(new DescribeKeyPairsResponseItemType(kp.getDisplayName(),kp.getFingerPrint()));
    foundKeyNameList.add(kp.getDisplayName());
  }
  if (!request.getKeySet().isEmpty() && request.getKeySet().size() != reply.getKeySet().size()) {
    List<String> reverseRequestedKeySet=ImmutableList.copyOf(request.getKeySet()).reverse();
    for (    String requestedKey : reverseRequestedKeySet) {
      if (!foundKeyNameList.contains(requestedKey)) {
        throw new ClientComputeException("String_Node_Str","String_Node_Str" + requestedKey + "String_Node_Str");
      }
    }
  }
  return reply;
}
Program: 14180
Project: 14180
Buggy source:
@Override public void logicallyDeleteVersion(@Nonnull ObjectStorageProviderClient provider,@Nonnull ObjectEntity entity,@Nonnull User requestUser) throws S3Exception {
  if (entity.getBucket() == null) {
    throw new InternalErrorException();
  }
  if (!entity.getIsDeleteMarker()) {
    ObjectEntity deletingObject=ObjectMetadataManagers.getInstance().transitionObjectToState(entity,ObjectState.deleting);
    try {
      actuallyDeleteObject(provider,deletingObject,requestUser);
    }
 catch (    Exception e) {
      LOG.trace("String_Node_Str",e);
    }
  }
 else {
    ObjectMetadataManagers.getInstance().delete(entity);
  }
}

Fixed version (ground truth):
@Override public void logicallyDeleteVersion(@Nonnull ObjectStorageProviderClient provider,@Nonnull ObjectEntity entity,@Nonnull User requestUser) throws S3Exception {
  if (entity.getBucket() == null) {
    throw new InternalErrorException();
  }
  try {
    List<ObjectEntity> entities=ObjectMetadataManagers.getInstance().lookupObjectVersions(entity.getBucket(),entity.getObjectKey(),Integer.MAX_VALUE);
    if (entities != null && entities.size() > 0) {
      for (      ObjectEntity latest : entities) {
        if (latest.getObjectUuid().equals(entity.getObjectUuid())) {
          continue;
        }
        if (!latest.getIsLatest().booleanValue()) {
          ObjectMetadataManagers.getInstance().makeLatest(latest);
        }
        break;
      }
    }
  }
 catch (  Exception ex) {
    LOG.warn("String_Node_Str",ex);
  }
  if (!entity.getIsDeleteMarker()) {
    ObjectEntity deletingObject=ObjectMetadataManagers.getInstance().transitionObjectToState(entity,ObjectState.deleting);
    try {
      actuallyDeleteObject(provider,deletingObject,requestUser);
    }
 catch (    Exception e) {
      LOG.trace("String_Node_Str",e);
    }
  }
 else {
    ObjectMetadataManagers.getInstance().delete(entity);
  }
}
Program: 14182
Project: 14182
Buggy source:
@Override public ObjectEntity generateAndPersistDeleteMarker(@Nonnull ObjectEntity currentObject,@Nonnull AccessControlPolicy acp,@Nonnull User owningUser) throws MetadataOperationFailureException {
  final ObjectEntity deleteMarker=currentObject.generateNewDeleteMarkerFrom();
  try (TransactionResource trans=Entities.transactionFor(ObjectEntity.class)){
    deleteMarker.setAcl(acp);
    deleteMarker.setOwnerCanonicalId(owningUser.getAccount().getCanonicalId());
    deleteMarker.setOwnerDisplayName(owningUser.getAccount().getName());
    deleteMarker.setOwnerIamUserDisplayName(owningUser.getName());
    deleteMarker.setOwnerIamUserId(owningUser.getUserId());
    ObjectEntity persistedDeleteMarker=Entities.persist(deleteMarker);
    trans.commit();
    return persistedDeleteMarker;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str" + deleteMarker.getObjectUuid());
    throw new MetadataOperationFailureException(e);
  }
}

Fixed version (ground truth):
@Override public ObjectEntity generateAndPersistDeleteMarker(@Nonnull ObjectEntity currentObject,@Nonnull AccessControlPolicy acp,@Nonnull User owningUser) throws MetadataOperationFailureException {
  final ObjectEntity deleteMarker=currentObject.generateNewDeleteMarkerFrom();
  try (TransactionResource trans=Entities.transactionFor(ObjectEntity.class)){
    deleteMarker.setAcl(acp);
    deleteMarker.setOwnerCanonicalId(owningUser.getAccount().getCanonicalId());
    deleteMarker.setOwnerDisplayName(owningUser.getAccount().getName());
    deleteMarker.setOwnerIamUserDisplayName(owningUser.getName());
    deleteMarker.setOwnerIamUserId(owningUser.getUserId());
    ObjectEntity persistedDeleteMarker=Entities.persist(deleteMarker);
    currentObject.setIsLatest(Boolean.FALSE);
    Entities.mergeDirect(currentObject);
    trans.commit();
    return persistedDeleteMarker;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str" + deleteMarker.getObjectUuid());
    throw new MetadataOperationFailureException(e);
  }
}
Program: 14184
Project: 14184
Buggy source:
@Override public ObjectEntity transitionObjectToState(@Nonnull final ObjectEntity entity,@Nonnull ObjectState destState) throws IllegalResourceStateException, MetadataOperationFailureException {
  Function<ObjectEntity,ObjectEntity> transitionFunction;
switch (destState) {
case creating:
    transitionFunction=ObjectStateTransitions.TRANSITION_TO_CREATING;
  break;
case extant:
transitionFunction=ObjectStateTransitions.TRANSITION_TO_EXTANT;
break;
case mpu_pending:
transitionFunction=ObjectStateTransitions.TRANSITION_TO_MPU_PENDING;
break;
case deleting:
transitionFunction=ObjectStateTransitions.TRANSITION_TO_DELETING;
break;
default :
LOG.error("String_Node_Str" + destState);
throw new IllegalArgumentException();
}
try {
return Entities.asTransaction(ObjectEntity.class,transitionFunction).apply(entity);
}
 catch (ObjectStorageInternalException e) {
throw e;
}
catch (Exception e) {
throw new MetadataOperationFailureException(e);
}
}

Fixed version (ground truth):
@Override public ObjectEntity transitionObjectToState(@Nonnull final ObjectEntity entity,@Nonnull ObjectState destState) throws IllegalResourceStateException, MetadataOperationFailureException {
  Function<ObjectEntity,ObjectEntity> transitionFunction;
switch (destState) {
case creating:
    transitionFunction=ObjectStateTransitions.TRANSITION_TO_CREATING;
  break;
case extant:
transitionFunction=ObjectStateTransitions.TRANSITION_TO_EXTANT;
break;
case mpu_pending:
transitionFunction=ObjectStateTransitions.TRANSITION_TO_MPU_PENDING;
break;
case deleting:
transitionFunction=ObjectStateTransitions.TRANSITION_TO_DELETING;
break;
default :
LOG.error("String_Node_Str" + destState);
throw new IllegalArgumentException();
}
try {
ObjectEntity result=Entities.asTransaction(ObjectEntity.class,transitionFunction).apply(entity);
return result;
}
 catch (ObjectStorageInternalException e) {
throw e;
}
catch (Exception e) {
throw new MetadataOperationFailureException(e);
}
}
Program: 14185
Project: 14185
Buggy source:
public static SetResponse findRecords(final Message response,final Record queryRecord,final InetAddress source){
  final Name name=queryRecord.getName();
  final int type=queryRecord.getType();
  try {
    if (!enabled || !Bootstrap.isOperational()) {
      return SetResponse.ofType(SetResponse.UNKNOWN);
    }
 else {
      final Iterable<DnsResolver> resolverList=DnsResolvers.resolversFor(queryRecord,source);
      LOG.debug("String_Node_Str" + name + "String_Node_Str"+ resolverList);
      if (Iterables.isEmpty(resolverList)) {
        return SetResponse.ofType(SetResponse.UNKNOWN);
      }
 else {
        return DnsResolvers.lookupRecords(response,queryRecord,source);
      }
    }
  }
 catch (  final Exception ex) {
    LOG.error(ex);
    LOG.trace(ex,ex);
  }
  return SetResponse.ofType(SetResponse.UNKNOWN);
}

Fixed version (ground truth):
public static SetResponse findRecords(final Message response,final Record queryRecord,final InetAddress source){
  final Name name=queryRecord.getName();
  final int type=queryRecord.getType();
  try {
    if (!enabled || !Bootstrap.isOperational()) {
      return SetResponse.ofType(SetResponse.UNKNOWN);
    }
 else {
      final Iterable<DnsResolver> resolverList=DnsResolvers.resolversFor(queryRecord,source);
      if (Iterables.isEmpty(resolverList)) {
        return SetResponse.ofType(SetResponse.UNKNOWN);
      }
 else {
        return DnsResolvers.lookupRecords(response,queryRecord,source);
      }
    }
  }
 catch (  final Exception ex) {
    LOG.error(ex);
    LOG.trace(ex,ex);
  }
  return SetResponse.ofType(SetResponse.UNKNOWN);
}
Program: 14186
Project: 14186
Buggy source:
@Override void dispatchFailure(final ActivityContext context,final Throwable throwable){
  super.dispatchFailure(context,throwable);
  handleValidationFailure(throwable);
}

Fixed version (ground truth):
@Override boolean dispatchFailure(final ActivityContext context,final Throwable throwable){
  final boolean result=super.dispatchFailure(context,throwable);
  handleValidationFailure(throwable);
  return result;
}
Program: 14187
Project: 14187
Buggy source:
private ScalingProcessTask<?,?> perhapsReplaceInstances(final AutoScalingGroupScalingView group){
  final List<String> instancesToTerminate=Lists.newArrayList();
  if (scalingProcessEnabled(ScalingProcessType.ReplaceUnhealthy,group))   try {
    final List<AutoScalingInstanceCoreView> currentInstances=autoScalingInstances.listUnhealthyByGroup(group,TypeMappers.lookup(AutoScalingInstance.class,AutoScalingInstanceCoreView.class));
    Iterables.addAll(instancesToTerminate,Iterables.limit(Iterables.transform(currentInstances,RestrictedTypes.toDisplayName()),Math.min(AutoScalingConfiguration.getMaxLaunchIncrement(),currentInstances.size())));
    if (!instancesToTerminate.isEmpty()) {
      logger.info("String_Node_Str" + instancesToTerminate);
    }
  }
 catch (  final Exception e) {
    logger.error(e,e);
  }
  return removeFromLoadBalancerOrTerminate(group,group.getCapacity(),instancesToTerminate,Collections.singletonList(new ActivityCause("String_Node_Str")),true);
}

Fixed version (ground truth):
private ScalingProcessTask<?,?> perhapsReplaceInstances(final AutoScalingGroupScalingView group){
  final List<String> instancesToTerminate=Lists.newArrayList();
  boolean anyRegisteredInstances=false;
  if (scalingProcessEnabled(ScalingProcessType.ReplaceUnhealthy,group))   try {
    final List<AutoScalingInstanceCoreView> currentInstances=autoScalingInstances.listUnhealthyByGroup(group,TypeMappers.lookup(AutoScalingInstance.class,AutoScalingInstanceCoreView.class));
    Iterables.addAll(instancesToTerminate,Iterables.limit(Iterables.transform(currentInstances,RestrictedTypes.toDisplayName()),Math.min(AutoScalingConfiguration.getMaxLaunchIncrement(),currentInstances.size())));
    anyRegisteredInstances=Iterables.any(currentInstances,ConfigurationState.Registered.forView());
    if (!instancesToTerminate.isEmpty()) {
      logger.info("String_Node_Str" + instancesToTerminate);
    }
  }
 catch (  final Exception e) {
    logger.error(e,e);
  }
  return removeFromLoadBalancerOrTerminate(group,group.getCapacity(),anyRegisteredInstances,instancesToTerminate,Collections.singletonList(new ActivityCause("String_Node_Str")),true);
}
Program: 14188
Project: 14188
Buggy source:
private ScalingProcessTask<?,?> removeFromLoadBalancerOrTerminate(final AutoScalingGroupScalingView group,final int currentCapacity,final List<String> registeredInstances,final List<ActivityCause> causes,final boolean replace){
  final ScalingProcessTask<?,?> task;
  if (group.getLoadBalancerNames().isEmpty()) {
    transitionToDeregistered(group,registeredInstances);
    task=new TerminateInstancesScalingProcessTask(group,currentCapacity,registeredInstances,causes,replace,true,true);
  }
 else {
    task=new RemoveFromLoadBalancerScalingProcessTask(group,currentCapacity,registeredInstances,causes,replace);
  }
  return task;
}

Fixed version (ground truth):
private ScalingProcessTask<?,?> removeFromLoadBalancerOrTerminate(final AutoScalingGroupScalingView group,final int currentCapacity,final boolean anyRegisteredInstances,final List<String> registeredInstances,final List<ActivityCause> causes,final boolean replace){
  final ScalingProcessTask<?,?> task;
  if (group.getLoadBalancerNames().isEmpty() || !anyRegisteredInstances) {
    transitionToDeregistered(group,registeredInstances);
    task=new TerminateInstancesScalingProcessTask(group,currentCapacity,registeredInstances,causes,replace,true,true);
  }
 else {
    task=new RemoveFromLoadBalancerScalingProcessTask(group,currentCapacity,registeredInstances,causes,replace);
  }
  return task;
}
Program: 14190
Project: 14190
Buggy source:
final CheckedListenableFuture<Boolean> dispatch(final ActivityContext context){
  try {
    activity=persist ? scalingActivities.save(activity) : activity;
    final CheckedListenableFuture<Boolean> future=Futures.newGenericeFuture();
    dispatchInternal(context,new Callback.Checked<RES>(){
      @Override public void fireException(      final Throwable throwable){
        try {
          dispatchFailure(context,throwable);
        }
  finally {
          future.set(false);
        }
      }
      @Override public void fire(      final RES response){
        try {
          dispatchSuccess(context,response);
        }
  finally {
          future.set(true);
        }
      }
    }
);
    return future;
  }
 catch (  Throwable e) {
    dispatchFailure(context,e);
    logger.error(e,e);
  }
  return Futures.predestinedFuture(false);
}

Fixed version (ground truth):
final CheckedListenableFuture<Boolean> dispatch(final ActivityContext context){
  try {
    activity=persist ? scalingActivities.save(activity) : activity;
    final CheckedListenableFuture<Boolean> future=Futures.newGenericeFuture();
    dispatchInternal(context,new Callback.Checked<RES>(){
      @Override public void fireException(      final Throwable throwable){
        boolean result=false;
        try {
          result=dispatchFailure(context,throwable);
        }
  finally {
          future.set(result);
        }
      }
      @Override public void fire(      final RES response){
        try {
          dispatchSuccess(context,response);
        }
  finally {
          future.set(true);
        }
      }
    }
);
    return future;
  }
 catch (  Throwable e) {
    dispatchFailure(context,e);
    logger.error(e,e);
  }
  return Futures.predestinedFuture(false);
}
Program: 14197
Project: 14197
Buggy source:
@Override public void create(int stepNum) throws Exception {
  ServiceConfiguration configuration=Topology.lookup(Euare.class);
switch (stepNum) {
case 0:
    String groupName=getStackEntity().getStackName() + "String_Node_Str" + info.getLogicalResourceId()+ "String_Node_Str"+ Crypto.generateAlphanumericId(13,"String_Node_Str");
  CreateGroupType createGroupType=new CreateGroupType();
createGroupType.setEffectiveUserId(info.getEffectiveUserId());
createGroupType.setGroupName(groupName);
createGroupType.setPath(properties.getPath());
CreateGroupResponseType createGroupResponseType=AsyncRequests.<CreateGroupType,CreateGroupResponseType>sendSync(configuration,createGroupType);
String arn=createGroupResponseType.getCreateGroupResult().getGroup().getArn();
info.setPhysicalResourceId(groupName);
info.setArn(JsonHelper.getStringFromJsonNode(new TextNode(arn)));
info.setReferenceValueJson(JsonHelper.getStringFromJsonNode(new TextNode(info.getPhysicalResourceId())));
break;
case 1:
if (properties.getPolicies() != null) {
for (EmbeddedIAMPolicy policy : properties.getPolicies()) {
PutGroupPolicyType putGroupPolicyType=new PutGroupPolicyType();
putGroupPolicyType.setGroupName(info.getPhysicalResourceId());
putGroupPolicyType.setPolicyName(policy.getPolicyName());
putGroupPolicyType.setPolicyDocument(policy.getPolicyDocument().toString());
putGroupPolicyType.setEffectiveUserId(info.getEffectiveUserId());
AsyncRequests.<PutGroupPolicyType,PutGroupPolicyResponseType>sendSync(configuration,putGroupPolicyType);
}
}
break;
default :
throw new IllegalStateException("String_Node_Str" + stepNum);
}
}

Fixed version (ground truth):
@Override public void create(int stepNum) throws Exception {
  ServiceConfiguration configuration=Topology.lookup(Euare.class);
switch (stepNum) {
case 0:
    String groupName=getDefaultPhysicalResourceId();
  CreateGroupType createGroupType=new CreateGroupType();
createGroupType.setEffectiveUserId(info.getEffectiveUserId());
createGroupType.setGroupName(groupName);
createGroupType.setPath(properties.getPath());
CreateGroupResponseType createGroupResponseType=AsyncRequests.<CreateGroupType,CreateGroupResponseType>sendSync(configuration,createGroupType);
String arn=createGroupResponseType.getCreateGroupResult().getGroup().getArn();
info.setPhysicalResourceId(groupName);
info.setArn(JsonHelper.getStringFromJsonNode(new TextNode(arn)));
info.setReferenceValueJson(JsonHelper.getStringFromJsonNode(new TextNode(info.getPhysicalResourceId())));
break;
case 1:
if (properties.getPolicies() != null) {
for (EmbeddedIAMPolicy policy : properties.getPolicies()) {
PutGroupPolicyType putGroupPolicyType=new PutGroupPolicyType();
putGroupPolicyType.setGroupName(info.getPhysicalResourceId());
putGroupPolicyType.setPolicyName(policy.getPolicyName());
putGroupPolicyType.setPolicyDocument(policy.getPolicyDocument().toString());
putGroupPolicyType.setEffectiveUserId(info.getEffectiveUserId());
AsyncRequests.<PutGroupPolicyType,PutGroupPolicyResponseType>sendSync(configuration,putGroupPolicyType);
}
}
break;
default :
throw new IllegalStateException("String_Node_Str" + stepNum);
}
}
Program: 14199
Project: 14199
Buggy source:
@Override public void rollbackCreate() throws Exception {
}

Fixed version (ground truth):
@Override public void rollbackCreate() throws Exception {
  delete();
}
Program: 14200
Project: 14200
Buggy source:
@Override public void create(int stepNum) throws Exception {
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public void create(int stepNum) throws Exception {
  ServiceConfiguration configuration=Topology.lookup(Euare.class);
switch (stepNum) {
case 0:
    String instanceProfileName=getDefaultPhysicalResourceId();
  CreateInstanceProfileType createInstanceProfileType=new CreateInstanceProfileType();
createInstanceProfileType.setEffectiveUserId(info.getEffectiveUserId());
createInstanceProfileType.setPath(properties.getPath());
createInstanceProfileType.setInstanceProfileName(instanceProfileName);
CreateInstanceProfileResponseType createInstanceProfileResponseType=AsyncRequests.<CreateInstanceProfileType,CreateInstanceProfileResponseType>sendSync(configuration,createInstanceProfileType);
String arn=createInstanceProfileResponseType.getCreateInstanceProfileResult().getInstanceProfile().getArn();
info.setPhysicalResourceId(instanceProfileName);
info.setArn(JsonHelper.getStringFromJsonNode(new TextNode(arn)));
info.setReferenceValueJson(JsonHelper.getStringFromJsonNode(new TextNode(info.getPhysicalResourceId())));
break;
case 1:
if (properties.getRoles() != null) {
for (String roleName : properties.getRoles()) {
AddRoleToInstanceProfileType addRoleToInstanceProfileType=new AddRoleToInstanceProfileType();
addRoleToInstanceProfileType.setEffectiveUserId(info.getEffectiveUserId());
addRoleToInstanceProfileType.setInstanceProfileName(info.getPhysicalResourceId());
addRoleToInstanceProfileType.setRoleName(roleName);
AsyncRequests.<AddRoleToInstanceProfileType,AddRoleToInstanceProfileResponseType>sendSync(configuration,addRoleToInstanceProfileType);
}
}
break;
default :
throw new IllegalStateException("String_Node_Str" + stepNum);
}
}
Program: 14201
Project: 14201
Buggy source:
@Override public void delete() throws Exception {
}

Fixed version (ground truth):
@Override public void delete() throws Exception {
  if (info.getPhysicalResourceId() == null)   return;
  ServiceConfiguration configuration=Topology.lookup(Euare.class);
  boolean seenAllInstanceProfiles=false;
  boolean foundInstanceProfile=false;
  String instanceProfileMarker=null;
  while (!seenAllInstanceProfiles && !foundInstanceProfile) {
    ListInstanceProfilesType listInstanceProfilesType=new ListInstanceProfilesType();
    listInstanceProfilesType.setEffectiveUserId(info.getEffectiveUserId());
    if (instanceProfileMarker != null) {
      listInstanceProfilesType.setMarker(instanceProfileMarker);
    }
    ListInstanceProfilesResponseType listInstanceProfilesResponseType=AsyncRequests.<ListInstanceProfilesType,ListInstanceProfilesResponseType>sendSync(configuration,listInstanceProfilesType);
    if (listInstanceProfilesResponseType.getListInstanceProfilesResult().getIsTruncated() == Boolean.TRUE) {
      instanceProfileMarker=listInstanceProfilesResponseType.getListInstanceProfilesResult().getMarker();
    }
 else {
      seenAllInstanceProfiles=true;
    }
    if (listInstanceProfilesResponseType.getListInstanceProfilesResult().getInstanceProfiles() != null && listInstanceProfilesResponseType.getListInstanceProfilesResult().getInstanceProfiles().getMember() != null) {
      for (      InstanceProfileType instanceProfileType : listInstanceProfilesResponseType.getListInstanceProfilesResult().getInstanceProfiles().getMember()) {
        if (instanceProfileType.getInstanceProfileName().equals(info.getPhysicalResourceId())) {
          foundInstanceProfile=true;
          break;
        }
      }
    }
  }
  if (!foundInstanceProfile)   return;
  DeleteInstanceProfileType deleteInstanceProfileType=new DeleteInstanceProfileType();
  deleteInstanceProfileType.setInstanceProfileName(info.getPhysicalResourceId());
  deleteInstanceProfileType.setEffectiveUserId(info.getEffectiveUserId());
  AsyncRequests.<DeleteInstanceProfileType,DeleteInstanceProfileResponseType>sendSync(configuration,deleteInstanceProfileType);
}
Program: 14202
Project: 14202
Buggy source:
/** 
 * Methods for disk imaging tasks 
 */
public static List<DiskImagingTask> getDiskImagingTasks(final AccountFullName owningAccount,final List<String> taskIdList){
synchronized (lock) {
    final List<DiskImagingTask> result=Lists.newArrayList();
    try (final TransactionResource db=Entities.transactionFor(DiskImagingTask.class)){
      final DiskImagingTask sample=DiskImagingTask.named(owner);
      final List<DiskImagingTask> tasks=Entities.query(sample,true);
      if (taskIdList != null && taskIdList.size() > 0) {
        for (        final DiskImagingTask candidate : tasks) {
          if (taskIdList.contains(candidate.getDisplayName()))           result.add(candidate);
        }
      }
 else       result.addAll(tasks);
    }
     return result;
  }
}

Fixed version (ground truth):
/** 
 * Methods for disk imaging tasks 
 */
public static List<DiskImagingTask> getDiskImagingTasks(final AccountFullName owningAccount,final List<String> taskIdList){
synchronized (lock) {
    final List<DiskImagingTask> result=Lists.newArrayList();
    try (final TransactionResource db=Entities.transactionFor(DiskImagingTask.class)){
      final DiskImagingTask sample=DiskImagingTask.named(owningAccount);
      final List<DiskImagingTask> tasks=Entities.query(sample,true);
      if (taskIdList != null && taskIdList.size() > 0) {
        for (        final DiskImagingTask candidate : tasks) {
          if (taskIdList.contains(candidate.getDisplayName()))           result.add(candidate);
        }
      }
 else       result.addAll(tasks);
    }
     return result;
  }
}
Program: 14203
Project: 14203
Buggy source:
public Builder withRolePermissions(){
  final ImagingServiceActions.IamRoleAuthorization roleAuthz=new ImagingServiceActions.IamRoleAuthorization(lookupAction.this.launcherId);
  actions.add(roleAuthz);
  return this;
}

Fixed version (ground truth):
public Builder withRolePermissions(){
  final ImagingServiceActions.IamRoleAuthorization roleAuthz=new ImagingServiceActions.IamRoleAuthorization(this.lookupAction,this.launcherId);
  actions.add(roleAuthz);
  return this;
}
Program: 14207
Project: 14207
Buggy source:
public void disable() throws EucalyptusCloudException {
  if (!this.shouldDisable())   throw new EucalyptusCloudException("String_Node_Str");
  this.lockLauncher(launcherId);
  try {
    final String emi=ImagingServiceProperties.IMAGING_WORKER_EMI;
    final String instanceType=ImagingServiceProperties.IMAGING_WORKER_INSTANCE_TYPE;
    final String keyName=ImagingServiceProperties.IMAGING_WORKER_KEYNAME;
    final String ntpServers=ImagingServiceProperties.IMAGING_WORKER_NTP_SERVER;
    ImagingServiceLauncher launcher=null;
    try {
      ImagingServiceLauncher.Builder builder=new ImagingServiceLauncher.Builder(launcherId);
      launcher=builder.withSecurityGroup().withRole().withInstanceProfile().withServerCertificate().withVolumeOperations().withS3Operations().withUserData().withLaunchConfiguration(emi,instanceType,keyName).withAutoScalingGroup().withTag(DEFAULT_LAUNCHER_TAG).build();
    }
 catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str",ex);
    }
    try {
      launcher.destroy();
    }
 catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str",ex);
    }
  }
 catch (  final Exception ex) {
    this.releaseLauncher(launcherId);
    throw ex;
  }
}

Fixed version (ground truth):
public void disable() throws EucalyptusCloudException {
  if (!this.shouldDisable())   throw new EucalyptusCloudException("String_Node_Str");
  this.lockLauncher(launcherId);
  try {
    final String emi=ImagingServiceProperties.IMAGING_WORKER_EMI;
    final String instanceType=ImagingServiceProperties.IMAGING_WORKER_INSTANCE_TYPE;
    final String keyName=ImagingServiceProperties.IMAGING_WORKER_KEYNAME;
    final String ntpServers=ImagingServiceProperties.IMAGING_WORKER_NTP_SERVER;
    ImagingServiceLauncher launcher=null;
    try {
      ImagingServiceLauncher.Builder builder=new ImagingServiceLauncher.Builder(launcherId);
      launcher=builder.withSecurityGroup().withRole().withInstanceProfile().withServerCertificate(SERVER_CERTIFICATE_NAME).withVolumeOperations().withS3Operations().withUserData().withLaunchConfiguration(emi,instanceType,keyName).withAutoScalingGroup().withTag(DEFAULT_LAUNCHER_TAG).build();
    }
 catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str",ex);
    }
    try {
      launcher.destroy();
    }
 catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str",ex);
    }
  }
 catch (  final Exception ex) {
    this.releaseLauncher(launcherId);
    throw ex;
  }
}