{"record":{"id":"dc62805b85ad0ecc","repo":"xpipe-io/xpipe","slug":"mustnotbeempty-name","errorCode":null,"errorMessage":"mustNotBeEmpty(${name})","messagePattern":"mustNotBeEmpty\\((.+?)\\)","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/util/Validators.java","lineNumber":40,"sourceCode":"            throws ValidationException {\n        if (ref == null\n                || ref.getStore() == null\n                || Arrays.stream(cs)\n                        .noneMatch(c -> c.isAssignableFrom(ref.getStore().getClass()))) {\n            throw new ValidationException(\"Value must be an instance of \"\n                    + Arrays.stream(cs).map(Class::getSimpleName).toList());\n        }\n    }\n\n    public static void nonNull(Object object) throws ValidationException {\n        if (object == null) {\n            throw new ValidationException(AppI18n.get(\"valueMustNotBeEmpty\"));\n        }\n    }\n\n    public static void nonNull(Object object, String name) throws ValidationException {\n        if (object == null) {\n            throw new ValidationException(AppI18n.get(\"mustNotBeEmpty\", name));\n        }\n    }\n\n    public static void contentNonNull(List<?> object) throws ValidationException {\n        if (object.stream().anyMatch(o -> o == null)) {\n            throw new ValidationException(AppI18n.get(\"valueMustNotBeEmpty\"));\n        }\n    }\n\n    public static void notEmpty(String string) throws ValidationException {\n        if (string.strip().length() == 0) {\n            throw new ValidationException(AppI18n.get(\"valueMustNotBeEmpty\"));\n        }\n    }\n}\n","sourceCodeStart":22,"sourceCodeEnd":56,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/util/Validators.java#L22-L56","documentation":"Validators.nonNull(Object, String) checks that a named value is not null and throws a ValidationException with the localized message key \"mustNotBeEmpty\" parameterized with the field name. The thrown message is the i18n-formatted text, so it appears in the UI language with the name interpolated.","triggerScenarios":"Validators.nonNull(value, \"Name\") where value is null; the name argument is only used for the message, so passing null value with any label triggers it.","commonSituations":"Named required fields in store/connection dialogs left empty; programmatic construction of options skipping a mandatory field; data migration leaving a field null.","solutions":["Set the named field to a non-null value before calling validation.","If the field is optional, remove the nonNull call or branch around it.","Provide the correct field name so the error message points at the real culprit."],"exampleFix":"// before\nValidators.nonNull(entry.getName(), \"Name\");\n// after\nif (entry.getName() == null) {\n    entry.setName(\"default\");\n}\nValidators.nonNull(entry.getName(), \"Name\");","handlingStrategy":"validation","validationCode":"if (value != null) {\n    Validators.nonNull(value, name);\n}","typeGuard":"public static boolean present(Object o) {\n    return o != null;\n}","tryCatchPattern":"try {\n    Validators.nonNull(value, \"target\");\n} catch (ValidationException e) {\n    // named required field is null\n}","preventionTips":["Always pass an accurate field name for diagnosable messages","Initialize mandatory fields at object construction","Validate forms before submit to catch nulls early"],"tags":["java","validation","null-check","i18n"],"backgroundTag":"empty-required-field","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"}