=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2015-02-05 06:53:38 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2015-04-03 15:22:51 +0000 @@ -111,6 +111,29 @@ { return name.equals( DEFAULT_CATEGORY_COMBO_NAME ); } + + /** + * Indicates whether this category combo has at least one category, has at + * least one category option combo and that all categories have at least one + * category option. + */ + public boolean isValid() + { + if ( categories == null || categories.isEmpty() || optionCombos == null || optionCombos.isEmpty() ) + { + return false; + } + + for ( DataElementCategory category : categories ) + { + if ( category == null || category.getCategoryOptions() == null || category.getCategoryOptions().isEmpty() ) + { + return false; + } + } + + return true; + } public List getCategoryOptions() { === modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java' --- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2015-03-13 15:48:26 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2015-04-03 15:22:51 +0000 @@ -214,6 +214,12 @@ for ( DataElementCategoryCombo combo : combos ) { + if ( !combo.isValid() ) + { + log.warn( "Ignoring category combo, not valid: " + combo ); + continue; + } + for ( DataElementCategoryOptionCombo coc : combo.getSortedOptionCombos() ) { List values = new ArrayList<>();