sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mahsum Demir (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SLING-5767) Include the Illegal Argument Exception message in the logs
Date Wed, 23 Jan 2019 12:42:00 GMT

    [ https://issues.apache.org/jira/browse/SLING-5767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16749916#comment-16749916
] 

Mahsum Demir commented on SLING-5767:
-------------------------------------

I created a PR for this issue. PR can be seen at https://github.com/apache/sling-org-apache-sling-event/pull/3

> Include the Illegal Argument Exception message in the logs
> ----------------------------------------------------------
>
>                 Key: SLING-5767
>                 URL: https://issues.apache.org/jira/browse/SLING-5767
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>    Affects Versions: Event 3.7.6, Event 4.0.2
>            Reporter: PuzanovsP
>            Priority: Trivial
>              Labels: easyfix, newbie
>         Attachments: Utility.java
>
>   Original Estimate: 1h
>          Time Spent: 10m
>  Remaining Estimate: 50m
>
> 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 ) {
>                 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;
>     }



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message