From 02b8bc3e56f86cc050d7958e3d4558082bdb4a84 Mon Sep 17 00:00:00 2001 From: gallardo Date: Mon, 6 Jul 2026 10:40:25 +0200 Subject: [PATCH] Fixed NullPointerException in CmsADEConfigData.hasFormatters() for resource types without a schema. CmsXmlContentDefinition.getContentDefinitionForType() returns null when a resource type has no "schema" configuration parameter. hasFormatters() dereferenced the result unconditionally, causing a NullPointerException (logged by CmsAddDialogTypeHelper on every container page editor load) whenever such a type is referenced by a sitemap configuration. Treat a missing content definition as "no formatters" and log a warning naming the offending type, so the misconfiguration is visible instead of surfacing as an NPE. Co-Authored-By: Claude Code, Fable 5 --- src/org/opencms/ade/configuration/CmsADEConfigData.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/org/opencms/ade/configuration/CmsADEConfigData.java b/src/org/opencms/ade/configuration/CmsADEConfigData.java index f0777a0b282..4dcf2c7d4ac 100644 --- a/src/org/opencms/ade/configuration/CmsADEConfigData.java +++ b/src/org/opencms/ade/configuration/CmsADEConfigData.java @@ -1724,6 +1724,13 @@ public boolean hasFormatters(CmsObject cms, I_CmsResourceType resType, Collectio CmsXmlContentDefinition def = CmsXmlContentDefinition.getContentDefinitionForType( cms, resType.getTypeName()); + if (def == null) { + LOG.warn( + "Type '" + + resType.getTypeName() + + "' has no schema configured, cannot check whether it has formatters."); + return false; + } CmsFormatterConfiguration schemaFormatters = def.getContentHandler().getFormatterConfiguration(cms, null); CmsFormatterConfiguration formatters = getFormatters(cms, resType, schemaFormatters); for (CmsContainer cont : containers) {