DiogoP98 commented on code in PR #8589:
URL: https://github.com/apache/storm/pull/8589#discussion_r3204738134
##########
storm-core/src/jvm/org/apache/storm/utils/TopologySpoutLag.java:
##########
@@ -171,10 +171,15 @@ private static Map<String, Object>
getLagResultForKafka(String spoutId, SpoutSpe
String resultFromMonitor = new
ShellCommandRunnerImpl().execCommand(commands.toArray(new String[0]));
try {
- result = (Map<String, Object>)
JSONValue.parseWithException(resultFromMonitor);
+ Object parsed =
JSONValue.parseWithException(resultFromMonitor);
+ if (parsed instanceof Map) {
+ result = (Map<String, Object>) parsed;
+ } else {
+ // json-smart parses unquoted plain text leniently
as a String, so we can land here
+ // when the monitor printed an error message
instead of JSON; surface it as the error.
+ errorMsg = resultFromMonitor;
+ }
} catch (ParseException e) {
- LOGGER.debug("JSON parsing failed, assuming message as
error message: {}", resultFromMonitor);
- // json parsing fail -> error received
errorMsg = resultFromMonitor;
Review Comment:
Addressed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]