quarkusio/quarkus · warning · IllegalArgumentException

Param was null

Error message

Param was null

What it means

DateDelegate parses an HTTP date header string (Date, Expires, Last-Modified, etc.) into java.util.Date. Null input is rejected with IllegalArgumentException per the RuntimeDelegate.HeaderDelegate contract before DateUtil.parseDate is invoked.

Source

Thrown at independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/DateDelegate.java:18

package org.jboss.resteasy.reactive.common.headers;

import java.util.Date;

import jakarta.ws.rs.ext.RuntimeDelegate;

import org.jboss.resteasy.reactive.common.util.DateUtil;

/**
 * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
 */
public class DateDelegate implements RuntimeDelegate.HeaderDelegate<Date> {
    public static final DateDelegate INSTANCE = new DateDelegate();

    @Override
    public Date fromString(String value) {
        if (value == null)
            throw new IllegalArgumentException("Param was null");
        return DateUtil.parseDate(value);
    }

    @Override
    public String toString(Date value) {
        if (value == null)
            throw new IllegalArgumentException("Param was null");
        return DateUtil.formatDate(value);
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Null-check the header string before parsing
  2. Skip cache/date logic when the header is missing
  3. Default to 'now' or a sentinel only when your use case allows it
  4. Guard Map lookups with getOrDefault or Optional.ofNullable

Example fix

// before
Date expires = DateDelegate.INSTANCE.fromString(headers.getFirst("Expires"));
// after
String v = headers.getFirst("Expires");
Date expires = (v == null) ? null : DateDelegate.INSTANCE.fromString(v);
Defensive patterns

Strategy: type-guard

Validate before calling

if (dateHeader == null || dateHeader.isBlank()) { /* no date header present */ }

Type guard

boolean hasDate(String v) { return v != null && !v.isBlank(); }

Try / catch

try {
    Date d = DateDelegate.INSTANCE.fromString(v);
} catch (IllegalArgumentException e) {
    // null or unparseable date; treat header as absent
}

Prevention

When it happens

Trigger: Calling DateDelegate.INSTANCE.fromString(null) directly, or framework header parsing invoking it when a date header is absent/null.

Common situations: Reading Expires/Last-Modified from responses that don't include the header; caching layers that assume the header exists; tests feeding null into the delegate.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/119e2ba118bef9e2. Report an issue: GitHub.