jeecgboot/JeecgBoot · error · IllegalArgumentException

参数不能为空

Error message

参数不能为空

What it means

Thrown by oConvertUtils.isGt(Number src, Number des) when either src or des is null. This utility compares two Numbers and returns true if src > des. It is called primarily from AssertUtils.assertGt() and AssertUtils.assertLe() for boundary/range validation (e.g., AIRAG feature). The IllegalArgumentException is unchecked, so callers that pass null get a runtime crash.

Source

Thrown at jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oConvertUtils.java:1144

	 * @author chenrui
	 * @date 2025/2/13 18:35
	 */
	public static boolean isObjectNotEmpty(Object object) {
		return !isObjectEmpty(object);
	}

	/**
	 * 如果src大于des返回true
	 * for [QQYUN-10990]AIRAG
	 * @param src
	 * @param des
	 * @return
	 * @author: chenrui
	 * @date: 2018/9/19 15:30
	 */
	public static boolean isGt(Number src, Number des) {
		if (null == src || null == des) {
			throw new IllegalArgumentException("参数不能为空");
		}
		if (src.doubleValue() > des.doubleValue()) {
			return true;
		}
		return false;
	}

	/**
	 * 如果src大于等于des返回true
	 * for [QQYUN-10990]AIRAG
	 * @param src
	 * @param des
	 * @return
	 * @author: chenrui
	 * @date: 2018/9/19 15:30
	 */
	public static boolean isGe(Number src, Number des) {
		if (null == src || null == des) {

View on GitHub (pinned to 96fb33f5ec)

Solutions

  1. Null-check both arguments before calling isGt and provide a sensible default or return early.
  2. Use primitive types (long, double, int) instead of wrapper types if null is never a valid input.
  3. Validate user input at the controller layer and reject requests with missing numeric fields.
  4. Wrap the assertion call in a try-catch for IllegalArgumentException if the business logic allows optional comparisons.

Example fix

// before
boolean result = oConvertUtils.isGt(pageSize, threshold);

// after
if (pageSize == null || threshold == null) {
    return false;
}
boolean result = oConvertUtils.isGt(pageSize, threshold);
Defensive patterns

Strategy: validation

Validate before calling

if (src == null || des == null) {
    return false; // or throw a domain-specific exception
}
boolean result = oConvertUtils.isGt(src, des);

Type guard

private static boolean isSafeNumber(Number n) {
    return n != null;
}

Try / catch

try {
    boolean result = oConvertUtils.isGt(src, des);
} catch (IllegalArgumentException e) {
    log.warn("Null number comparison: src={}, des={}", src, des);
    return false;
}

Prevention

When it happens

Trigger: Calling isGt(null, 5), isGt(3, null), or isGt(null, null). In practice this happens when AssertUtils.assertGt is called with a Number value that was parsed from user input or a config property and was null because parsing failed or the field was absent.

Common situations: Numeric form field left blank and parsed to null Integer/Long; database column returns null for a numeric field that is then passed to an assertion; JSON deserialization produces null for an unboxed numeric type that was promoted to its wrapper.

Related errors


AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14). Data as JSON: /api/errors/6bc68d8a920a493d. Report an issue: GitHub.