rajucomp commented on code in PR #1801:
URL: https://github.com/apache/commons-lang/pull/1801#discussion_r4108892325
##########
src/main/java/org/apache/commons/lang3/time/DateUtils.java:
##########
@@ -221,9 +224,23 @@ private enum ModifyType {
* @throws NullPointerException Thrown if the date is null.
*/
private static Date add(final Date date, final int calendarField, final
int amount) {
- validateDateNotNull(date);
- final Calendar c = Calendar.getInstance();
- c.setTime(date);
+ return add(date, calendarField, amount, null);
Review Comment:
passing `null` as arguments between functions is considered a bad practice.
I would suggest rather than having one API that does it, you should break it
into two APIs. That should help you avoid passing `null`.
--
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]