Ignore:
Timestamp:
2005-09-21T14:32:25+12:00 (19 years ago)
Author:
kjdon
Message:

don't write out collectionmeta if the value is empty

File:
1 edited

Legend:

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

    r10529 r10611  
    499499                }
    500500                if(command != null && command.length()> 0 ) {
    501                 /* if command contains buildtype only, it means that the none of
    502                  * buildtype has been selected, so we don't want to write into
    503                  * collect.cfg file*/
    504                 if (!command.matches("^buildtype\\s*")){
    505                     write(buffered_writer, command);
    506                     buffered_writer.newLine();
    507                     just_wrote_newline = false;
    508                 }
     501                write(buffered_writer, command);
     502                buffered_writer.newLine();
     503                just_wrote_newline = false;
    509504                }
    510505            }
     
    782777
    783778    static private String metadataToString(Element command_element, boolean text_value) {
     779    // lets first check the value - if its empty, don't bother sticking it in the config file
     780    String value_str = XMLTools.getValue(command_element);
     781    if (value_str.equals("")) {
     782        return "";
     783    }
    784784    boolean special = false;
    785     // If there is no value attribute, then we don't write anything
     785   
    786786    StringBuffer text = new StringBuffer("");
    787787    String name_str = command_element.getAttribute(NAME_ATTRIBUTE);
    788     // If the name is one of the special four, we don't write the collectionmeta first. Note the maintainer collectionmeta is singled out for 'prittying' reasons.
     788    // If the name is one of the special four, we don't write the collectionmeta first. Note maintainer and buildtype are singled out for 'prittying' reasons.
    789789    if(name_str.equals(COLLECTIONMETADATA_MAINTAINER_STR)|| name_str.equals(BUILDTYPE_STR) ) {
    790790        text.append(name_str);
     
    817817    name_str = null;
    818818
    819     String value_str = XMLTools.getValue(command_element);
    820819    // The value string we retrieved will be encoded for xml, so we now decode it - to text if text_value set. This parameter was originally show_extracted_namespace, but sincethis is only true for 'toString()' commands from within the CDM, its good enough to determine if this toString() will be used to display on screen, or write to collect.cfg
    821820    if(text_value == CollectionMeta.TEXT) {
Note: See TracChangeset for help on using the changeset viewer.