-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop throwing errors on blank log messages #17058
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,19 +255,21 @@ private void validateGELFMessage(JsonNode jsonNode, UUID id, ResolvableInetSocke | |
|
||
final JsonNode shortMessageNode = jsonNode.path("short_message"); | ||
final JsonNode messageNode = jsonNode.path("message"); | ||
String message = shortMessageNode.asText(); | ||
if (!shortMessageNode.isMissingNode()) { | ||
if (!shortMessageNode.isTextual()) { | ||
throw new IllegalArgumentException(prefix + "has invalid \"short_message\": " + shortMessageNode.asText()); | ||
} | ||
if (StringUtils.isBlank(shortMessageNode.asText()) && StringUtils.isBlank(messageNode.asText())) { | ||
throw new IllegalArgumentException(prefix + "has empty mandatory \"short_message\" field."); | ||
String shortMessage = shortMessageNode.asText(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same as |
||
if (shortMessage == null && message == null) { | ||
throw new IllegalArgumentException(prefix + "mandatory \"short_message\" field is null."); | ||
} | ||
} else if (!messageNode.isMissingNode()) { | ||
if (!messageNode.isTextual()) { | ||
throw new IllegalArgumentException(prefix + "has invalid \"message\": " + messageNode.asText()); | ||
} | ||
if (StringUtils.isBlank(messageNode.asText())) { | ||
throw new IllegalArgumentException(prefix + "has empty mandatory \"message\" field."); | ||
if (message == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this not be |
||
throw new IllegalArgumentException(prefix + "mandatory \"message\" field is null."); | ||
} | ||
} else { | ||
throw new IllegalArgumentException(prefix + "is missing mandatory \"short_message\" or \"message\" field."); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be removed, as far as I can see.