Bug 858282 - Globally uncaught exception when creating duplicate role
Summary: Globally uncaught exception when creating duplicate role
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server, Core UI, Usability
Version: 4.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHQ 4.6
Assignee: Jirka Kremser
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-18 14:39 UTC by Filip Brychta
Modified: 2013-08-31 10:16 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-31 10:16:18 UTC
Embargoed:


Attachments (Terms of Use)
CLI script with reproduction steps (298 bytes, application/javascript)
2013-02-01 12:42 UTC, Filip Brychta
no flags Details

Description Filip Brychta 2012-09-18 14:39:38 UTC
Description of problem:
$Summary

Version-Release number of selected component (if applicable):
Version: 4.5.0-SNAPSHOT
Build Number: 6c45114

How reproducible:
Always

Steps to Reproduce:
1. create some new role (Administration->Roles->new)
2. create the same role again

  
Actual results:
Globally uncaught exception:
ERROR: duplicate key value violates unique constraint "rhq_role_name_key" Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
Detail :	

java.lang.RuntimeException:java.lang.RuntimeException: [1347978546494] java.lang.RuntimeException:javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.transaction.RollbackException:[com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.persistence.EntityExistsException:org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update -> org.hibernate.exception.ConstraintViolationException:Could not execute JDBC batch update -> java.sql.BatchUpdateException:Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause.[SQLException=Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause. -> ERROR: duplicate key value violates unique constraint "rhq_role_name_key"
  Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
   java.lang.RuntimeException:[1347978546494] java.lang.RuntimeException:javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.transaction.RollbackException:[com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.persistence.EntityExistsException:org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update -> org.hibernate.exception.ConstraintViolationException:Could not execute JDBC batch update -> java.sql.BatchUpdateException:Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause.[SQLException=Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause. -> ERROR: duplicate key value violates unique constraint "rhq_role_name_key"
  Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
--- STACK TRACE FOLLOWS ---
java.lang.RuntimeException: [1347978546494] java.lang.RuntimeException:javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.transaction.RollbackException:[com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.persistence.EntityExistsException:org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update -> org.hibernate.exception.ConstraintViolationException:Could not execute JDBC batch update -> java.sql.BatchUpdateException:Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause.[SQLException=Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause. -> ERROR: duplicate key value violates unique constraint "rhq_role_name_key"
  Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
Caused by: java.lang.RuntimeException: [1347978546494] java.lang.RuntimeException:javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.transaction.RollbackException:[com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.persistence.EntityExistsException:org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update -> org.hibernate.exception.ConstraintViolationException:Could not execute JDBC batch update -> java.sql.BatchUpdateException:Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause.[SQLException=Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause. -> ERROR: duplicate key value violates unique constraint "rhq_role_name_key"
  Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)


Expected results:
Some more user friendly notification

Comment 1 Jirka Kremser 2012-09-26 10:26:08 UTC
The same applies to the creating duplicate user.

Comment 2 Jirka Kremser 2012-09-27 12:12:53 UTC
http://git.fedorahosted.org/cgit/rhq/rhq.git/diff/?id=dad120d

fixed in master
time:    Thu Sep 27 14:06:14 2012 +0200
commit:  dad120db6d26c739b47b841cc0b43028a255073c
author:  Jirka Kremser - jkremser
message: [BZ 858282 - Globally uncaught exception when creating duplicate role] If rhq_role_name_key db constraint is violated, more informative message is returned to the client. Instead of "Globally uncaught exception..." with db implementation details. The same thing for user creation.

Comment 3 Armine Hovsepyan 2012-11-21 12:29:18 UTC
verified in rhq master (4.6)

Globally uncaught exception is removed and replaced with correct exception text, and the exception is shown in server log.

Comment 4 Filip Brychta 2013-02-01 12:41:48 UTC
Still not working on 
Version: 4.6.0-SNAPSHOT
Build Number: a74896a

Globally uncaught exception is still there.

Adding CLI script which does the repro steps.
Please check the exception thrown by CLI client as well. There is no explaining message at all.

Comment 5 Filip Brychta 2013-02-01 12:42:14 UTC
Created attachment 691573 [details]
CLI script with reproduction steps

Comment 6 Jirka Kremser 2013-02-01 13:05:31 UTC
fixed in master
http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=af0936f97

time:    Fri Feb 1 14:02:40 2013 +0100
commit:  af0936f97b11698157731942134e181db6e11af6
author:  Jirka Kremser - jkremser
message: [BZ 858282 - Globally uncaught exception when creating duplicate role] RoleManager now explicitly checks whether the role with the same name already exists (without trying to create the role first and then catching the exception like it was done before).


As a consequence of this commit, the CLI now prints nicely the real cause of the problem as well.

Comment 7 Filip Brychta 2013-02-07 15:25:02 UTC
Verified on 
Version: 4.6.0-SNAPSHOT
Build Number: 73a33d5

Verified for both GUI and CLI

Comment 8 Heiko W. Rupp 2013-08-31 10:16:18 UTC
Bulk close of old bugs in VERIFIED state.


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