[gatein-issues] [JBoss JIRA] (GTNPORTAL-3243) Exceptions are swallowed in PicketLinkIDMOrganizationServiceImpl flush and endRequest

Martin Weiler (JIRA) jira-events at lists.jboss.org
Tue Aug 20 04:44:26 EDT 2013


Martin Weiler created GTNPORTAL-3243:
----------------------------------------

             Summary: Exceptions are swallowed in PicketLinkIDMOrganizationServiceImpl flush and endRequest
                 Key: GTNPORTAL-3243
                 URL: https://issues.jboss.org/browse/GTNPORTAL-3243
             Project: GateIn Portal
          Issue Type: Bug
          Components: Identity integration
    Affects Versions: 3.6.0.Final
            Reporter: Martin Weiler
            Assignee: Marek Posolda


IDM operations are invoked from a WS facade in our environment, and not from the GUI. Therefore, we have overridden PicketLinkIDMOrganizationServiceImpl.recoverFromIDMError to just let any errors bubble up and let the upper layer handle it, instead of rolling back + restarting the transaction.

But here's the place the exception handling is not working as expected. The issue is in PicketLinkIDMOrganizationServiceImpl.flush():

{code}
    public void flush() {
        try {

            if (configuration.isUseJTA()) {
                if (traceLoggingEnabled) {
                    log.trace("Flushing UserTransaction in method flush");
                }
                // Complete restart of JTA transaction don't have good performance. So we will only sync identitySession (same
                // as for non-jta environment)
                // finishJTATransaction();
                // beginJTATransaction();
                if (jtaTransactionLifecycleService.getUserTransaction().getStatus() == Status.STATUS_ACTIVE) {
                    idmService_.getIdentitySession().save();
                }
            } else {
                try {
                    if (idmService_.getIdentitySession().getTransaction().isActive()) {
166:                        idmService_.getIdentitySession().save();
                    }
                } catch (Exception e) {
                    log.error(e.getMessage(), e);
170:                    recoverFromIDMError(e);
                }
            }

174:        } catch (Exception e) {
175:            log.error(e.getMessage(), e);
        }
    }
{code}

Let's assume there is an exception at session.save() in line 166. This exception is then handled by the recoverFromIDMError method in line 170. In our environment, this method is overridden and throws an Exception.

But the initial goal of overriding this method, which was to have this exception propagated to the caller, is not reached here, as there is an outer try..catch block in the PicketLinkIDMOrganizationServiceImpl.flush() method which just logs the error.

The outer try..catch block should be removed in flush() and endRequest().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the gatein-issues mailing list