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

KRMS is treating RemotableAttributeErrors as message keys instead of messages

    Details

    • Type: Bug Fix
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: Backlog
    • Component/s: Development
    • Security Level: Public (Public: Anyone can view)
    • Labels:
    • Rice Module:
      KRMS
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required

      Description

      Well, at least it's doing so for errors from ActionTypeService implementations. Hopefully this one is not a dupe because I think I recall a discussion about something similar at one point but couldn't locate a similar jira.

      At any rate, if I have a custom ActionTypeService with a validate method like this:

      @Override
      public List<RemotableAttributeError> validateAttributes(String krmsTypeId,
              Map<String, String> attributes) {
          String value = attributes.get("numberOfDays");
          List<String> errors = new ArrayList<String>();
          if (value == null || "".equals(value.trim())) {
              errors.add("Number of days is required");
          } else {
              try {
                  int intValue = Integer.parseInt(value);
                  if (intValue < 0) {
                      errors.add("Number of days must be a non-negative number");
                  }
              } catch (NumberFormatException e) {
                  errors.add("Value is not a valid number");
              }
          }
          if (!errors.isEmpty()) {
              RemotableAttributeError.Builder errorBuilder =
                      RemotableAttributeError.Builder.create("numberOfDays", errors);
              return Collections.singletonList(errorBuilder.build());
          } else {
              return Collections.emptyList();
          }
      }
      

      Then if the validation fails, instead of getting the expected error messages, I see something like the attached image.

      RemotableAttributeErrors are intended to hold fully resolved messages as opposed to message keys that get looked up in a resource file. One of the main reasons being that they are intended to be "remoted" so whereever those errors end up, the consumer probably won't have whatever message key was being passed in order to resolve it (hopefully that makes sense).

        Attachments

          Issue Links

            Activity

            Hide
            jcoltrin Jessica Coltrin (Inactive) added a comment -

            assigning to 2.1 for review by 2.1 DMs.

            Show
            jcoltrin Jessica Coltrin (Inactive) added a comment - assigning to 2.1 for review by 2.1 DMs.
            Hide
            gilesp Peter Giles (Inactive) added a comment - - edited

            This is due to a KRAD limitation (at the time this work was done at least). We decided to go ahead and fully resolve the error messages on the remote side, and wait for KRAD to support errors that do so. I'll link the issue that Claus created for the KRAD enhancement.

            Looks like at the least MessageMap needs enhancements to support this sort of thing.

            Show
            gilesp Peter Giles (Inactive) added a comment - - edited This is due to a KRAD limitation (at the time this work was done at least). We decided to go ahead and fully resolve the error messages on the remote side, and wait for KRAD to support errors that do so. I'll link the issue that Claus created for the KRAD enhancement. Looks like at the least MessageMap needs enhancements to support this sort of thing.

              People

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

                Dates

                • Created:
                  Updated: