{"record":{"id":"d59c461b76e272e0","repo":"hibernate/hibernate-orm","slug":"prefix-or-name-were-null-attempting-to-build-quali","errorCode":null,"errorMessage":"prefix or name were null attempting to build qualified name","messagePattern":"prefix or name were null attempting to build qualified name","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java","lineNumber":582,"sourceCode":"\tpublic static boolean isNotEmpty(@Nullable String string) {\n\t\treturn string != null && !string.isEmpty();\n\t}\n\n\tpublic static boolean isEmpty(@Nullable String string) {\n\t\treturn string == null || string.isEmpty();\n\t}\n\n\tpublic static boolean isNotBlank(@Nullable String string) {\n\t\treturn string != null && !string.isBlank();\n\t}\n\n\tpublic static boolean isBlank(@Nullable String string) {\n\t\treturn string == null || string.isBlank();\n\t}\n\n\tpublic static String qualify(String prefix, String name) {\n\t\tif ( name == null || prefix == null ) {\n\t\t\tthrow new NullPointerException( \"prefix or name were null attempting to build qualified name\" );\n\t\t}\n\t\treturn prefix + '.' + name;\n\t}\n\n\tpublic static String qualifyConditionally(String prefix, String name) {\n\t\tif ( name == null ) {\n\t\t\tthrow new NullPointerException( \"name was null attempting to build qualified name\" );\n\t\t}\n\t\treturn isEmpty( prefix ) ? name : prefix + '.' + name;\n\t}\n\n\t/**\n\t * Qualifies {@code name} with {@code prefix} separated by a '.' if<ul>\n\t *     <li>{@code name} is not already qualified</li>\n\t *     <li>{@code prefix} is not null</li>\n\t * </ul>\n\t *\n\t * @apiNote Similar to {@link #qualifyConditionally}, except that here we explicitly","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java#L564-L600","documentation":"StringHelper.qualify(prefix, name) builds 'prefix.name' for qualified identifiers (schema.table, entity.property) and is null-hostile in both arguments. Either null triggers an immediate NullPointerException with this message. Inside Hibernate, a null reaching qualify usually means upstream metadata — a schema, table, column, or property name — resolved to null unexpectedly.","triggerScenarios":"Calling qualify(null, name) or qualify(prefix, null) directly, or an internal Hibernate call site where a naming strategy or programmatic mapping produced a null schema/catalog/name component.","commonSituations":"Custom PhysicalNamingStrategy or ImplicitNamingStrategy implementations returning null; programmatic mapping APIs built with null catalog/schema/entity names; refactors that swap argument order so the nullable value lands in the required slot.","solutions":["Null-check both arguments at your boundary and fail with a contextual error.","Fix the upstream producer (naming strategy, mapping builder) so name components are never null.","If an empty prefix is legitimate at your call site, use qualifyConditionally(prefix, name) which tolerates empty prefixes."],"exampleFix":"// before\nString qualified = StringHelper.qualify(schema, tableName); // schema == null -> NPE\n\n// after\nString qualified = StringHelper.isEmpty(schema) ? tableName : StringHelper.qualify(schema, tableName);\n// or: StringHelper.qualifyConditionally(schema, tableName);","handlingStrategy":"validation","validationCode":"static String qualifySafe(String prefix, String name) {\n    if (name == null) throw new IllegalArgumentException(\"name must not be null\");\n    return StringHelper.isEmpty(prefix) ? name : prefix + '.' + name;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep custom naming strategies returning non-null names (empty is usually better than null).","Wrap qualify-family helpers in null-checked utility wrappers in your codebase.","Validate schema/catalog/name components right where mappings are built."],"tags":["hibernate","string-utils","null-check","naming-strategy"],"backgroundTag":"null-argument-contract-violation","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}