You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by "eolivelli (via GitHub)" <gi...@apache.org> on 2023/05/08 20:32:09 UTC
[GitHub] [bookkeeper] eolivelli commented on a diff in pull request #3914: [Bug] Fix internal server error when unexpected json inputs are sent to Bookkeeper HTTP Services
eolivelli commented on code in PR #3914:
URL: https://github.com/apache/bookkeeper/pull/3914#discussion_r1187868995
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/service/TriggerGCService.java:
##########
@@ -69,8 +69,15 @@ public HttpServiceResponse handle(HttpServiceRequest request) throws Exception {
} else {
@SuppressWarnings("unchecked")
Map<String, Object> configMap = JsonUtil.fromJson(requestBody, HashMap.class);
- Boolean forceMajor = (Boolean) configMap.getOrDefault("forceMajor", null);
- Boolean forceMinor = (Boolean) configMap.getOrDefault("forceMinor", null);
+ Object forceMajorObj = configMap.getOrDefault("forceMajor", null);
+ Object forceMinorObj = configMap.getOrDefault("forceMinor", null);
+ boolean forceMajor = false, forceMinor = false;
+ if (forceMajorObj instanceof Boolean) {
+ forceMajor = (Boolean) forceMajorObj;
Review Comment:
We should throw an error if it is not a boolean, otherwise the result is unpredictable
--
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: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org