chinabugotech/hutool · error · IllegalArgumentException
参数不可为null
Error message
参数不可为null
What it means
Error "参数不可为null" thrown in chinabugotech/hutool.
Source
Thrown at hutool-core/src/main/java/cn/hutool/core/date/TemporalAccessorUtil.java:205
/**
* 当前日期是否在日期指定范围内<br>
* 起始日期和结束日期可以互换<br>
* 通过includeBegin, includeEnd参数控制日期范围区间是否为开区间,例如:传入参数:includeBegin=true, includeEnd=false,
* 则本方法会判断 date ∈ (beginDate, endDate] 是否成立
*
* @param date 被检查的日期
* @param beginDate 起始日期
* @param endDate 结束日期
* @param includeBegin 时间范围是否包含起始日期
* @param includeEnd 时间范围是否包含结束日期
* @return 是否在范围内
* @author FengBaoheng
* @since 5.8.6
*/
public static boolean isIn(TemporalAccessor date, TemporalAccessor beginDate, TemporalAccessor endDate,
boolean includeBegin, boolean includeEnd) {
if (date == null || beginDate == null || endDate == null) {
throw new IllegalArgumentException("参数不可为null");
}
final long thisMills = toEpochMilli(date);
final long beginMills = toEpochMilli(beginDate);
final long endMills = toEpochMilli(endDate);
final long rangeMin = Math.min(beginMills, endMills);
final long rangeMax = Math.max(beginMills, endMills);
// 先判断是否满足 date ∈ (beginDate, endDate)
boolean isIn = rangeMin < thisMills && thisMills < rangeMax;
// 若不满足,则再判断是否在时间范围的边界上
if (!isIn && includeBegin) {
isIn = thisMills == rangeMin;
}
if (!isIn && includeEnd) {
isIn = thisMills == rangeMax;View on GitHub (pinned to 8870454b2a)
Solutions
- Pass a non-null TemporalAccessor argument; null-check before calling.
- Filter out null values from collections before processing.
When it happens
Trigger: Thrown at hutool-core/src/main/java/cn/hutool/core/date/TemporalAccessorUtil.java:205 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chinabugotech/hutool@8870454b2a (2026-08-14).
Data as JSON: /api/errors/8325d1f7ffb68dd4.
Report an issue: GitHub.