Program: 14989
Project: 14989
Buggy source:
@SuppressWarnings("String_Node_Str") public <T>T getUnique(final T example) throws EucalyptusCloudException {
  try {
    Object id=null;
    try {
      id=this.getEntityManager().getEntityManagerFactory().getPersistenceUnitUtil().getIdentifier(example);
    }
 catch (    final Exception ex) {
    }
    if (id != null) {
      final T res=(T)this.getEntityManager().find(example.getClass(),id);
      if (res == null) {
        throw new NoSuchElementException("String_Node_Str" + id);
      }
 else {
        return res;
      }
    }
 else     if ((example instanceof HasNaturalId) && (((HasNaturalId)example).getNaturalId() != null)) {
      final String natId=((HasNaturalId)example).getNaturalId();
      final T ret=(T)this.createCriteria(example.getClass()).add(Restrictions.naturalId().set("String_Node_Str",natId)).setCacheable(true).setMaxResults(1).setFetchSize(1).setFirstResult(0).uniqueResult();
      if (ret == null) {
        throw new NoSuchElementException("String_Node_Str" + natId);
      }
      return ret;
    }
 else {
      final T ret=(T)this.createCriteria(example.getClass()).add(Example.create(example).enableLike(MatchMode.EXACT)).setCacheable(true).setMaxResults(1).setFetchSize(1).setFirstResult(0).uniqueResult();
      if (ret == null) {
        throw new NoSuchElementException("String_Node_Str" + LogUtil.dumpObject(example));
      }
      return ret;
    }
  }
 catch (  final NonUniqueResultException ex) {
    throw new EucalyptusCloudException("String_Node_Str" + example.getClass().getSimpleName() + "String_Node_Str"+ ex.getMessage(),ex);
  }
catch (  final NoSuchElementException ex) {
    throw new EucalyptusCloudException("String_Node_Str" + example.getClass().getSimpleName() + "String_Node_Str"+ ex.getMessage(),ex);
  }
catch (  final Exception ex) {
    final Exception newEx=PersistenceExceptions.throwFiltered(ex);
    throw new EucalyptusCloudException("String_Node_Str" + example.getClass().getSimpleName() + "String_Node_Str"+ newEx.getMessage(),newEx);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public <T>T getUnique(final T example) throws EucalyptusCloudException {
  try {
    Object id=null;
    try {
      id=this.getEntityManager().getEntityManagerFactory().getPersistenceUnitUtil().getIdentifier(example);
    }
 catch (    final Exception ex) {
    }
    if (id != null) {
      final T res=(T)this.getEntityManager().find(example.getClass(),id);
      if (res == null) {
        throw new NoSuchElementException("String_Node_Str" + id);
      }
 else {
        return res;
      }
    }
 else     if ((example instanceof HasNaturalId) && (((HasNaturalId)example).getNaturalId() != null)) {
      final String natId=((HasNaturalId)example).getNaturalId();
      final T ret=(T)this.createCriteria(example.getClass()).setLockMode(LockMode.NONE).setCacheable(true).setMaxResults(1).setFetchSize(1).setFirstResult(0).add(Restrictions.naturalId().set("String_Node_Str",natId)).uniqueResult();
      if (ret == null) {
        throw new NoSuchElementException("String_Node_Str" + natId);
      }
      return ret;
    }
 else {
      final T ret=(T)this.createCriteria(example.getClass()).setLockMode(LockMode.NONE).setCacheable(true).setMaxResults(1).setFetchSize(1).setFirstResult(0).add(Example.create(example).enableLike(MatchMode.EXACT)).uniqueResult();
      if (ret == null) {
        throw new NoSuchElementException("String_Node_Str" + LogUtil.dumpObject(example));
      }
      return ret;
    }
  }
 catch (  final NonUniqueResultException ex) {
    throw new EucalyptusCloudException("String_Node_Str" + example.getClass().getSimpleName() + "String_Node_Str"+ ex.getMessage(),ex);
  }
catch (  final NoSuchElementException ex) {
    throw new EucalyptusCloudException("String_Node_Str" + example.getClass().getSimpleName() + "String_Node_Str"+ ex.getMessage(),ex);
  }
catch (  final Exception ex) {
    final Exception newEx=PersistenceExceptions.throwFiltered(ex);
    throw new EucalyptusCloudException("String_Node_Str" + example.getClass().getSimpleName() + "String_Node_Str"+ newEx.getMessage(),newEx);
  }
}