Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-485

RestUtil.wrapErrorResponse throws an ArrayIndexOutOfBoundsException if there is no stack trace

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.10
    • Labels:
    • Complexity:
      Low

      Description

      public static SimpleObject wrapErrorResponse(Exception ex, String reason) {
      LinkedHashMap map = new LinkedHashMap();
      if (reason != null && !reason.isEmpty())

      { map.put("message", reason); }

      else
      map.put("message", ex.getMessage());
      StackTraceElement ste = ex.getStackTrace()[0];

      The last line here assumes ex.getStackTrace() will always be non-empty which is not true. We've had this for an NPE in our module in production. There should be an existence check.

        Attachments

          Activity

            People

            Assignee:
            kristopherschmidt Kristopher Schmidt
            Reporter:
            nfortescue Nick Fortescue
            Designated Committer:
            Rafal Korytkowski
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: