Uploaded image for project: 'GateIn Portal'
  1. GateIn Portal
  2. GTNPORTAL-3243

Exceptions are swallowed in PicketLinkIDMOrganizationServiceImpl flush and endRequest



      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():

          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) {
                  } 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);

      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().

        Gliffy Diagrams




              • Assignee:
                mposolda Marek Posolda
                mputz Martin Weiler
              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: