xpipe-io/xpipe · error · IllegalArgumentException

String is null

Error message

String is null

What it means

StorePath.fromString(String) parses a textual store path back into a StorePath. The parser rejects a null input immediately with this IllegalArgumentException because there is no meaningful representation for a null path. The Javadoc explicitly requires the string to be non-null and valid.

Source

Thrown at app/src/main/java/io/xpipe/app/util/StorePath.java:66

            throw new IllegalArgumentException("Separator character " + SEPARATOR + " is not allowed in the names");
        }

        if (Arrays.stream(names).anyMatch(s -> s.strip().length() == 0)) {
            throw new IllegalArgumentException("Trimmed entry name is empty");
        }

        return new StorePath(Arrays.stream(names).toList());
    }

    /**
     * Creates a new store path from a string representation.
     *
     * @param s the string representation, must be not null and fulfill certain requirements
     * @throws IllegalArgumentException if the string is not valid
     */
    public static StorePath fromString(String s) {
        if (s == null) {
            throw new IllegalArgumentException("String is null");
        }

        var split = s.split(String.valueOf(SEPARATOR), -1);

        var names =
                Arrays.stream(split).map(String::trim).map(String::toLowerCase).toList();
        if (names.stream().anyMatch(s1 -> s1.isEmpty())) {
            throw new IllegalArgumentException("Name must not be empty");
        }

        return new StorePath(names);
    }

    @Override
    public String toString() {
        return names.stream().map(String::toLowerCase).collect(Collectors.joining("" + SEPARATOR));
    }
}

View on GitHub (pinned to d85ca821ba)

Solutions

  1. Null-check the input before calling: if (s != null) StorePath.fromString(s).
  2. Fix the upstream code so the path string is persisted/loaded correctly instead of null.
  3. Return an Optional/empty result instead of parsing when the source value is null.

Example fix

// before
StorePath p = StorePath.fromString(config.getPath());
// after
var raw = config.getPath();
if (raw == null) return Optional.empty();
StorePath p = StorePath.fromString(raw);
Defensive patterns

Strategy: type-guard

Validate before calling

if (s == null || s.isBlank()) { /* skip or default */ } else { StorePath p = StorePath.fromString(s); }

Type guard

public static boolean isParsablePath(String s) {
    return s != null && !s.isBlank();
}

Try / catch

try {
    StorePath p = StorePath.fromString(s);
} catch (IllegalArgumentException e) {
    // null or malformed path string
}

Prevention

When it happens

Trigger: Calling StorePath.fromString(null), typically when a stored/configured path string was never initialized or a lookup returned null.

Common situations: Deserializing a store entry whose path field was missing; reading a config key that is absent; passing the result of a failed lookup (null) directly into fromString.

Related errors


AI-assisted analysis of xpipe-io/xpipe@d85ca821ba (2026-09-06). Data as JSON: /api/errors/a7f536277d675809. Report an issue: GitHub.