From do-not-reply at jboss.org Fri Jan 9 04:22:23 2015 From: do-not-reply at jboss.org (do-not-reply at jboss.org) Date: Fri, 9 Jan 2015 04:22:23 -0500 Subject: [gatein-commits] gatein SVN: r9329 - epp/portal/branches. Message-ID: <201501090922.t099MNE1027672@svn01.web.mwc.hst.phx2.redhat.com> Author: mputz Date: 2015-01-09 04:22:22 -0500 (Fri, 09 Jan 2015) New Revision: 9329 Added: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/ Log: Creating patch branch From do-not-reply at jboss.org Fri Jan 9 05:00:30 2015 From: do-not-reply at jboss.org (do-not-reply at jboss.org) Date: Fri, 9 Jan 2015 05:00:30 -0500 Subject: [gatein-commits] gatein SVN: r9330 - epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm. Message-ID: <201501091000.t09A0UvA002856@svn01.web.mwc.hst.phx2.redhat.com> Author: mputz Date: 2015-01-09 05:00:30 -0500 (Fri, 09 Jan 2015) New Revision: 9330 Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java Log: Backport fixes related to GTNPORTAL-2928 Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java 2015-01-09 09:22:22 UTC (rev 9329) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java 2015-01-09 10:00:30 UTC (rev 9330) @@ -67,6 +67,8 @@ { log.warn("Unable to set Transaction status to be rollback only", tre); } + } else { + orgService.recoverFromIDMError(); } } } Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2015-01-09 09:22:22 UTC (rev 9329) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2015-01-09 10:00:30 UTC (rev 9330) @@ -30,6 +30,7 @@ import org.exoplatform.services.organization.BaseOrganizationService; import org.gatein.common.logging.Logger; import org.gatein.common.logging.LoggerFactory; +import org.picketlink.idm.api.Transaction; import org.picocontainer.Startable; import javax.naming.InitialContext; @@ -197,14 +198,21 @@ { if (idmService_.getIdentitySession().getTransaction().isActive()) { - idmService_.getIdentitySession().save(); + try { + if (idmService_.getIdentitySession().getTransaction().isActive()) { + idmService_.getIdentitySession().save(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + recoverFromIDMError(); + } } } } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } } @@ -224,16 +232,38 @@ } else { - idmService_.getIdentitySession().getTransaction().commit(); + try { + if (idmService_.getIdentitySession().getTransaction().isActive()) { + idmService_.getIdentitySession().getTransaction().commit(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + recoverFromIDMError(); + } } } catch (Exception e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } } + // Should be used only for non-JTA environment + public void recoverFromIDMError() { + try { + // We need to restart Hibernate transaction if it's available. First rollback old one and then start new one + Transaction idmTransaction = idmService_.getIdentitySession().getTransaction(); + if (idmTransaction.isActive()) { + idmTransaction.rollback(); + idmTransaction.start(); + log.info("IDM error recovery finished. Old transaction has been rolled-back and new transaction has been started"); + } + } catch (Exception e1) { + log.warn("Error during recovery of old error", e1); + } + } + public Config getConfiguration() { return configuration; From do-not-reply at jboss.org Fri Jan 9 05:45:42 2015 From: do-not-reply at jboss.org (do-not-reply at jboss.org) Date: Fri, 9 Jan 2015 05:45:42 -0500 Subject: [gatein-commits] gatein SVN: r9331 - epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm. Message-ID: <201501091045.t09Ajg9P004656@svn01.web.mwc.hst.phx2.redhat.com> Author: mputz Date: 2015-01-09 05:45:42 -0500 (Fri, 09 Jan 2015) New Revision: 9331 Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java Log: Backport fixes related to GTNPORTAL-3110 Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java 2015-01-09 10:00:30 UTC (rev 9330) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java 2015-01-09 10:45:42 UTC (rev 9331) @@ -25,6 +25,7 @@ import org.gatein.common.logging.Logger; import org.gatein.common.logging.LoggerFactory; +import org.picketlink.idm.api.IdentitySession; import javax.transaction.Status; import javax.transaction.UserTransaction; @@ -71,4 +72,8 @@ orgService.recoverFromIDMError(); } } + + protected IdentitySession getIdentitySession() throws Exception { + return service_.getIdentitySession(); + } } Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2015-01-09 10:00:30 UTC (rev 9330) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2015-01-09 10:45:42 UTC (rev 9331) @@ -1090,11 +1090,6 @@ return jbidGroup; } - private IdentitySession getIdentitySession() throws Exception - { - return service_.getIdentitySession(); - } - private IntegrationCache getIntegrationCache() { // TODO: refactor to remove cast. For now to avoid adding new config option and share existing cache instannce Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2015-01-09 10:00:30 UTC (rev 9330) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2015-01-09 10:45:42 UTC (rev 9331) @@ -1026,11 +1026,6 @@ } } - private IdentitySession getIdentitySession() throws Exception - { - return service_.getIdentitySession(); - } - private String getGroupNameFromId(String groupId) { String[] ids = groupId.split("/"); Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2015-01-09 10:00:30 UTC (rev 9330) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2015-01-09 10:45:42 UTC (rev 9331) @@ -112,8 +112,12 @@ preSave(mt, true); } - getIdentitySession().getRoleManager().createRoleType(mt.getName()); - + try { + getIdentitySession().getRoleManager().createRoleType(mt.getName()); + } catch (Exception e) { + handleException("Error when creating Membership", e); + } + if (broadcast) { postSave(mt, true); @@ -171,7 +175,12 @@ ); } - RoleType rt = getIdentitySession().getRoleManager().getRoleType(name); + RoleType rt = null; + try { + rt = getIdentitySession().getRoleManager().getRoleType(name); + } catch (Exception e) { + handleException("Identity error when finding membership type " + name, e); + } MembershipType mt = null; @@ -219,8 +228,12 @@ preDelete(mt); } - getIdentitySession().getRoleManager().removeRoleType(mt.getName()); - + try { + getIdentitySession().getRoleManager().removeRoleType(mt.getName()); + } catch (Exception e) { + handleException("Error occured when removing membership type", e); + } + if (broadcast) { postDelete(mt); @@ -244,8 +257,14 @@ ); } - Collection rts = getIdentitySession().getRoleManager().findRoleTypes(); - + Collection rts; + try { + rts = getIdentitySession().getRoleManager().findRoleTypes(); + } catch (Exception e) { + handleException("Exception occured when looking for membership types", e); + rts = new LinkedList(); + } + List mts = new LinkedList(); for (RoleType rt : rts) @@ -268,16 +287,15 @@ return mts; } - private IdentitySession getIdentitySession() throws Exception - { - return service_.getIdentitySession(); - } + private void updateMembershipType(MembershipType mt) throws Exception { + RoleType rt; + try { + rt = getIdentitySession().getRoleManager().getRoleType(mt.getName()); + } catch (Exception e) { + handleException("Exception occured when finding role type", e); + return; + } - private void updateMembershipType(MembershipType mt) throws Exception - { - - RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName()); - Map props = new HashMap(); props.put(MEMBERSHIP_DESCRIPTION, mt.getDescription()); @@ -286,7 +304,11 @@ .put(MEMBERSHIP_MODIFIED_DATE, mt.getModifiedDate() == null ? null : "" + mt.getModifiedDate().getTime()); props.put(MEMBERSHIP_OWNER, mt.getOwner()); - getIdentitySession().getRoleManager().setProperties(rt, props); + try { + getIdentitySession().getRoleManager().setProperties(rt, props); + } catch (Exception e) { + handleException("Exception when updating membership type", e); + } return; @@ -294,10 +316,15 @@ private void populateMembershipType(MembershipType mt) throws Exception { - RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName()); + Map props; + try { + RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName()); + props = getIdentitySession().getRoleManager().getProperties(rt); + } catch (Exception e) { + handleException("Identity error occured when populating membership type", e); + return; + } - Map props = getIdentitySession().getRoleManager().getProperties(rt); - mt.setDescription(props.get(MEMBERSHIP_DESCRIPTION)); mt.setOwner(props.get(MEMBERSHIP_OWNER)); Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2015-01-09 10:00:30 UTC (rev 9330) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2015-01-09 10:45:42 UTC (rev 9331) @@ -157,7 +157,7 @@ session.getPersistenceManager().createUser(user.getUserName()); } - catch (IdentityException e) + catch (Exception e) { handleException("Identity operation error: ", e); @@ -233,7 +233,7 @@ foundUser = session.getPersistenceManager().findUser(userName); } - catch (IdentityException e) + catch (Exception e) { handleException("Cannot obtain user: " + userName + "; ", e); @@ -267,7 +267,7 @@ { session.getPersistenceManager().removeUser(foundUser, true); } - catch (IdentityException e) + catch (Exception e) { handleException("Cannot remove user: " + userName + "; ", e); @@ -608,7 +608,7 @@ plUser = session.getAttributesManager().findUserByUniqueAttribute(USER_EMAIL, email); } - catch (IdentityException e) + catch (Exception e) { handleException("Cannot find user by email: " + email + "; ", e ); @@ -766,7 +766,7 @@ { am.updatePassword(session.getPersistenceManager().findUser(user.getUserName()), user.getPassword()); } - catch (IdentityException e) + catch (Exception e) { handleException("Cannot update password: " + user.getUserName() + "; ", e); @@ -781,7 +781,7 @@ { am.updateAttributes(user.getUserName(), attrs); } - catch (IdentityException e) + catch (Exception e) { handleException("Cannot update attributes for user: " + user.getUserName() + "; ", e); @@ -799,7 +799,7 @@ { u = session.getPersistenceManager().findUser(userName); } - catch (IdentityException e) + catch (Exception e) { handleException("Cannot obtain user: " + userName + "; ", e); @@ -830,7 +830,7 @@ { attrs = am.getAttributes(new SimpleUser(user.getUserName())); } - catch (IdentityException e) + catch (Exception e) { handleException("Cannot obtain attributes for user: " + user.getUserName() + "; ", e); @@ -957,7 +957,7 @@ am.removeAttributes(user.getUserName(), new String[] { USER_DISPLAY_NAME }); } } - catch (IdentityException e) + catch (Exception e) { handleException("Cannot remove displayName attribute of user: " + user.getUserName() + "; ", e); } Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2015-01-09 10:00:30 UTC (rev 9330) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2015-01-09 10:45:42 UTC (rev 9331) @@ -337,8 +337,4 @@ } } - private IdentitySession getIdentitySession() throws Exception - { - return service_.getIdentitySession(); - } } From do-not-reply at jboss.org Fri Jan 9 05:52:38 2015 From: do-not-reply at jboss.org (do-not-reply at jboss.org) Date: Fri, 9 Jan 2015 05:52:38 -0500 Subject: [gatein-commits] gatein SVN: r9332 - epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm. Message-ID: <201501091052.t09AqchN005538@svn01.web.mwc.hst.phx2.redhat.com> Author: mputz Date: 2015-01-09 05:52:38 -0500 (Fri, 09 Jan 2015) New Revision: 9332 Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java Log: Backport fixes related to GTNPORTAL-3572 Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2015-01-09 10:45:42 UTC (rev 9331) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2015-01-09 10:52:38 UTC (rev 9332) @@ -157,9 +157,14 @@ if (isCreateMembership(mt.getName())) { - if (getIdentitySession().getRoleManager().getRoleType(mt.getName()) == null) - { - getIdentitySession().getRoleManager().createRoleType(mt.getName()); + if (getIdentitySession().getRoleManager().getRoleType(mt.getName()) == null) { + try { + getIdentitySession().getRoleManager().createRoleType(mt.getName()); + } catch (Exception e) { + // TODO: + handleException("Identity operation error: ", e); + + } } @@ -184,8 +189,14 @@ preSave(membership, true); } - getIdentitySession().getRoleManager().createRole(mt.getName(), user.getUserName(), groupId); + try { + getIdentitySession().getRoleManager().createRole(mt.getName(), user.getUserName(), groupId); + } catch (Exception e) { + // TODO: + handleException("Identity operation error: ", e); + } + if (broadcast) { postSave(membership, true); @@ -421,8 +432,14 @@ preDelete(m); } - getIdentitySession().getRoleManager().removeRole(role); + try { + getIdentitySession().getRoleManager().removeRole(role); + } catch (Exception e) { + // TODO: + handleException("Identity operation error: ", e); + } + if (broadcast) { postDelete(m); @@ -770,8 +787,16 @@ public ListAccess findAllMembershipsByUser(User user) throws Exception { - org.picketlink.idm.api.User gtnUser = service_.getIdentitySession().getPersistenceManager().findUser(user.getUserName()); - + org.picketlink.idm.api.User gtnUser = null; + try { + gtnUser = service_.getIdentitySession().getPersistenceManager() + .findUser(user.getUserName()); + } catch (Exception e) { + // TODO: + handleException("Identity operation error: ", e); + + } + if (gtnUser == null) { log.log(LogLevel.ERROR, "Internal ERROR. Cannot obtain user: " + user.getUserName()); From do-not-reply at jboss.org Fri Jan 9 06:37:46 2015 From: do-not-reply at jboss.org (do-not-reply at jboss.org) Date: Fri, 9 Jan 2015 06:37:46 -0500 Subject: [gatein-commits] gatein SVN: r9333 - epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm. Message-ID: <201501091137.t09Bbk4K013185@svn01.web.mwc.hst.phx2.redhat.com> Author: mputz Date: 2015-01-09 06:37:46 -0500 (Fri, 09 Jan 2015) New Revision: 9333 Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java Log: Backport fixes related to GTNPORTAL-3243 Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java 2015-01-09 10:52:38 UTC (rev 9332) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java 2015-01-09 11:37:46 UTC (rev 9333) @@ -69,7 +69,7 @@ log.warn("Unable to set Transaction status to be rollback only", tre); } } else { - orgService.recoverFromIDMError(); + orgService.recoverFromIDMError(e); } } Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2015-01-09 10:52:38 UTC (rev 9332) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2015-01-09 11:37:46 UTC (rev 9333) @@ -174,83 +174,60 @@ } - public void flush() - { - try - { - - - if (configuration.isUseJTA()) - { - if (traceLoggingEnabled) - { - log.trace("Flushing UserTransaction in method flush"); + public void flush() { + 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) + // 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 (getUserTransaction().getStatus() == Status.STATUS_ACTIVE) - { - idmService_.getIdentitySession().save(); + try { + if (getUserTransaction().getStatus() == Status.STATUS_ACTIVE) { + idmService_.getIdentitySession().save(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); } - } - else - { - if (idmService_.getIdentitySession().getTransaction().isActive()) - { - try { - if (idmService_.getIdentitySession().getTransaction().isActive()) { - idmService_.getIdentitySession().save(); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - recoverFromIDMError(); - } + } else { + try { + if (idmService_.getIdentitySession().getTransaction().isActive()) { + idmService_.getIdentitySession().save(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + recoverFromIDMError(e); } - } + } + } - } - catch (Exception e) - { - log.error(e.getMessage(), e); - } - } - - - public void endRequest(ExoContainer container) - { - try - { - if (configuration.isUseJTA()) - { - if (traceLoggingEnabled) - { - log.trace("Finishing UserTransaction in method endRequest"); + public void endRequest(ExoContainer container) { + if (configuration.isUseJTA()) { + if (traceLoggingEnabled) { + log.trace("Finishing UserTransaction in method endRequest"); } - finishJTATransaction(); - } - else - { try { - if (idmService_.getIdentitySession().getTransaction().isActive()) { - idmService_.getIdentitySession().getTransaction().commit(); - } + finishJTATransaction(); } catch (Exception e) { - log.error(e.getMessage(), e); - recoverFromIDMError(); + log.error(e.getMessage(), e); } - } - } - catch (Exception e) - { - log.error(e.getMessage(), e); - } - } + } else { + try { + if (idmService_.getIdentitySession().getTransaction().isActive()) { + idmService_.getIdentitySession().getTransaction().commit(); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + recoverFromIDMError(e); + } + } + } // Should be used only for non-JTA environment - public void recoverFromIDMError() { + public void recoverFromIDMError(Exception e) { try { // We need to restart Hibernate transaction if it's available. First rollback old one and then start new one Transaction idmTransaction = idmService_.getIdentitySession().getTransaction(); From do-not-reply at jboss.org Mon Jan 12 04:05:54 2015 From: do-not-reply at jboss.org (do-not-reply at jboss.org) Date: Mon, 12 Jan 2015 04:05:54 -0500 Subject: [gatein-commits] gatein SVN: r9334 - epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm. Message-ID: <201501120905.t0C95sZE012293@svn01.web.mwc.hst.phx2.redhat.com> Author: mputz Date: 2015-01-12 04:05:53 -0500 (Mon, 12 Jan 2015) New Revision: 9334 Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java Log: GTNPORTAL-3572: Add exception handling Modified: epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java =================================================================== --- epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2015-01-09 11:37:46 UTC (rev 9333) +++ epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2015-01-12 09:05:53 UTC (rev 9334) @@ -176,7 +176,13 @@ if (isAssociationMapped() && getAssociationMapping().equals(mt.getName())) { - getIdentitySession().getRelationshipManager().associateUserByKeys(groupId, user.getUserName()); + try { + getIdentitySession().getRelationshipManager().associateUserByKeys(groupId, user.getUserName()); + } catch (Exception e) { + // TODO: + handleException("Identity operation error: ", e); + + } } MembershipImpl membership = new MembershipImpl();