} catch (LockingException e) { messageLogger.logCritical("LockingException thrown by store. Rethrowing as RuntimeException.", e); throw new RuntimeException(e); } catch (TimeoutException e) { messageLogger.logCritical("TimeoutException thrown by store. Rethrowing as RuntimeException.", e); throw new RuntimeException(e);
if (dataObject instanceof MoriaAuthnAttempt) { authnAttempt = (MoriaAuthnAttempt) dataObject; }  if (!keep) { removeFromStore(ticket); }
    public MoriaAuthnAttempt getAuthnAttempt(final String loginTicketId, final boolean keep) throws InvalidTicketException {        if (loginTicketId == null || loginTicketId.equals("")) {            throw new IllegalArgumentException("loginTicketId must be a non-empty string");        }        MoriaTicket ticket = getTicketFromStore(MoriaTicketType.LOGIN_TICKET, loginTicketId);        if (ticket == null) {            throw new InvalidTicketException("Ticket does not exist");        }        /* Validate ticket. */        validateTicket(ticket, MoriaTicketType.LOGIN_TICKET, null);        MoriaAuthnAttempt authnAttempt = null;        Fqn fqn = new Fqn(new Object[] {ticket.getTicketType(), ticket.getTicketId()});        try {            if (store.exists(fqn)) {                Object dataObject = store.get(fqn).get(DATA_ATTRIBUTE);                /* authnAttempt will remain null if the returned object is of incorrect type. */                if (dataObject instanceof MoriaAuthnAttempt) {                    authnAttempt = (MoriaAuthnAttempt) dataObject;                }                if (!keep) {                    removeFromStore(ticket);                }            }        } catch (LockingException e) {            messageLogger.logCritical("LockingException thrown by store. Rethrowing as RuntimeException.", e);            throw new RuntimeException(e);        } catch (TimeoutException e) {            messageLogger.logCritical("TimeoutException thrown by store. Rethrowing as RuntimeException.", e);            throw new RuntimeException(e);        }        return authnAttempt;    }