Changeset 32553 for main/trunk


Ignore:
Timestamp:
2018-10-30T13:28:34+13:00 (5 years ago)
Author:
kjdon
Message:

allow missing groupDescriptions element in groupConfig.xml

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/CollectionGroups.java

    r32293 r32553  
    393393        hierarchy = (Element) GSXML.getChildByTagName(content, GSXML.HIERARCHY_ELEM);
    394394        groupDesc = (Element) GSXML.getChildByTagName(content, GSXML.GROUP_DESC_ELEM);
    395         if (hierarchy == null || groupDesc == null){
    396             logger.error("Error processing groups configuration. <groupConfig> should have both <hierarchy> and <groupDescriptions> elements. Check groupConfig.xml");
     395        if (hierarchy == null){
     396            logger.error("<groupConfig> has no <hierarchy> element, ignoring it.");
    397397            return false;
    398398        }
    399         verifyGroupDescription();
     399        verifyGroupDescription(doc);
    400400        return true;
    401401    }
    402402
    403     private void verifyGroupDescription() {
    404         Document doc = groupDesc.getOwnerDocument();
     403    private void verifyGroupDescription(Document doc) {
     404      if (groupDesc == null) {
     405        // we set up one for ourselves
     406        groupDesc = doc.createElement(GSXML.GROUP_DESC_ELEM);
     407      }
     408     
     409      //    Document doc = groupDesc.getOwnerDocument();
    405410        NodeList groups = hierarchy.getElementsByTagName(GSXML.GROUP_ELEM);
    406411        for (int i = 0; i < groups.getLength(); i++) {
Note: See TracChangeset for help on using the changeset viewer.