jenniferdai commented on a change in pull request #3505: Handle invalid
durations in the duration DSL
URL: https://github.com/apache/incubator-pinot/pull/3505#discussion_r235562115
##########
File path:
pinot-common/src/main/java/com/linkedin/pinot/common/config/DurationDsl.java
##########
@@ -28,14 +28,22 @@ public Duration parse(String text) {
return null;
}
- String[] parts = text.split(" ");
- final String unit = parts[1].toUpperCase();
- final String unitCount = parts[0];
- return new Duration(TimeUnit.valueOf(unit), Integer.parseInt(unitCount));
+ try {
+ String[] parts = text.split(" ");
+ final String unit = parts[1].toUpperCase();
+ final String unitCount = parts[0];
+ return new Duration(TimeUnit.valueOf(unit), Integer.parseInt(unitCount));
+ } catch (Exception e) {
+ return null;
Review comment:
do you want to log something here before returning?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]