Program: 14155
Project: 14155
Buggy source:
private void checkAndAddUser(){
  TransactionResource outter=Entities.transactionFor(CHAPUserInfo.class);
  try {
    CHAPUserInfo userInfo=Entities.uniqueResult(new CHAPUserInfo("String_Node_Str"));
    outter.commit();
    if (!checkUser("String_Node_Str")) {
      try {
        addUser("String_Node_Str",blockStorageUtilSvc.decryptSCTargetPassword(userInfo.getEncryptedPassword()));
      }
 catch (      EucalyptusCloudException e1) {
        LOG.error(e1);
        return;
      }
    }
  }
 catch (  NoSuchElementException ex) {
    outter.rollback();
    boolean addUser=true;
    String encryptedPassword=null;
    try (TransactionResource inner=Entities.transactionFor(CHAPUserInfo.class)){
      if (checkUser("String_Node_Str")) {
        try {
          LOG.debug("String_Node_Str");
          CHAPUserInfo userInfo=new CHAPUserInfo("String_Node_Str");
          userInfo.setScName(null);
          CHAPUserInfo currentUserInfo=Entities.uniqueResult(userInfo);
          if (null != currentUserInfo && null != currentUserInfo.getEncryptedPassword()) {
            LOG.debug("String_Node_Str");
            addUser=false;
            encryptedPassword=currentUserInfo.getEncryptedPassword();
          }
        }
 catch (        Exception e1) {
          LOG.debug("String_Node_Str");
          try {
            deleteUser("String_Node_Str");
          }
 catch (          Exception e) {
            LOG.error("String_Node_Str",e);
          }
        }
      }
      if (addUser) {
        String password=Hashes.getRandom(16);
        password=password.substring(0,16);
        try {
          addUser("String_Node_Str",password);
          encryptedPassword=blockStorageUtilSvc.encryptSCTargetPassword(password);
        }
 catch (        Exception e) {
          LOG.error("String_Node_Str",e);
          return;
        }
      }
      try {
        Entities.persist(new CHAPUserInfo("String_Node_Str",encryptedPassword));
      }
 catch (      Exception e) {
        LOG.error(e);
      }
      inner.commit();
    }
   }
catch (  TransactionException e) {
    LOG.error(e);
  }
}

Fixed version (ground truth):
private void checkAndAddUser(){
  try (TransactionResource outter=Entities.transactionFor(CHAPUserInfo.class)){
    CHAPUserInfo userInfo=Entities.uniqueResult(new CHAPUserInfo("String_Node_Str"));
    outter.commit();
    if (!checkUser("String_Node_Str")) {
      try {
        addUser("String_Node_Str",blockStorageUtilSvc.decryptSCTargetPassword(userInfo.getEncryptedPassword()));
      }
 catch (      EucalyptusCloudException e1) {
        LOG.error(e1);
        return;
      }
    }
  }
 catch (  NoSuchElementException ex) {
    boolean addUser=true;
    String encryptedPassword=null;
    try (TransactionResource inner=Entities.transactionFor(CHAPUserInfo.class)){
      if (checkUser("String_Node_Str")) {
        try {
          LOG.debug("String_Node_Str");
          CHAPUserInfo userInfo=new CHAPUserInfo("String_Node_Str");
          userInfo.setScName(null);
          CHAPUserInfo currentUserInfo=Entities.uniqueResult(userInfo);
          if (null != currentUserInfo && null != currentUserInfo.getEncryptedPassword()) {
            LOG.debug("String_Node_Str");
            addUser=false;
            encryptedPassword=currentUserInfo.getEncryptedPassword();
          }
        }
 catch (        Exception e1) {
          LOG.debug("String_Node_Str");
          try {
            deleteUser("String_Node_Str");
          }
 catch (          Exception e) {
            LOG.error("String_Node_Str",e);
          }
        }
      }
      if (addUser) {
        String password=Hashes.getRandom(16);
        password=password.substring(0,16);
        try {
          addUser("String_Node_Str",password);
          encryptedPassword=blockStorageUtilSvc.encryptSCTargetPassword(password);
        }
 catch (        Exception e) {
          LOG.error("String_Node_Str",e);
          return;
        }
      }
      try {
        Entities.persist(new CHAPUserInfo("String_Node_Str",encryptedPassword));
      }
 catch (      Exception e) {
        LOG.error(e);
      }
      inner.commit();
    }
   }
catch (  TransactionException e) {
    LOG.error(e);
  }
}