[gatein-issues] [JBoss JIRA] (GTNPORTAL-3539) Do not recover IDM transaction if exception occurs during a search.

Trong Tran (JIRA) issues at jboss.org
Tue Oct 7 05:41:13 EDT 2014


     [ https://issues.jboss.org/browse/GTNPORTAL-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Trong Tran updated GTNPORTAL-3539:
----------------------------------
              Status: Pull Request Sent  (was: Open)
    Git Pull Request: https://github.com/gatein/gatein-portal/pull/908


After discussing in the email, we decided to handle just specific exception called by IDM PersistenceManagerImpl for NULL check. Something like:
{code}
try {
    foundUser = session.getPersistenceManager().findUser(userName);
} catch (IllegalArgumentException iae) { 
    // findUser was called with null argument. Do something needed for your business logic (Rethrow exception or at least log error)
} catch (Exception e) {
    handleException("Cannot obtain user: " + userName + "; ", e);
}
{code}

> Do not recover IDM transaction if exception occurs during a search.
> -------------------------------------------------------------------
>
>                 Key: GTNPORTAL-3539
>                 URL: https://issues.jboss.org/browse/GTNPORTAL-3539
>             Project: GateIn Portal
>          Issue Type: Task
>    Affects Versions: 3.7.0.Final
>            Reporter: Tran Trung Thanh
>            Priority: Minor
>             Fix For: 3.9.0.Final
>
>
> If user meets an exception during a search, it is not neccessary to recover transaction.
> Unit test
> {code:java}
>     @Test
>     public void testFailDuringSearch() throws Exception {
>       String USER = "test";
>        createUser(USER);
>        userHandler_.findUserByName(null);
>        User user = userHandler_.findUserByName(USER);
>        assertTrue("Not found user instance ", user != null);
>        userHandler_.removeUser(USER, true);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the gatein-issues mailing list