Program: 14968
Project: 14968
Buggy source:
public RunningInstancesItemType getAsRunningInstanceItemType(){
  final boolean dns=!ComponentIds.lookup(Dns.class).runLimitedServices();
  final RunningInstancesItemType runningInstance=new RunningInstancesItemType();
  runningInstance.setAmiLaunchIndex(Integer.toString(this.launchIndex));
  if ((this.getBundleTaskState() != null) && !BundleState.none.equals(this.getBundleTaskState())) {
    runningInstance.setStateCode(Integer.toString(VmState.TERMINATED.getCode()));
    runningInstance.setStateName(VmState.TERMINATED.getName());
  }
 else {
    runningInstance.setStateCode(Integer.toString(this.runtimeState.getReference().getCode()));
    runningInstance.setStateName(this.runtimeState.getReference().getName());
  }
  runningInstance.setPlatform(this.getPlatform());
  runningInstance.setStateCode(Integer.toString(this.runtimeState.getReference().getCode()));
  runningInstance.setStateName(this.runtimeState.getReference().getName());
  runningInstance.setInstanceId(this.instanceId);
  runningInstance.setProductCodes(new ArrayList<String>());
  runningInstance.setImageId(this.bootSet.getMachine().getDisplayName());
  runningInstance.setKernel(this.bootSet.getKernel().getDisplayName());
  runningInstance.setRamdisk(this.bootSet.getRamdisk().getDisplayName());
  if (dns) {
    String publicDnsName=this.getPublicDnsName();
    String privateDnsName=this.getPrivateDnsName();
    publicDnsName=(publicDnsName == null ? VmInstance.DEFAULT_IP : publicDnsName);
    privateDnsName=(privateDnsName == null ? VmInstance.DEFAULT_IP : privateDnsName);
    runningInstance.setDnsName(publicDnsName);
    runningInstance.setIpAddress(publicDnsName);
    runningInstance.setPrivateDnsName(privateDnsName);
    runningInstance.setPrivateIpAddress(privateDnsName);
  }
 else {
    String publicDnsName=this.getPublicAddress();
    String privateDnsName=this.getPrivateAddress();
    publicDnsName=(publicDnsName == null ? VmInstance.DEFAULT_IP : publicDnsName);
    privateDnsName=(privateDnsName == null ? VmInstance.DEFAULT_IP : privateDnsName);
    runningInstance.setPrivateDnsName(privateDnsName);
    runningInstance.setPrivateIpAddress(privateDnsName);
    if (!VmInstance.DEFAULT_IP.equals(publicDnsName)) {
      runningInstance.setDnsName(publicDnsName);
      runningInstance.setIpAddress(publicDnsName);
    }
 else {
      runningInstance.setDnsName(privateDnsName);
      runningInstance.setIpAddress(privateDnsName);
    }
  }
  runningInstance.setReason(this.getReason());
  if (this.getSshKeyPair() != null)   runningInstance.setKeyName(this.getSshKeyPair().getName());
 else   runningInstance.setKeyName("String_Node_Str");
  runningInstance.setInstanceType(this.getVmType().getName());
  runningInstance.setPlacement(this.partitionName);
  runningInstance.setLaunchTime(this.launchTime);
  runningInstance.getBlockDevices().add(new InstanceBlockDeviceMapping("String_Node_Str"));
  for (  final AttachedVolume attachedVol : this.transientVolumes.values()) {
    runningInstance.getBlockDevices().add(new InstanceBlockDeviceMapping(attachedVol.getDevice(),attachedVol.getVolumeId(),attachedVol.getStatus(),attachedVol.getAttachTime()));
  }
  return runningInstance;
}

Fixed version (ground truth):
public RunningInstancesItemType getAsRunningInstanceItemType(){
  final boolean dns=!ComponentIds.lookup(Dns.class).runLimitedServices();
  final RunningInstancesItemType runningInstance=new RunningInstancesItemType();
  runningInstance.setAmiLaunchIndex(Integer.toString(this.launchIndex));
  if ((this.getBundleTaskState() != null) && !BundleState.none.equals(this.getBundleTaskState())) {
    runningInstance.setStateCode(Integer.toString(VmState.TERMINATED.getCode()));
    runningInstance.setStateName(VmState.TERMINATED.getName());
  }
 else {
    runningInstance.setStateCode(Integer.toString(this.runtimeState.getReference().getCode()));
    runningInstance.setStateName(this.runtimeState.getReference().getName());
  }
  runningInstance.setPlatform(this.getPlatform());
  runningInstance.setStateCode(Integer.toString(this.runtimeState.getReference().getCode()));
  runningInstance.setStateName(this.runtimeState.getReference().getName());
  runningInstance.setInstanceId(this.instanceId);
  runningInstance.setProductCodes(new ArrayList<String>());
  runningInstance.setImageId(this.getImageId());
  runningInstance.setKernel(this.getKernelId());
  runningInstance.setRamdisk(this.getRamdiskId());
  if (dns) {
    String publicDnsName=this.getPublicDnsName();
    String privateDnsName=this.getPrivateDnsName();
    publicDnsName=(publicDnsName == null ? VmInstance.DEFAULT_IP : publicDnsName);
    privateDnsName=(privateDnsName == null ? VmInstance.DEFAULT_IP : privateDnsName);
    runningInstance.setDnsName(publicDnsName);
    runningInstance.setIpAddress(publicDnsName);
    runningInstance.setPrivateDnsName(privateDnsName);
    runningInstance.setPrivateIpAddress(privateDnsName);
  }
 else {
    String publicDnsName=this.getPublicAddress();
    String privateDnsName=this.getPrivateAddress();
    publicDnsName=(publicDnsName == null ? VmInstance.DEFAULT_IP : publicDnsName);
    privateDnsName=(privateDnsName == null ? VmInstance.DEFAULT_IP : privateDnsName);
    runningInstance.setPrivateDnsName(privateDnsName);
    runningInstance.setPrivateIpAddress(privateDnsName);
    if (!VmInstance.DEFAULT_IP.equals(publicDnsName)) {
      runningInstance.setDnsName(publicDnsName);
      runningInstance.setIpAddress(publicDnsName);
    }
 else {
      runningInstance.setDnsName(privateDnsName);
      runningInstance.setIpAddress(privateDnsName);
    }
  }
  runningInstance.setReason(this.getReason());
  if (this.getSshKeyPair() != null)   runningInstance.setKeyName(this.getSshKeyPair().getName());
 else   runningInstance.setKeyName("String_Node_Str");
  runningInstance.setInstanceType(this.getVmType().getName());
  runningInstance.setPlacement(this.partitionName);
  runningInstance.setLaunchTime(this.launchTime);
  runningInstance.getBlockDevices().add(new InstanceBlockDeviceMapping("String_Node_Str"));
  for (  final AttachedVolume attachedVol : this.transientVolumes.values()) {
    runningInstance.getBlockDevices().add(new InstanceBlockDeviceMapping(attachedVol.getDevice(),attachedVol.getVolumeId(),attachedVol.getStatus(),attachedVol.getAttachTime()));
  }
  return runningInstance;
}