NPE when enter blank string into maximum results field in WebFilter #PL-3005

This commit is contained in:
Ilya Chekashkin 2013-10-28 10:09:42 +00:00
parent 6943289dda
commit 550b60b2f0

View File

@ -433,16 +433,19 @@ public class WebFilter extends WebAbstractComponent<CubaVerticalActionsLayout> i
applyDatasourceFilter();
if (useMaxResults) {
int maxResults;
if (BooleanUtils.isTrue(maxResultsCb.getValue()))
int maxResults = 0;
if (BooleanUtils.isTrue(maxResultsCb.getValue())) {
String maxResultsFieldValue = maxResultsField.getValue();
if (StringUtils.isNotBlank(maxResultsFieldValue)) {
try {
//noinspection ConstantConditions
maxResults = Datatypes.get(Integer.class).parse(maxResultsField.getValue(), userSessionSource.getLocale());
maxResults = Datatypes.get(Integer.class).parse(maxResultsFieldValue, userSessionSource.getLocale());
} catch (ParseException e) {
throw new Validator.InvalidValueException("");
}
else
} else
maxResults = persistenceManager.getMaxFetchUI(datasource.getMetaClass().getName());
}
datasource.setMaxResults(maxResults);
}
if (datasource instanceof CollectionDatasource.SupportsPaging)