You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "PuzanovsP (JIRA)" <ji...@apache.org> on 2016/06/08 13:21:21 UTC
[jira] [Created] (SLING-5767) Include the Illegal Argument
Exception message in the logs
PuzanovsP created SLING-5767:
--------------------------------
Summary: 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
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;
}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)