{"record":{"id":"97b1840eac04ad4c","repo":"NationalSecurityAgency/ghidra","slug":"entry-cannot-be-blank","errorCode":null,"errorMessage":"Entry cannot be blank","messagePattern":"Entry cannot be blank","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/FunctionStartRFParams.java","lineNumber":216,"sourceCode":"\t\t\t\tcontextRegisterVals.clear();\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Register \" + regName + \" not found for program \" + trainingSource.getName());\n\t\t\t}\n\t\t\tcontextRegisterNames.add(regName);\n\t\t\tBigInteger bigInt = new BigInteger(regValPair[1].trim());\n\t\t\tcontextRegisterVals.add(bigInt);\n\t\t}\n\t}\n\n\t/**\n\t * Parses a CSV into a sorted list of distinct integer values (duplicates are ignored).  Returns\n\t * an empty list of a parse error is encountered.\n\t * @param csv csv string to parse\n\t * @return sorted list  \n\t */\n\tpublic static List<Integer> parseIntegerCSV(String csv) {\n\t\tif (StringUtils.isBlank(csv)) {\n\t\t\tthrow new IllegalArgumentException(\"Entry cannot be blank\");\n\t\t}\n\t\tString trimmed = csv.trim();\n\t\tif (trimmed.startsWith(\",\") || trimmed.endsWith(\",\")) {\n\t\t\tthrow new IllegalArgumentException(\"String must not begin or end with a comma\");\n\t\t}\n\t\tSet<Integer> results = new HashSet<>();\n\t\tString[] parts = trimmed.split(\",\");\n\t\tfor (String part : parts) {\n\t\t\tInteger i = Integer.decode(part.trim());\n\t\t\tif (i < 0) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Invalid element \" + part + \" - must be non-negative\");\n\t\t\t}\n\t\t\tresults.add(i);\n\t\t}\n\t\treturn results.stream().sorted().collect(Collectors.toList());\n\t}\n","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/FunctionStartRFParams.java#L198-L234","documentation":"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.","triggerScenarios":"parseIntegerCSV(null), parseIntegerCSV(\"\"), or parseIntegerCSV(\"   \") for fields like preBytes/initialBytes/samplingFactors that require at least one value.","commonSituations":"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.","solutions":["Provide at least one non-negative integer, e.g. '0' or '1,2,4'.","Guard the call: if (StringUtils.isBlank(csv)) skip / default; else parseIntegerCSV(csv).","Validate the UI field is non-empty before submitting the params dialog."],"exampleFix":"// before\nList<Integer> r = FunctionStartRFParams.parseIntegerCSV(\"\"); // throws\n\n// after\nList<Integer> r = StringUtils.isBlank(s)\n    ? Collections.emptyList()\n    : FunctionStartRFParams.parseIntegerCSV(s);","handlingStrategy":"validation","validationCode":"import org.apache.commons.lang3.StringUtils;\nif (!StringUtils.isBlank(csv)) {\n    List<Integer> r = FunctionStartRFParams.parseIntegerCSV(csv);\n} else {\n    // field is optional -> use default; otherwise prompt the user\n}","typeGuard":"null","tryCatchPattern":"try {\n    List<Integer> r = FunctionStartRFParams.parseIntegerCSV(csv);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().equals(\"Entry cannot be blank\")) {\n        // supply a default list instead of parsing\n    } else throw e;\n}","preventionTips":["Disable the OK action while required numeric fields are blank.","Default optional CSV fields to a sensible value rather than empty.","Use StringUtils.isBlank to short-circuit before calling parseIntegerCSV."],"tags":["machine-learning","validation","config-parsing","function-finder"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}