=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java 2015-12-10 11:32:45 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java 2015-12-10 11:41:13 +0000 @@ -179,7 +179,8 @@ Map constantMap, Map orgUnitCountMap, Integer days, Set incompleteValues ); /** - * Returns all data elements included in the given expression string. + * Returns all data elements included in the given expression string. Returns + * an empty set if the given expression is null. * * @param expression the expression string. * @return a set of data elements included in the expression string. @@ -188,7 +189,7 @@ /** * Returns all OrganisationUnitGroups in the numerator and denominator - * expressions in the given Indicators. Returns an empty list if the given + * expressions in the given Indicators. Returns an empty set if the given * indicators are null or empty. * * @param indicators the set of indicators. @@ -198,7 +199,7 @@ /** * Returns all OrganisationUnitGroups in the given expression string. Returns - * an empty list if the given indicators are null or empty. + * an set list if the given indicators are null or empty. * * @param expression the expression string. * @return a Set of OrganisationUnitGroups included in the expression string. @@ -207,7 +208,8 @@ /** * Returns all CategoryOptionCombos in the given expression string. Only - * operands with a category option combo will be included. + * operands with a category option combo will be included. Returns an empty + * set if the given expression is null. * * @param expression the expression string. * @return a Set of CategoryOptionCombos included in the expression string. @@ -218,7 +220,8 @@ * Returns all operands included in an expression string. The operand is on * the form #{data-element-id.category-option combo-id}. Only operands with * a category option combo will be included. Requires that the expression - * has been exploded in order to handle data element totals. + * has been exploded in order to handle data element totals. Returns an + * empty set if the given expression is null. * * @param expression The expression string. * @return A Set of Operands. === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2015-12-10 11:32:45 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2015-12-10 11:41:13 +0000 @@ -252,12 +252,10 @@ private Set getDataElementsInExpressionInternal( Pattern pattern, String expression ) { - Set dataElements = null; + Set dataElements = new HashSet<>();; if ( expression != null ) { - dataElements = new HashSet<>(); - final Matcher matcher = pattern.matcher( expression ); while ( matcher.find() ) @@ -318,12 +316,10 @@ @Transactional public Set getOptionCombosInExpression( String expression ) { - Set optionCombosInExpression = null; + Set optionCombosInExpression = new HashSet<>(); if ( expression != null ) { - optionCombosInExpression = new HashSet<>(); - final Matcher matcher = OPTION_COMBO_OPERAND_PATTERN.matcher( expression ); while ( matcher.find() ) @@ -345,12 +341,10 @@ @Transactional public Set getOperandsInExpression( String expression ) { - Set operandsInExpression = null; + Set operandsInExpression = new HashSet<>(); if ( expression != null ) { - operandsInExpression = new HashSet<>(); - final Matcher matcher = OPTION_COMBO_OPERAND_PATTERN.matcher( expression ); while ( matcher.find() )