Bug 973039 - Inconsistent exception handling in IDM DAO layer
Summary: Inconsistent exception handling in IDM DAO layer
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise Portal Platform 6
Classification: JBoss
Component: Portal
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ER02
: 6.1.0
Assignee: Nobody
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-11 06:57 UTC by Martin Weiler
Modified: 2020-04-27 01:33 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: In releases prior to JPP 6.1 some exceptions thrown from IDM were not correctly handled in JPP. Especially we sometimes did not perform rollback of Hibernate transaction in case of Hibernate error, which could lead to inconsistent state and incorrect behaviour. Fix: Currently all fixes thrown by IDM layer are correctly handled and logged and we are always perform rollback of DB transaction in both non-JTA and JTA configuration
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker GTNPORTAL-2928 0 Major Resolved Attempt to save very long property of UserProfile breaks whole database 2016-01-19 09:43:26 UTC
Red Hat Issue Tracker GTNPORTAL-3110 0 Major Resolved IDM DAO classes are only catching IdentityExceptions 2016-01-19 09:43:26 UTC

Description Martin Weiler 2013-06-11 06:57:39 UTC
Description of problem:
Exception handling in the IDM DAO layer is inconsistent/incomplete:
* GTNPORTAL-2928: Exceptions are swallowed completely
* GTNPORTAL-3110: Exception handling is inconsistent

How reproducible:
Always

Steps to Reproduce:
1. IDM operation fails with an error (eg. Hibernate exception, database exception) in, for example, UserDAOImpl.authenticate(..) method when the lastLoginTime attribute is saved for the user
2. An exception is thrown:

ERROR [org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl]  ORA-00001: unique constraint (PORTAL_IDM_OWNER.JBID_IO_ATTR_TEXT_VALUES_PK) violated
: org.hibernate.exception.ConstraintViolationException: ORA-00001: unique constraint (PORTAL_IDM_OWNER.JBID_IO_ATTR_TEXT_VALUES_PK) violated
...
        at org.exoplatform.services.organization.auth.OrganizationAuthenticatorImpl.validateUser(OrganizationAuthenticatorImpl.java:152) [exo.core.component.organization.api-2.5.1-CP01-redhat-1.jar:2.5.1-CP01-redhat-1]
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (PORTAL_IDM_OWNER.JBID_IO_ATTR_TEXT_VALUES_PK) violated

3. Every IDM operation that happens afterwards on the same thread is failing:

INFO  [org.exoplatform.services.organization.idm.UserDAOImpl]  Cannot obtain user: user1; : org.picketlink.idm.common.exception.IdentityException: Cannot obtain Hibernate Session
...
Caused by: org.hibernate.TransactionException: nested transactions not supported
        at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:152) [hibernate-core-4.1.6.Final-redhat-3.jar:4.1.6.Final-redhat-3]
        at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreSessionImpl.startHibernateTransaction(HibernateIdentityStoreSessionImpl.java:207) [picketlink-idm-hibernate-1.4.1.Final-redhat-1.jar:1.4.1.Final-redhat-1]
        at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreSessionImpl.startHibernateTransactionIfNotStartedYet(HibernateIdentityStoreSessionImpl.java:195) [picketlink-idm-hibernate-1.4.1.Final-redhat-1.jar:1.4.1.Final-redhat-1]
        at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.getHibernateSession(HibernateIdentityStoreImpl.java:2786) [picketlink-idm-hibernate-1.4.1.Final-redhat-1.jar:1.4.1.Final-redhat-1]

Actual results:
Exception is not handled correctly, causing the transaction status captured in HibernateIdentityStoreSessionImpl.hibernateTxStatus ThreadLocal to be wrong, which affects all subsequent operations on the same thread.


Expected results:
Exception is handled correctly, not affecting further IDM operations on the same thread.


Additional info:

Comment 1 Tomas Kyjovsky 2013-08-13 15:53:56 UTC
Verified in 6.1.0.ER02.


Note You need to log in before you can comment on or make changes to this bug.