in impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java [1358:1474]
private void _validateAttributes() throws FacesException
{
int begin = getBegin();
int end = getEnd();
int size = getSize();
_emptyModel = getDataModel() == EMPTY_MODEL && begin != -1 && end != -1;
int count = getRowCount();
int offset = getOffset();
if (begin == -1)
{
if (size >= 0)
{
end = getOffset() + getSize();
}
}
if (end == -1 && size == -1)
{
if (begin == -1)
{
end = getDataModel().getRowCount();
}
else
{
end = getDataModel().getRowCount() - 1;
}
}
int step = getStep();
boolean sizeIsEnd = _emptyModel;
boolean countdown = _emptyModel && end < begin;
if (size == -1)
{
if (begin == -1)
{
size = end;
sizeIsEnd = true;
}
else
{
size = countdown ? (begin - end + 1)/step : (end - begin + 1)/step;
}
}
step = countdown && step > 0 ? -step : step;
if (_emptyModel)
{
if (step > 0 && (end < begin))
{
throw new LocationAwareFacesException("on empty models, end cannot be less than begin " +
"when the step is positive", this);
}
else if (step < 0 && (end > begin))
{
throw new LocationAwareFacesException("on empty models, end cannot be greater than begin " +
"when the step is negative", this);
}
setStep(step);
}
else if (end >= 0)
{
if (size < 0)
{
throw new LocationAwareFacesException("iteration size cannot be less than zero", this);
}
else if (!sizeIsEnd && (begin == -1) && (offset + size) > end)
{
throw new LocationAwareFacesException("iteration size cannot be greater than collection size", this);
}
else if (!sizeIsEnd && (begin == -1) && (offset + size) > count)
{
throw new LocationAwareFacesException("iteration size cannot be greater than collection size", this);
}
else if (!sizeIsEnd && (begin >= 0) && (begin + size) > end+1)
{
throw new LocationAwareFacesException("iteration size cannot be greater than collection size", this);
}
else if(!sizeIsEnd && (begin >= 0) && (end+1 > count))
{
throw new LocationAwareFacesException("end cannot be greater than collection size", this);
}
else if(!sizeIsEnd && (begin >= 0) && (begin > count))
{
throw new LocationAwareFacesException("begin cannot be greater than collection size", this);
}
}
if (begin >= 0 && begin > end)
{
throw new LocationAwareFacesException("begin cannot be greater than end", this);
}
if (size > -1 && offset > end)
{
throw new LocationAwareFacesException("iteration offset cannot be greater than collection size", this);
}
if (!_emptyModel && step == -1)
{
setStep(1);
}
if (!_emptyModel && step < 0)
{
throw new LocationAwareFacesException("iteration step size cannot be less than zero", this);
}
else if (step == 0)
{
throw new LocationAwareFacesException("iteration step size cannot be equal to zero", this);
}
_end = end;
}