{"record":{"id":"14cdd22ce9d2ac85","repo":"pentaho/pentaho-kettle","slug":"value-is-null","errorCode":null,"errorMessage":"Value is null","messagePattern":"Value is null","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/core/util/StringListPluginProperty.java","lineNumber":212,"sourceCode":"  /**\n   * @return size\n   * @throws IllegalStateException\n   *           if value is null.\n   */\n  public int size() throws IllegalStateException {\n    this.assertValueNotNull();\n    return this.getValue().size();\n  }\n\n  /**\n   * Assert state, value not null.\n   *\n   * @throws IllegalStateException\n   *           if this.value is null.\n   */\n  public void assertValueNotNull() throws IllegalStateException {\n    if ( this.getValue() == null ) {\n      throw new IllegalStateException( \"Value is null\" );\n    }\n  }\n\n}\n","sourceCodeStart":194,"sourceCodeEnd":217,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/core/util/StringListPluginProperty.java#L194-L217","documentation":"StringListPluginProperty.assertValueNotNull throws IllegalStateException when the property's underlying value (the string list) is null. List operations like iterator(), isEmpty(), and size() call it because they cannot operate on a null list. The error means the property was created without a list value and has never been initialized.","triggerScenarios":"Calling iterator(), isEmpty(), size(), or assertValueNotNull() on a StringListPluginProperty constructed with a null value and never assigned a non-null list.","commonSituations":"Deserializing a property from XML where the value element is missing; constructing the property with a null default; plugin config files from older versions lacking the list element.","solutions":["Initialize the property with a non-null list (e.g. empty ArrayList) at construction time.","Call setValue(new ArrayList<>()) or the property's setter before reading list operations.","Check the XML source for a missing value element and provide a default on load.","Wrap list reads in try-catch (IllegalStateException) when null values are possible."],"exampleFix":"// before\nStringListPluginProperty prop = new StringListPluginProperty(\"key\", null);\nint n = prop.size();\n// after\nStringListPluginProperty prop = new StringListPluginProperty(\"key\", new ArrayList<String>());\nint n = prop.size();","handlingStrategy":"validation","validationCode":"if (prop.getValue() == null) {\n  prop.setValue(new ArrayList<String>());\n}\nint n = prop.size();","typeGuard":"boolean usable = prop != null && prop.getValue() != null;","tryCatchPattern":"try {\n  for (String s : prop) { process(s); }\n} catch (IllegalStateException e) {\n  log.warn(\"Property list not initialized: \" + e.getMessage());\n}","preventionTips":["Always construct with a non-null (possibly empty) list","Supply defaults when loading from XML with missing value elements","Call assertValueNotNull() defensively in custom code paths"],"tags":["illegal-state","null-value","plugin-property"],"backgroundTag":"null-argument","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}