Uploaded image for project: 'AdMaxLocal'
  1. AdMaxLocal
  2. AML-3939

On duplicate clientID, it throws DuplicateKeyException!

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Apollo
    • Fix Version/s: Apollo
    • Component/s: API
    • Labels:
      None
    • Environment:

      aml-oauth-provider-1.0.0-20160107.162818-97.war
      qos-service-1.0.0-20160107.162847-36.war

    • Sprint:
      Sprint 9

      Description

      If user enters duplicate clientID, it shows message,"There was a problem.."

      Please see attached screenshot.

      Snippet of tomcat log:

      ----------------------------
      ID: 12
      Address: http://localhost:9933/aml-oauth-provider/rest/client-management/testing05
      Encoding: UTF-8
      Http-Method: PUT
      Content-Type: application/json; charset=UTF-8
      Headers:

      {Accept=[application/json, text/javascript, */*; q=0.01], accept-encoding=[gzip, deflate], accept-language=[en-US,en;q=0.5], connection=[Keep-Alive], Content-Length=[87], content-type=[application/json; charset=UTF-8], cookie=[JSESSIONID=E1008D06C07C11F16FE602482AEB1B5C], host=[localhost:9933], referer=[http://localhost:9933/aml-oauth-provider/], user-agent=[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0], x-csrf-token=[a114739f-f380-4c23-afc5-30e7eedd5408], x-forwarded-host=[localhost:9933], x-forwarded-server=[2001:4800:7811:513:dd9d:596:ff04:a1a7], x-requested-with=[XMLHttpRequest]}

      Payload:

      {"clientId":"testing05","clientSecret":"","scopes":["read","write"],"refreshTokens":[]}

      --------------------------------------
      2016-01-11 11:47:41 WARN org.apache.cxf.phase.PhaseInterceptorChain:452 - tsa.amlproduct.qa@gmail.com REALM_qa2, ROLE_USER - Application

      {http://cxf.services.provider.oauth2.admaxlocal.com/}

      UserService has thrown exception, unwinding now
      org.apache.cxf.interceptor.Fault: PreparedStatementCallback; SQL [INSERT INTO oauth_client_details VALUES (?,'aml-external-api',?,?,'password,refresh_token',NULL,?,3600,200000000,NULL,NULL)]; Duplicate entry 'qa2-testing05' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'qa2-testing05' for key 'PRIMARY'
      at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:163)
      at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:129)
      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)
      at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
      at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
      at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)
      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
      at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:229)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.admaxlocal.oauth2.provider.LoggingContextFilter.doFilter(LoggingContextFilter.java:50)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
      at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      .
      .
      ..
      aused by: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO oauth_client_details VALUES (?,'aml-external-api',?,?,'password,refresh_token',NULL,?,3600,200000000,NULL,NULL)]; Duplicate entry 'qa2-testing05' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'qa2-testing05' for key 'PRIMARY'
      at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:660)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:909)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:970)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:980)
      at com.admaxlocal.oauth2.provider.dao.ClientIdDao.createClientId(ClientIdDao.java:27)
      at com.admaxlocal.oauth2.provider.services.cxf.ClientIdService.createClientId(ClientIdService.java:99)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:181)
      at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:97)
      ... 72 more
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'qa2-testing05' for key 'PRIMARY'
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:532)

      Tomcat log attached.

      Expected Result:

      UI should show message , " Duplicate client ID ***"

        Attachments

        1. ClientUserManagement01.png
          18 kB
          Atul Sanagar
        2. DuplicateClientID01.txt
          38 kB
          Atul Sanagar
        3. DuplicateMsg.jpg
          71 kB
          Anil Kumar Halmadgi

          Activity

            People

            • Assignee:
              anil.kumar Anil Kumar Halmadgi
              Reporter:
              atul.sanagar Atul Sanagar (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: