{"record":{"id":"a7f536277d675809","repo":"xpipe-io/xpipe","slug":"string-is-null","errorCode":null,"errorMessage":"String is null","messagePattern":"String is null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/util/StorePath.java","lineNumber":66,"sourceCode":"            throw new IllegalArgumentException(\"Separator character \" + SEPARATOR + \" is not allowed in the names\");\n        }\n\n        if (Arrays.stream(names).anyMatch(s -> s.strip().length() == 0)) {\n            throw new IllegalArgumentException(\"Trimmed entry name is empty\");\n        }\n\n        return new StorePath(Arrays.stream(names).toList());\n    }\n\n    /**\n     * Creates a new store path from a string representation.\n     *\n     * @param s the string representation, must be not null and fulfill certain requirements\n     * @throws IllegalArgumentException if the string is not valid\n     */\n    public static StorePath fromString(String s) {\n        if (s == null) {\n            throw new IllegalArgumentException(\"String is null\");\n        }\n\n        var split = s.split(String.valueOf(SEPARATOR), -1);\n\n        var names =\n                Arrays.stream(split).map(String::trim).map(String::toLowerCase).toList();\n        if (names.stream().anyMatch(s1 -> s1.isEmpty())) {\n            throw new IllegalArgumentException(\"Name must not be empty\");\n        }\n\n        return new StorePath(names);\n    }\n\n    @Override\n    public String toString() {\n        return names.stream().map(String::toLowerCase).collect(Collectors.joining(\"\" + SEPARATOR));\n    }\n}","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/util/StorePath.java#L48-L84","documentation":"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.","triggerScenarios":"Calling StorePath.fromString(null), typically when a stored/configured path string was never initialized or a lookup returned null.","commonSituations":"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.","solutions":["Null-check the input before calling: if (s != null) StorePath.fromString(s).","Fix the upstream code so the path string is persisted/loaded correctly instead of null.","Return an Optional/empty result instead of parsing when the source value is null."],"exampleFix":"// before\nStorePath p = StorePath.fromString(config.getPath());\n// after\nvar raw = config.getPath();\nif (raw == null) return Optional.empty();\nStorePath p = StorePath.fromString(raw);","handlingStrategy":"type-guard","validationCode":"if (s == null || s.isBlank()) { /* skip or default */ } else { StorePath p = StorePath.fromString(s); }","typeGuard":"public static boolean isParsablePath(String s) {\n    return s != null && !s.isBlank();\n}","tryCatchPattern":"try {\n    StorePath p = StorePath.fromString(s);\n} catch (IllegalArgumentException e) {\n    // null or malformed path string\n}","preventionTips":["Null-check strings read from config/storage before parsing","Persist path strings so they are never missing at load time","Prefer Optional<String> sources so nulls are explicit"],"tags":["java","null-argument","store-path"],"backgroundTag":"null-argument","analyzedSha":"d85ca821baa46092a320ebb13546d7240adb74f8","analyzedAt":"2026-09-06T14:30:08.251Z","contentChangedAt":"2026-09-06T14:30:08.251Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}