Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-4047

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

    Details

    • Type: Bug Fix Bug Fix
    • Status: Closed Closed
    • Priority: Critical 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
    • Similar issues:
      KULRICE-11166Incorrect handling of null compares in RulesManagmentServiceImpl
      KULRICE-3602Handle null values consistently in KIM entity DTOs
      KULRICE-8295Null handling in DocumentSearchCriteriaBo.groovy needs work
      KULRICE-7266Property Utils is not handling nested nulls within a property chain
      KULRICE-4023Make KualiCodeBase handle null values better.
      KULRICE-5506All of our kim services need to have proper exception handling, return immutable collections, do not return null
      KULRICE-8684ActionRequestValue is not handling missing Person or Group objects
      KULRICE-5315KimRoleTypeService (if configured) should get to decide how to handle null qualifier match
      KULRICE-3343KimTypeServIveBase class has protected method which can return null but calling method is assuming non-null value
      KULRICE-5413figure out how to handle collections being null on model objects when being unmarshalled
    • 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.

        Issue Links

          Activity

          Hide
          Eric Westfall added a comment -

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

          Show
          Eric Westfall added a comment - We patched this for our IU implementation. I can contribute this back.
          Hide
          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
          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
          Eric Westfall added a comment -

          Change committed.

          Show
          Eric Westfall added a comment - Change committed.
          Hide
          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
          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
          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
          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:
              Eric Westfall
              Reporter:
              Travis Schneeberger
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Structure Helper Panel