Uploaded image for project: 'JCommune'
  1. JCommune
  2. JC-1989

Profile: Error 500 is shown on changing e-mail to email of not activated user

    Details

    • Sprint:
      3.2 Larks

      Description

      Steps to reproduce:
      1. Log in to system
      2. Go to your User Profile page
      3. Change e-mail to 'mail@mail.ru'

      Actual result: Error 500
      Expected result Error pop-up message: User with the email already exists.

      Additional info: User Test has email 'mail@mail.ru' and id = 3135, this user is not activated
      Page http://qa.jtalks.org/jcommune/users/3135 not found (404)

        Attachments

          Issue Links

            Activity

            Hide
            ctapobep Stanislav Bashkyrtsev added a comment -

            Samoylov Sergey, could you please attach a part of log with the exception during error 500 so that Nayil could find out what's wrong?

            Show
            ctapobep Stanislav Bashkyrtsev added a comment - Samoylov Sergey , could you please attach a part of log with the exception during error 500 so that Nayil could find out what's wrong?
            Hide
            Sergey Samoylov Sergey added a comment -

            Nayil, please take a look to logs:

            2015-09-15 11:06:32 [DEBUG][-bio-8070-exec-1][The Noise][org.jtalks.jcommune.service.transactional.TransactionalUserService] - Check permission to edit own profile for user - 4799
            2015-09-15 11:06:32 [INFO ][-bio-8070-exec-1][The Noise][org.jtalks.jcommune.service.transactional.TransactionalUserService] - Updated user profile. Username: The Noise
            2015-09-15 11:06:32 [WARN ][-bio-8070-exec-1][The Noise][org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1062, SQLState: 23000
            2015-09-15 11:06:32 [ERROR][-bio-8070-exec-1][The Noise][org.hibernate.util.JDBCExceptionReporter] - Duplicate entry 'mail@mail.ru' for key 'EMAIL'
            2015-09-15 11:06:32 [WARN ][-bio-8070-exec-1][The Noise][           org.jtalks.jcommune] - Handler execution resulted in exception
            org.springframework.dao.DataIntegrityViolationException: could not update: [org.jtalks.jcommune.model.entity.JCUser#4799]; SQL [update USERS set VERSION=?, UUID=?, FIRST_NAME=?, LAST_NAME=?, USERNAME=?, ENCODED_USERNAME=?, EMAIL=?, PASSWORD=?, LAST_LOGIN=?, AVATAR=?, ENABLED=? where ID=? and VERSION=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not update: [org.jtalks.jcommune.model.entity.JCUser#4799]
             at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:643)
             at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:794)
             at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:665)
             at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755)
             at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
             at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475)
            
            ...
            
            2015-09-15 11:06:32 [DEBUG][-bio-8070-exec-1][The Noise][org.jtalks.jcommune.web.exception.PrettyLogExceptionResolver] - Resolving to default view 'redirect:/errors/500' for exception of type [org.springframework.dao.DataIntegrityViolationException]

            I think it'd be better to reopen the task.

            Show
            Sergey Samoylov Sergey added a comment - Nayil , please take a look to logs: 2015-09-15 11:06:32 [DEBUG][-bio-8070-exec-1][The Noise][org.jtalks.jcommune.service.transactional.TransactionalUserService] - Check permission to edit own profile for user - 4799 2015-09-15 11:06:32 [INFO ][-bio-8070-exec-1][The Noise][org.jtalks.jcommune.service.transactional.TransactionalUserService] - Updated user profile. Username: The Noise 2015-09-15 11:06:32 [WARN ][-bio-8070-exec-1][The Noise][org.hibernate.util.JDBCExceptionReporter] - SQL Error: 1062, SQLState: 23000 2015-09-15 11:06:32 [ERROR][-bio-8070-exec-1][The Noise][org.hibernate.util.JDBCExceptionReporter] - Duplicate entry 'mail@mail.ru' for key 'EMAIL' 2015-09-15 11:06:32 [WARN ][-bio-8070-exec-1][The Noise][ org.jtalks.jcommune] - Handler execution resulted in exception org.springframework.dao.DataIntegrityViolationException: could not update: [org.jtalks.jcommune.model.entity.JCUser#4799]; SQL [update USERS set VERSION=?, UUID=?, FIRST_NAME=?, LAST_NAME=?, USERNAME=?, ENCODED_USERNAME=?, EMAIL=?, PASSWORD=?, LAST_LOGIN=?, AVATAR=?, ENABLED=? where ID=? and VERSION=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not update: [org.jtalks.jcommune.model.entity.JCUser#4799] at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:643) at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:794) at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:665) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475) ... 2015-09-15 11:06:32 [DEBUG][-bio-8070-exec-1][The Noise][org.jtalks.jcommune.web.exception.PrettyLogExceptionResolver] - Resolving to default view 'redirect:/errors/500' for exception of type [org.springframework.dao.DataIntegrityViolationException] I think it'd be better to reopen the task.
            Hide
            res Nayil added a comment -

            This issue is reproduced only when account does not have entry in the table JC_USER_DETAILS. I contunue investigation.

            Show
            res Nayil added a comment - This issue is reproduced only when account does not have entry in the table JC_USER_DETAILS. I contunue investigation.
            Hide
            res Nayil added a comment -

            This issue is reproduced only when the account does not have entry in the table JC_USER_DETAILS.
            Suppose we try to replace the EMAIL of a current user (User1) with the EMAIL of another user (User2) who does not have record in the table JC_USER_DETAILS.
            At that moment the method of validatation "ChangedEmailValidator.isValid()" starts to validate the new EMAIL.
            The following operator "userWithTheSameChangedEmailExists = userDao.getByEmail(changedEmail) != null;" return false because "userDao.getByEmail(changedEmail)"
            peform query like
            "... from user u
            inner join jc_user_details jc_u on u.ID = jc_u.USER_ID ..."

            afterwards "update" record for User1 occurs. But this column(EMAIL) has a constraint - no duplicate entry, so we have Exception and it becomes the “error page”.

            Show
            res Nayil added a comment - This issue is reproduced only when the account does not have entry in the table JC_USER_DETAILS. Suppose we try to replace the EMAIL of a current user (User1) with the EMAIL of another user (User2) who does not have record in the table JC_USER_DETAILS. At that moment the method of validatation "ChangedEmailValidator.isValid()" starts to validate the new EMAIL. The following operator "userWithTheSameChangedEmailExists = userDao.getByEmail(changedEmail) != null;" return false because "userDao.getByEmail(changedEmail)" peform query like "... from user u inner join jc_user_details jc_u on u.ID = jc_u.USER_ID ..." afterwards "update" record for User1 occurs. But this column(EMAIL) has a constraint - no duplicate entry, so we have Exception and it becomes the “error page”.
            Hide
            ctapobep Stanislav Bashkyrtsev added a comment -

            The task is to stay on hold until we separate Poulpe and JC databases.

            Show
            ctapobep Stanislav Bashkyrtsev added a comment - The task is to stay on hold until we separate Poulpe and JC databases.

              People

              • Assignee:
                Unassigned
                Reporter:
                terracott Denis Kajgorodov
              • Votes:
                0 Vote for this issue
                Watchers:
                Start watching this issue

                Dates

                • Created:
                  Updated:

                  Structure Helper Panel