[ 
https://issues.apache.org/jira/browse/SLING-5767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

PuzanovsP updated SLING-5767:
-----------------------------
    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 ) {
                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;
    }

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

* 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;
    }


> 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
>            Reporter: PuzanovsP
>            Priority: Trivial
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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
(v6.3.4#6332)

Reply via email to