In this case, "2" does not represent the amount of repetitions occurred,
the exception message is assembled as follows:
"the default value must not have more than 2 repeated characters."
Therefore, the value "2" is implemented hardcoded.


2014-02-17 23:22 GMT-03:00 rodrigovilar <notifications@github.com>:

> In
> kernel/src/main/java/com/nanuvem/lom/kernel/validator/MaximumRepeatAttributeConfigurationValidator.java:
>
> > +	}
> > +
> > +	@Override
> > +	protected void validateDefault(List<ValidationError> errors,
> > +			Attribute attribute, JsonNode configuration, String defaultValue) {
> > +
> > +		int repeatedCharacterCounter = 0;
> > +		for (int i = 0; i < defaultValue.length(); i++) {
> > +			for (int j = i + 1; j < defaultValue.length(); j++) {
> > +				if (defaultValue.toCharArray()[i] == defaultValue.toCharArray()[j]) {
> > +					repeatedCharacterCounter++;
> > +				}
> > +			}
> > +		}
> > +		if (repeatedCharacterCounter > configuration.get(field).asInt()) {
> > +			String messagePlural = repeatedCharacterCounter > 1 ? " more than 2 "
>
> This line has a "2" hardcoded.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/rodrigovilar/lom/pull/37/files#r9810743>
> .
>



-- 
*AttFernando Mateus de Oliveira*