Spring Social
  1. Spring Social
  2. SOCIAL-341

exception thrown from getPrimaryConnection() if connection 1 is removed

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 1.1.0.M3
    • Component/s: Connection Core
    • Labels:
      None

      Description

      Here is a test case for class JdbcUsersConnectionRepositoryTest

      @Test
      public void findPrimaryConnectionAfterRemove() {
          insertFacebookConnection();
          insertFacebookConnection2();    
          // 9 is the providerUserId of the first Facebook connection
          connectionRepository.removeConnection(new ConnectionKey("facebook", "9"));
          assertEquals(1, connectionRepository.findConnections(TestFacebookApi.class).size());
          assertNotNull(connectionRepository.findPrimaryConnection(TestFacebookApi.class));
      }
      

        Activity

        Hide
        Craig Walls added a comment -

        The problem was that it was explicitly selecting the connection where rank=1. If that connection is removed, then there is nothing to return. One option is to re-rank the remaining connections on delete, but that would be too costly performance-wise. A simpler solution (the one that fixes this issue) is to simply select all connections, ordering by rank and taking the first one returned.

        Show
        Craig Walls added a comment - The problem was that it was explicitly selecting the connection where rank=1. If that connection is removed, then there is nothing to return. One option is to re-rank the remaining connections on delete, but that would be too costly performance-wise. A simpler solution (the one that fixes this issue) is to simply select all connections, ordering by rank and taking the first one returned.

          People

          • Assignee:
            Craig Walls
            Reporter:
            Nicolas Griso
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: