Uploaded image for project: 'appNG'
  1. appNG
  2. APPNG-2067

Duplicate role

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.16.0
    • Component/s: appng-appngizer
    • Labels:
      None

      Description

      If we try to create a role, which already exist, an exception is thrown, which is ok. Problem is the duplicate role is nonetheless created:

      <?xml version='1.0' encoding='UTF-8'?>
      <roles>
        <role name="Platform Administrator" self="http://127.0.0.1:8180/appNGizer/application/appng-manager/role/Platform%20Administrator">
          <application>appng-manager</application>
          <description>Administrator with all permissions</description>
        </role>
        <role name="User Manager" self="http://127.0.0.1:8180/appNGizer/application/appng-manager/role/User%20Manager">
          <application>appng-manager</application>
          <description>A role for managing groups,users and roles with their permissions</description>
        </role>
        <role name="Site Manager" self="http://127.0.0.1:8180/appNGizer/application/appng-manager/role/Site%20Manager">
          <application>appng-manager</application>
          <description/>
        </role>
        <role name="Debugger" self="http://127.0.0.1:8180/appNGizer/application/appng-manager/role/Debugger">
          <application>appng-manager</application>
          <description>Enables debugging output</description>
        </role>
        <role name="Tester" self="http://127.0.0.1:8180/appNGizer/application/appng-manager/role/Tester">
          <application>appng-manager</application>
          <description>test_description</description>
        </role>
        <role name="Tester" self="http://127.0.0.1:8180/appNGizer/application/appng-manager/role/Tester">
          <application>appng-manager</application>
          <description>test_description</description>
        </role>
      </roles>
      
      appngizer.errors.HttpServerError: 500 - Server error (http://127.0.0.1:8180/appNGizer/application/appng-manager/role/): org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2
      	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
      	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
      	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      	org.appng.appngizer.controller.SessionFilter.doFilter(SessionFilter.java:53)
       org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2
      	org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:395)
      	org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:489)
      	org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
      	org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
      	org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
      	com.sun.proxy.$Proxy69.findByApplicationNameAndName(Unknown Source)
      	org.appng.core.service.CoreService.getApplicationRoleForApplication(CoreService.java:1876)
      	org.appng.core.service.CoreService$$FastClassBySpringCGLIB$$4bccbf8c.invoke(<generated>)
      	org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      	org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      	org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      	org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
      	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
      	org.appng.core.service.CoreService$$EnhancerBySpringCGLIB$$3b41bd82.getApplicationRoleForApplication(<generated>)
      	org.appng.appngizer.controller.RoleController.getRole(RoleController.java:61)
      	org.appng.appngizer.controller.RoleController.createRole(RoleController.java:81)
      	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	java.lang.reflect.Method.invoke(Method.java:498)
      	org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
      	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
      	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
      	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
      	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
      	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
      	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
      	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
      	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
      	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
      	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      	org.appng.appngizer.controller.SessionFilter.doFilter(SessionFilter.java:53)
       javax.persistence.NonUniqueResultException: query did not return a unique result: 2
      	org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:123)
      	org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157)
      	org.hibernate.query.internal.AbstractProducedQuery.getSingleResult(AbstractProducedQuery.java:1471)
      	org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getSingleResult(CriteriaQueryTypeQueryAdapter.java:107)
      	org.springframework.data.jpa.repository.query.JpaQueryExecution$SingleEntityExecution.doExecute(JpaQueryExecution.java:208)
      	org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:87)
      	org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:116)
      	org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:106)
      	org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:483)
      	org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      	org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
      	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
      	com.sun.proxy.$Proxy69.findByApplicationNameAndName(Unknown Source)
      	org.appng.core.service.CoreService.getApplicationRoleForApplication(CoreService.java:1876)
      	org.appng.core.service.CoreService$$FastClassBySpringCGLIB$$4bccbf8c.invoke(<generated>)
      	org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      	org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      	org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      	org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
      	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      	org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
      	org.appng.core.service.CoreService$$EnhancerBySpringCGLIB$$3b41bd82.getApplicationRoleForApplication(<generated>)
      	org.appng.appngizer.controller.RoleController.getRole(RoleController.java:61)
      	org.appng.appngizer.controller.RoleController.createRole(RoleController.java:81)
      	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	java.lang.reflect.Method.invoke(Method.java:498)
      	org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
      	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
      	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
      	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
      	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
      	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
      	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
      	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
      	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
      	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
      	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      	org.appng.appngizer.controller.SessionFilter.doFilter(SessionFilter.java:53)
      

        Attachments

          Activity

            People

            • Assignee:
              pritzel.bjoern Bjoern Pritzel
              Reporter:
              pritzel.bjoern Bjoern Pritzel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: