Program: 14579
Project: 14579
Buggy source:
protected static Address lookupOrCreate(final Cluster cluster,final ClusterAddressInfo addrInfo){
  Address addr=null;
  VmInstance vm=null;
  try {
    addr=Addresses.getInstance().lookupDisabled(addrInfo.getAddress());
    LOG.trace("String_Node_Str" + addr);
  }
 catch (  final NoSuchElementException e1) {
    try {
      addr=Addresses.getInstance().lookup(addrInfo.getAddress());
      LOG.trace("String_Node_Str" + addr);
    }
 catch (    final NoSuchElementException e) {
    }
  }
  if (addrInfo.hasMapping()) {
    vm=Helper.maybeFindVm(addr != null ? addr.getInstanceId() : null,addrInfo.getAddress(),addrInfo.getInstanceIp());
    if ((addr != null) && (vm != null)) {
      Helper.ensureAllocated(addr,vm);
      clearOrphan(addrInfo);
    }
 else     if (addr != null && !addr.isPending() && vm != null && VmStateSet.DONE.apply(vm)) {
      handleOrphan(cluster,addrInfo);
    }
 else     if ((addr != null && !addr.isPending()) && (vm == null)) {
      handleOrphan(cluster,addrInfo);
    }
 else     if ((addr == null) && (vm != null)) {
      addr=new Address(Principals.systemFullName(),addrInfo.getAddress(),cluster.getPartition(),vm.getInstanceId(),vm.getPrivateAddress());
      clearOrphan(addrInfo);
    }
 else     if ((addr == null) && (vm == null)) {
      addr=new Address(addrInfo.getAddress(),cluster.getPartition());
      handleOrphan(cluster,addrInfo);
    }
  }
 else {
    if ((addr != null) && addr.isAssigned() && !addr.isPending()) {
      handleOrphan(cluster,addrInfo);
    }
 else     if ((addr != null) && !addr.isAssigned() && !addr.isPending()&& addr.isSystemOwned()) {
      try {
        addr.release();
      }
 catch (      final Exception ex) {
        LOG.error(ex);
      }
    }
 else     if ((addr != null) && Address.Transition.system.equals(addr.getTransition())) {
      handleOrphan(cluster,addrInfo);
    }
 else     if (addr == null) {
      addr=new Address(addrInfo.getAddress(),cluster.getPartition());
      Helper.clearVmState(addrInfo);
    }
  }
  return addr;
}

Fixed version (ground truth):
protected static Address lookupOrCreate(final Cluster cluster,final ClusterAddressInfo addrInfo){
  Address addr=null;
  VmInstance vm=null;
  try {
    addr=Addresses.getInstance().lookupDisabled(addrInfo.getAddress());
    LOG.trace("String_Node_Str" + addr);
  }
 catch (  final NoSuchElementException e1) {
    try {
      addr=Addresses.getInstance().lookup(addrInfo.getAddress());
      LOG.trace("String_Node_Str" + addr);
    }
 catch (    final NoSuchElementException e) {
    }
  }
  if (addrInfo.hasMapping()) {
    vm=Helper.maybeFindVm(addr != null ? addr.getInstanceId() : null,addrInfo.getAddress(),addrInfo.getInstanceIp());
    if ((addr != null) && (vm != null)) {
      clearOrphan(addrInfo);
    }
 else     if (addr != null && !addr.isPending() && vm != null && VmStateSet.DONE.apply(vm)) {
      handleOrphan(cluster,addrInfo);
    }
 else     if ((addr != null && !addr.isPending()) && (vm == null)) {
      handleOrphan(cluster,addrInfo);
    }
 else     if ((addr == null) && (vm != null)) {
      addr=new Address(Principals.systemFullName(),addrInfo.getAddress(),cluster.getPartition(),vm.getInstanceId(),vm.getPrivateAddress());
      clearOrphan(addrInfo);
    }
 else     if ((addr == null) && (vm == null)) {
      addr=new Address(addrInfo.getAddress(),cluster.getPartition());
      handleOrphan(cluster,addrInfo);
    }
  }
 else {
    if ((addr != null) && addr.isAssigned() && !addr.isPending()) {
      handleOrphan(cluster,addrInfo);
    }
 else     if ((addr != null) && !addr.isAssigned() && !addr.isPending()&& addr.isSystemOwned()) {
      try {
        addr.release();
      }
 catch (      final Exception ex) {
        LOG.error(ex);
      }
    }
 else     if ((addr != null) && Address.Transition.system.equals(addr.getTransition())) {
      handleOrphan(cluster,addrInfo);
    }
 else     if (addr == null) {
      addr=new Address(addrInfo.getAddress(),cluster.getPartition());
      Helper.clearVmState(addrInfo);
    }
  }
  return addr;
}