Program: 14156
Project: 14156
Buggy source:
private static void onPropertyChange(final String emi,final String instanceType,final String keyname,final String ntpServers,String logServer,String logServerPort) throws EucalyptusCloudException {
  if (!(Bootstrap.isFinished() && Topology.isEnabled(Eucalyptus.class)))   return;
  if (emi != null) {
    try {
      final List<ImageDetails> images=Ec2Client.getInstance().describeImages(null,Lists.newArrayList(emi));
      if (images == null || images.size() <= 0)       throw new EucalyptusCloudException("String_Node_Str");
      if (!images.get(0).getImageId().toLowerCase().equals(emi.toLowerCase()))       throw new EucalyptusCloudException("String_Node_Str");
    }
 catch (    final EucalyptusCloudException ex) {
      throw ex;
    }
catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str");
    }
  }
  if (instanceType != null) {
    ;
  }
  if (keyname != null && !keyname.equals("String_Node_Str")) {
    try {
      final List<DescribeKeyPairsResponseItemType> keypairs=Ec2Client.getInstance().describeKeyPairs(null,Lists.newArrayList(keyname));
      if (keypairs == null || keypairs.size() <= 0)       throw new EucalyptusCloudException("String_Node_Str");
      if (!keypairs.get(0).getKeyName().equals(keyname))       throw new EucalyptusCloudException("String_Node_Str");
    }
 catch (    final EucalyptusCloudException ex) {
      throw ex;
    }
catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str");
    }
  }
  if (ntpServers != null) {
    ;
  }
  if ((emi != null && emi.length() > 0) || (instanceType != null && instanceType.length() > 0) || (keyname != null && keyname.length() > 0)|| (ntpServers != null && ntpServers.length() > 0)|| (logServer != null && logServer.length() > 0)|| (logServerPort != null && logServerPort.length() > 0)) {
    String asgName=null;
    LOG.warn("String_Node_Str");
    try {
      final List<TagDescription> tags=AutoScalingClient.getInstance().describeAutoScalingTags(null);
      for (      final TagDescription tag : tags) {
        if (DEFAULT_LAUNCHER_TAG.equals(tag.getValue())) {
          asgName=tag.getResourceId();
          break;
        }
      }
    }
 catch (    final Exception ex) {
      return;
    }
    if (asgName == null)     return;
    try {
      AutoScalingGroupType asgType=null;
      try {
        final DescribeAutoScalingGroupsResponseType resp=AutoScalingClient.getInstance().describeAutoScalingGroups(null,Lists.newArrayList(asgName));
        if (resp.getDescribeAutoScalingGroupsResult() != null && resp.getDescribeAutoScalingGroupsResult().getAutoScalingGroups() != null && resp.getDescribeAutoScalingGroupsResult().getAutoScalingGroups().getMember() != null && resp.getDescribeAutoScalingGroupsResult().getAutoScalingGroups().getMember().size() > 0) {
          asgType=resp.getDescribeAutoScalingGroupsResult().getAutoScalingGroups().getMember().get(0);
        }
      }
 catch (      final Exception ex) {
        LOG.warn("String_Node_Str" + asgName);
        return;
      }
      if (asgType != null) {
        final String lcName=asgType.getLaunchConfigurationName();
        final LaunchConfigurationType lc=AutoScalingClient.getInstance().describeLaunchConfiguration(null,lcName);
        String tmpLaunchConfigName=null;
        do {
          tmpLaunchConfigName=String.format("String_Node_Str",UUID.randomUUID().toString().substring(0,8));
        }
 while (tmpLaunchConfigName.equals(asgType.getLaunchConfigurationName()));
        final String newEmi=emi != null ? emi : lc.getImageId();
        final String newType=instanceType != null ? instanceType : lc.getInstanceType();
        String newKeyname=keyname != null ? keyname : lc.getKeyName();
        final String oldUserData=B64.standard.decString(lc.getUserData());
        final List<String> lines=Lists.newArrayList(oldUserData.split("String_Node_Str"));
        String prefix="String_Node_Str";
        if (lines != null && lines.size() > 0) {
          lines.remove(lines.size() - 1);
          prefix=Joiner.on("String_Node_Str").join(lines);
        }
        String newUserdata=lc.getUserData();
        if (ntpServers != null) {
          newUserdata=B64.standard.encString(String.format("String_Node_Str",prefix,getServerUserData(ntpServers,null,null)));
        }
        if (logServer != null) {
          newUserdata=B64.standard.encString(String.format("String_Node_Str",prefix,getServerUserData(DatabaseServerProperties.DB_SERVER_NTP_SERVER,logServer,null)));
        }
        if (logServerPort != null) {
          newUserdata=B64.standard.encString(String.format("String_Node_Str",prefix,getServerUserData(DatabaseServerProperties.DB_SERVER_NTP_SERVER,null,logServerPort)));
        }
        try {
          AutoScalingClient.getInstance().createLaunchConfiguration(null,newEmi,newType,lc.getIamInstanceProfile(),tmpLaunchConfigName,lc.getSecurityGroups().getMember().get(0),newKeyname,newUserdata);
        }
 catch (        final Exception ex) {
          LOG.warn("String_Node_Str",ex);
          throw new EucalyptusCloudException("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().updateAutoScalingGroup(null,asgName,null,asgType.getDesiredCapacity(),tmpLaunchConfigName);
        }
 catch (        final Exception ex) {
          LOG.warn("String_Node_Str",ex);
          throw new EucalyptusCloudException("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().deleteLaunchConfiguration(null,asgType.getLaunchConfigurationName());
        }
 catch (        final Exception ex) {
          LOG.warn("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().createLaunchConfiguration(null,newEmi,newType,lc.getIamInstanceProfile(),asgType.getLaunchConfigurationName(),lc.getSecurityGroups().getMember().get(0),newKeyname,newUserdata);
        }
 catch (        final Exception ex) {
          throw new EucalyptusCloudException("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().updateAutoScalingGroup(null,asgName,null,asgType.getDesiredCapacity(),asgType.getLaunchConfigurationName());
        }
 catch (        final Exception ex) {
          throw new EucalyptusCloudException("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().deleteLaunchConfiguration(null,tmpLaunchConfigName);
        }
 catch (        final Exception ex) {
          LOG.warn("String_Node_Str",ex);
        }
        LOG.debug(String.format("String_Node_Str",asgName));
      }
    }
 catch (    final EucalyptusCloudException ex) {
      throw ex;
    }
catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str",ex);
    }
  }
}

Fixed version (ground truth):
private static void onPropertyChange(final String emi,final String volumeId,final String instanceType,final String keyname,final String ntpServers,String logServer,String logServerPort) throws EucalyptusCloudException {
  if (!(Bootstrap.isFinished() && Topology.isEnabled(Eucalyptus.class)))   return;
  if (emi != null) {
    try {
      final List<ImageDetails> images=Ec2Client.getInstance().describeImages(null,Lists.newArrayList(emi));
      if (images == null || images.size() <= 0)       throw new EucalyptusCloudException("String_Node_Str");
      if (!images.get(0).getImageId().toLowerCase().equals(emi.toLowerCase()))       throw new EucalyptusCloudException("String_Node_Str");
    }
 catch (    final EucalyptusCloudException ex) {
      throw ex;
    }
catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str");
    }
  }
  if (volumeId != null) {
    if (!volumeId.toLowerCase().startsWith("String_Node_Str"))     throw new EucalyptusCloudException("String_Node_Str");
    try {
      final List<Volume> volumes=Ec2Client.getInstance().describeVolumes(null,Lists.newArrayList(volumeId));
      if (!(volumeId.equals(volumes.get(0).getVolumeId()) && "String_Node_Str".equals(volumes.get(0).getStatus()))) {
        throw new Exception();
      }
    }
 catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str");
    }
  }
  if (instanceType != null) {
    ;
  }
  if (keyname != null && !keyname.equals("String_Node_Str")) {
    try {
      final List<DescribeKeyPairsResponseItemType> keypairs=Ec2Client.getInstance().describeKeyPairs(null,Lists.newArrayList(keyname));
      if (keypairs == null || keypairs.size() <= 0)       throw new EucalyptusCloudException("String_Node_Str");
      if (!keypairs.get(0).getKeyName().equals(keyname))       throw new EucalyptusCloudException("String_Node_Str");
    }
 catch (    final EucalyptusCloudException ex) {
      throw ex;
    }
catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str");
    }
  }
  if (ntpServers != null) {
    ;
  }
  if ((emi != null && emi.length() > 0) || (instanceType != null && instanceType.length() > 0) || (keyname != null && keyname.length() > 0)|| (ntpServers != null && ntpServers.length() > 0)|| (logServer != null && logServer.length() > 0)|| (logServerPort != null && logServerPort.length() > 0)) {
    String asgName=null;
    LOG.warn("String_Node_Str");
    try {
      final List<TagDescription> tags=AutoScalingClient.getInstance().describeAutoScalingTags(null);
      for (      final TagDescription tag : tags) {
        if (DEFAULT_LAUNCHER_TAG.equals(tag.getValue())) {
          asgName=tag.getResourceId();
          break;
        }
      }
    }
 catch (    final Exception ex) {
      return;
    }
    if (asgName == null)     return;
    try {
      AutoScalingGroupType asgType=null;
      try {
        final DescribeAutoScalingGroupsResponseType resp=AutoScalingClient.getInstance().describeAutoScalingGroups(null,Lists.newArrayList(asgName));
        if (resp.getDescribeAutoScalingGroupsResult() != null && resp.getDescribeAutoScalingGroupsResult().getAutoScalingGroups() != null && resp.getDescribeAutoScalingGroupsResult().getAutoScalingGroups().getMember() != null && resp.getDescribeAutoScalingGroupsResult().getAutoScalingGroups().getMember().size() > 0) {
          asgType=resp.getDescribeAutoScalingGroupsResult().getAutoScalingGroups().getMember().get(0);
        }
      }
 catch (      final Exception ex) {
        LOG.warn("String_Node_Str" + asgName);
        return;
      }
      if (asgType != null) {
        final String lcName=asgType.getLaunchConfigurationName();
        final LaunchConfigurationType lc=AutoScalingClient.getInstance().describeLaunchConfiguration(null,lcName);
        String tmpLaunchConfigName=null;
        do {
          tmpLaunchConfigName=String.format("String_Node_Str",UUID.randomUUID().toString().substring(0,8));
        }
 while (tmpLaunchConfigName.equals(asgType.getLaunchConfigurationName()));
        final String newEmi=emi != null ? emi : lc.getImageId();
        final String newType=instanceType != null ? instanceType : lc.getInstanceType();
        String newKeyname=keyname != null ? keyname : lc.getKeyName();
        final String oldUserData=B64.standard.decString(lc.getUserData());
        final List<String> lines=Lists.newArrayList(oldUserData.split("String_Node_Str"));
        String prefix="String_Node_Str";
        if (lines != null && lines.size() > 0) {
          lines.remove(lines.size() - 1);
          prefix=Joiner.on("String_Node_Str").join(lines);
        }
        String newUserdata=lc.getUserData();
        if (volumeId != null) {
          newUserdata=B64.standard.encString(String.format("String_Node_Str",prefix,getServerUserData(volumeId,DatabaseServerProperties.DB_SERVER_NTP_SERVER,null,null)));
        }
        if (ntpServers != null) {
          newUserdata=B64.standard.encString(String.format("String_Node_Str",prefix,getServerUserData(DatabaseServerProperties.DB_SERVER_VOLUME,ntpServers,null,null)));
        }
        if (logServer != null) {
          newUserdata=B64.standard.encString(String.format("String_Node_Str",prefix,getServerUserData(DatabaseServerProperties.DB_SERVER_VOLUME,DatabaseServerProperties.DB_SERVER_NTP_SERVER,logServer,null)));
        }
        if (logServerPort != null) {
          newUserdata=B64.standard.encString(String.format("String_Node_Str",prefix,getServerUserData(DatabaseServerProperties.DB_SERVER_VOLUME,DatabaseServerProperties.DB_SERVER_NTP_SERVER,null,logServerPort)));
        }
        try {
          AutoScalingClient.getInstance().createLaunchConfiguration(null,newEmi,newType,lc.getIamInstanceProfile(),tmpLaunchConfigName,lc.getSecurityGroups().getMember().get(0),newKeyname,newUserdata);
        }
 catch (        final Exception ex) {
          LOG.warn("String_Node_Str",ex);
          throw new EucalyptusCloudException("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().updateAutoScalingGroup(null,asgName,null,asgType.getDesiredCapacity(),tmpLaunchConfigName);
        }
 catch (        final Exception ex) {
          LOG.warn("String_Node_Str",ex);
          throw new EucalyptusCloudException("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().deleteLaunchConfiguration(null,asgType.getLaunchConfigurationName());
        }
 catch (        final Exception ex) {
          LOG.warn("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().createLaunchConfiguration(null,newEmi,newType,lc.getIamInstanceProfile(),asgType.getLaunchConfigurationName(),lc.getSecurityGroups().getMember().get(0),newKeyname,newUserdata);
        }
 catch (        final Exception ex) {
          throw new EucalyptusCloudException("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().updateAutoScalingGroup(null,asgName,null,asgType.getDesiredCapacity(),asgType.getLaunchConfigurationName());
        }
 catch (        final Exception ex) {
          throw new EucalyptusCloudException("String_Node_Str",ex);
        }
        try {
          AutoScalingClient.getInstance().deleteLaunchConfiguration(null,tmpLaunchConfigName);
        }
 catch (        final Exception ex) {
          LOG.warn("String_Node_Str",ex);
        }
        LOG.debug(String.format("String_Node_Str",asgName));
      }
    }
 catch (    final EucalyptusCloudException ex) {
      throw ex;
    }
catch (    final Exception ex) {
      throw new EucalyptusCloudException("String_Node_Str",ex);
    }
  }
}