0

I am currently getting the following error message in a GSP page:

Property [namespace] of class [class com.domain.Tld] with value [partnerFebruary10BTESTTEST] does not fall within the valid size range from [0] to [20]

I would like to replace it with my own custom message.

I have added tried the following to messages.properties:

com.domain.Tld.namespace.size.error.com.domain.Tld.namespace=The provided domain is too large and must not exceed {4} characters.

and

com.domain.Tld.namespace.size.toobig=The provided domain is too large and must not exceed {4} characters.

I have seen the other posts such as Grails Problem with custom error messages but I wasn't able to solve my problem.

Update

Domain constraints are:

static constraints = {
    namespace size: 0..20, nullable: true, unique: "name"
}

I also found a class called Localization.groovy with a method static String decodeMessage(String code, Locale locale). In the debugger the code default.invalid.size.message is being used when this method is called.

Update2

I figured out that the specific project is using the localization plugin (https://github.com/halfbaked/grails-localizations) that basically loads the properties files into the databases. When a lookup for a code is made, the decodeMessage method is called. The implementation of the specific decodeMessage method was causing the nulls due to the implementation and hence the messages were never found.

Community
  • 1
  • 1
Menelaos
  • 23,508
  • 18
  • 90
  • 155
  • Can you put your domain constraints here?? – ABC Feb 10 '15 at 04:26
  • just try `tld.namespace.size.toobig=your mesage` domain name should be in small – ABC Feb 10 '15 at 05:05
  • Actually I think I know what the issue is. Their using custom code to lookup the messages through a class called `LocalizationMessageSource extends AbstractMessageSource implements ResourceLoaderAware`. I managed to get it to work but the custom code was the issue. – Menelaos Feb 10 '15 at 05:22

0 Answers0