Changeset 24425


Ignore:
Timestamp:
2011-08-18T20:00:27+12:00 (13 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.

File:
1 edited

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    }
Note: See TracChangeset for help on using the changeset viewer.