Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-5767

Include the Illegal Argument Exception message in the logs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • Event 3.7.6, Event 4.0.2
    • None
    • Extensions

    Description

      Add message to notify the user why his event is invalid.

      File: org/apache/sling/event/impl/jobs/Utility.java:50

      • Change code attached.

      /**

      • Check the job topic.
      • @return <code>null</code> if the topic is correct, otherwise an error description is returned
        */
        public static String checkJobTopic(final Object jobTopic) {
        final String message;
        if ( jobTopic != null ) {
        if ( jobTopic instanceof String )
        Unknown macro: { boolean topicIsCorrect = false; String exceptionDetails = EMPTY; try { new Event((String)jobTopic, (Dictionary<String, Object>)null); topicIsCorrect = true; } catch (final IllegalArgumentException iae) { exceptionDetails = iae.getLocalizedMessage(); } if ( !topicIsCorrect ) { message = "Discarding job - job has an illegal job topic, due to: ".concat(exceptionDetails); } else { message = null; } }

        else

        { message = "Discarding job - job topic is not of type string"; }

        } else

        { message = "Discarding job - job topic is missing"; }

        return message;
        }

      Attachments

        1. Utility.java
          12 kB
          PuzanovsP

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Akonkagva PuzanovsP
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h Original Estimate - 1h
                  1h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 10m
                  2h 10m