Uploaded image for project: 'Kuali Rice Development'
  1. Kuali Rice Development
  2. KULRICE-4047

UIDocumentServiceImpl.getMember() can return null but is not handled

    Details

    • Type: Bug Fix
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: KC Release 2.0, 1.0.2
    • Fix Version/s: KC Release 2.0, 1.0.2
    • Component/s: Development
    • Labels:
      None
    • Rice Module:
      KIM
    • Application Requirement:
      KC

      Description

      Some of the calling code inside of rice that calls the UIDocumentServiceImpl.getMember() method handles a null return value. Other times this is not handled. Currently a NullPointerException is occuring in KC - see the linked issue for details.

      In KC's case when have a role with members that do not exist. This is analogous to a fk constraint violation if a constraint did exist (which it cannot). So, cleaning up our kim data should fix this problem.

      As for the rice code, it would be nice if not found members were handled consistently. Maybe a warning/error to the maintenance screen with the option of removing the invalid entry. Maybe throwing a more useful exception. Just ideas.

        Attachments

          Issue Links

            Activity

            Hide
            ewestfal Eric Westfall added a comment -

            We patched this for our IU implementation. I can contribute this back.

            Show
            ewestfal Eric Westfall added a comment - We patched this for our IU implementation. I can contribute this back.
            Hide
            ewestfal Eric Westfall added a comment -

            Here's a copy of the patched Iu code that I will put in here. It essentially returns the name as the "empty" string which allows for the user interface to still function:

            public String getMemberName(String memberTypeCode, String memberId){
            if(StringUtils.isEmpty(memberTypeCode) || StringUtils.isEmpty(memberId)) return "";
            BusinessObject member = getMember(memberTypeCode, memberId);
            /*

            • Begin IU Patch: EN-1638
              */
              if(member == null)
              Unknown macro: {//not a REAL principal, try to fake the name String fakeName = KIMServiceLocator.getIdentityManagementService().getPrincipal(memberId).getPrincipalName(); if(fakeName == null || fakeName.equals("")){ return ""; } return fakeName; }

              /*

            • End IU Patch: EN-1638
              */
              return getMemberName(memberTypeCode, member);
              }
            Show
            ewestfal Eric Westfall added a comment - Here's a copy of the patched Iu code that I will put in here. It essentially returns the name as the "empty" string which allows for the user interface to still function: public String getMemberName(String memberTypeCode, String memberId){ if(StringUtils.isEmpty(memberTypeCode) || StringUtils.isEmpty(memberId)) return ""; BusinessObject member = getMember(memberTypeCode, memberId); /* Begin IU Patch: EN-1638 */ if(member == null) Unknown macro: {//not a REAL principal, try to fake the name String fakeName = KIMServiceLocator.getIdentityManagementService().getPrincipal(memberId).getPrincipalName(); if(fakeName == null || fakeName.equals("")){ return ""; } return fakeName; } /* End IU Patch: EN-1638 */ return getMemberName(memberTypeCode, member); }
            Hide
            ewestfal Eric Westfall added a comment -

            Change committed.

            Show
            ewestfal Eric Westfall added a comment - Change committed.
            Hide
            hudson-kr Kuali RIce Hudson (Inactive) added a comment -

            Integrated in UT-1.0-kc-mysql #33 (See http://ci.rice.kuali.org/job/UT-1.0-kc-mysql/33/)
            KULRICE-4047 - fixing null pointer issue in UiDocumentServiceImpl

            Show
            hudson-kr Kuali RIce Hudson (Inactive) added a comment - Integrated in UT-1.0-kc-mysql #33 (See http://ci.rice.kuali.org/job/UT-1.0-kc-mysql/33/ ) KULRICE-4047 - fixing null pointer issue in UiDocumentServiceImpl
            Hide
            hudson-kr Kuali RIce Hudson (Inactive) added a comment -

            Integrated in UT-1.0-kc-oracle #15 (See http://ci.rice.kuali.org/job/UT-1.0-kc-oracle/15/)
            KULRICE-4047 - fixing null pointer issue in UiDocumentServiceImpl

            Show
            hudson-kr Kuali RIce Hudson (Inactive) added a comment - Integrated in UT-1.0-kc-oracle #15 (See http://ci.rice.kuali.org/job/UT-1.0-kc-oracle/15/ ) KULRICE-4047 - fixing null pointer issue in UiDocumentServiceImpl

              People

              • Assignee:
                ewestfal Eric Westfall
                Reporter:
                tschneeb Travis Schneeberger
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: