NationalSecurityAgency/ghidra · warning · IllegalArgumentException

Entry cannot be blank

Error message

Entry cannot be blank

What it means

Thrown by the static FunctionStartRFParams.parseIntegerCSV(csv) when the input is blank (StringUtils.isBlank — null, empty, or all-whitespace). The method parses a CSV of distinct non-negative integers and rejects empty input up front rather than returning an empty list.

Source

Thrown at Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/FunctionStartRFParams.java:216

				contextRegisterVals.clear();
				throw new IllegalArgumentException(
					"Register " + regName + " not found for program " + trainingSource.getName());
			}
			contextRegisterNames.add(regName);
			BigInteger bigInt = new BigInteger(regValPair[1].trim());
			contextRegisterVals.add(bigInt);
		}
	}

	/**
	 * Parses a CSV into a sorted list of distinct integer values (duplicates are ignored).  Returns
	 * an empty list of a parse error is encountered.
	 * @param csv csv string to parse
	 * @return sorted list  
	 */
	public static List<Integer> parseIntegerCSV(String csv) {
		if (StringUtils.isBlank(csv)) {
			throw new IllegalArgumentException("Entry cannot be blank");
		}
		String trimmed = csv.trim();
		if (trimmed.startsWith(",") || trimmed.endsWith(",")) {
			throw new IllegalArgumentException("String must not begin or end with a comma");
		}
		Set<Integer> results = new HashSet<>();
		String[] parts = trimmed.split(",");
		for (String part : parts) {
			Integer i = Integer.decode(part.trim());
			if (i < 0) {
				throw new IllegalArgumentException(
					"Invalid element " + part + " - must be non-negative");
			}
			results.add(i);
		}
		return results.stream().sorted().collect(Collectors.toList());
	}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Provide at least one non-negative integer, e.g. '0' or '1,2,4'.
  2. Guard the call: if (StringUtils.isBlank(csv)) skip / default; else parseIntegerCSV(csv).
  3. Validate the UI field is non-empty before submitting the params dialog.

Example fix

// before
List<Integer> r = FunctionStartRFParams.parseIntegerCSV(""); // throws

// after
List<Integer> r = StringUtils.isBlank(s)
    ? Collections.emptyList()
    : FunctionStartRFParams.parseIntegerCSV(s);
Defensive patterns

Strategy: validation

Validate before calling

import org.apache.commons.lang3.StringUtils;
if (!StringUtils.isBlank(csv)) {
    List<Integer> r = FunctionStartRFParams.parseIntegerCSV(csv);
} else {
    // field is optional -> use default; otherwise prompt the user
}

Type guard

null

Try / catch

try {
    List<Integer> r = FunctionStartRFParams.parseIntegerCSV(csv);
} catch (IllegalArgumentException e) {
    if (e.getMessage().equals("Entry cannot be blank")) {
        // supply a default list instead of parsing
    } else throw e;
}

Prevention

When it happens

Trigger: parseIntegerCSV(null), parseIntegerCSV(""), or parseIntegerCSV(" ") for fields like preBytes/initialBytes/samplingFactors that require at least one value.

Common situations: A dialog field left empty before OK; reading a missing property from a saved options file; an uninitialized list passed to a parameter setter that delegates to parseIntegerCSV.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/97b1840eac04ad4c. Report an issue: GitHub.