From b2770cd90afb7899c6afffccf98f467cf5d66bae Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Tue, 17 Jan 2006 17:15:01 +0000 Subject: [PATCH] Improvements to the exception message (was null ptr) thrown when a developer makes a mistake in the Advanced Search custom attributes config git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2129 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web/ui/repo/component/UISearchCustomProperties.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java b/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java index 0b7c994c20..5cba733676 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java +++ b/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java @@ -31,6 +31,7 @@ import javax.faces.context.ResponseWriter; import javax.faces.el.ValueBinding; import org.alfresco.config.ConfigService; +import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DictionaryException; @@ -154,12 +155,20 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements { QName type = Repository.resolveToQName(property.Type); TypeDefinition typeDef = dd.getType(type); + if (typeDef == null) + { + throw new AlfrescoRuntimeException("No Type Definition found for: " + property.Type + " - Was an Aspect expected?"); + } propDef = typeDef.getProperties().get(Repository.resolveToQName(property.Property)); } else if (property.Aspect != null) { QName aspect = Repository.resolveToQName(property.Aspect); AspectDefinition aspectDef = dd.getAspect(aspect); + if (aspectDef == null) + { + throw new AlfrescoRuntimeException("No Aspect Definition found for: " + property.Aspect + " - Was a Type expected?"); + } propDef = aspectDef.getProperties().get(Repository.resolveToQName(property.Property)); }