Changeset 24425

Show
Ignore:
Timestamp:
18.08.2011 20:00:27 (8 years ago)
Author:
ak19
Message:

Fixed the error whereby completely deleting a GS3 format statement from GLI (this issue was encountered in the format statement for Browse) caused a double up of format elements to be written out to the collectionConfig.xml (<format><format /></format>) which was both wrong and prevented GLI from reopening that collection.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfigXMLReadWrite.java

    r24367 r24425  
    561561      format_element.setAttribute (StaticStrings.NAME_ATTRIBUTE, name_str); 
    562562    } 
    563     if (format != null) { 
     563     
     564    // Don't write out an empty format statement of <format/> (i.e. format has no child nodes) 
     565    // as this will end up embedded in another format statement as <format><format/><format /> 
     566    // This doubling up of format stmts will then prevent GLI from opening the collection again. 
     567    if (format != null && format.hasChildNodes()) { // not an empty format statement 
    564568      String gsf_text = XMLTools.xmlNodeToStringWithoutIndenting(format); 
    565                 
     569 
    566570      if (gsf_text.startsWith("<") && (gsf_text.indexOf("<") != gsf_text.lastIndexOf("<"))) { 
    567571    gsf_text = gsf_text.substring(gsf_text.indexOf("<gsf"), 
    568572                      gsf_text.indexOf(StaticStrings.FORMAT_END_TAG)); 
    569573      } 
    570                  
     574       
    571575      XMLTools.setNodeText(format_element, gsf_text); 
    572576    }