Ignore:
Timestamp:
2008-10-28T16:41:47+13:00 (16 years ago)
Author:
mdewsnip
Message:

Fix to bug where some "subcollection" entries in the collect.cfg file are mangled if they have empty bits. Many thanks to Jeffrey Ke from DL Consulting Ltd.

File:
1 edited

Legend:

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

    r17612 r17616  
    14281428                    command_element.setAttribute (StaticStrings.TYPE_ATTRIBUTE, StaticStrings.INCLUDE_STR);
    14291429                }
    1430                 StringTokenizer pattern_tokenizer = new StringTokenizer (full_pattern_str, StaticStrings.SEPARATOR_CHARACTER);
    1431                 if(pattern_tokenizer.countTokens () >= 2) {
    1432                     String content_str = pattern_tokenizer.nextToken ();
     1430
     1431                // Let's make sure it is a valid Greenstone configuration line
     1432                String[] results = full_pattern_str.split("\\" + StaticStrings.SEPARATOR_CHARACTER, 3);
     1433
     1434                if (results.length >= 2) {
     1435                    String content_str = results[0];
    14331436                    // Since the contents of indexes have to be certain keywords, or metadata elements, if the content isn't a keyword and doesn't yet have a namespace, append the extracted metadata namespace.
    1434                     if(!content_str.equals (StaticStrings.FILENAME_STR) && content_str.indexOf (StaticStrings.NS_SEP) == -1) {
     1437                    if (!content_str.equals (StaticStrings.FILENAME_STR) && content_str.indexOf (StaticStrings.NS_SEP) == -1) {
    14351438                        content_str = StaticStrings.EXTRACTED_NAMESPACE + content_str;
    14361439                    }
    14371440                    command_element.setAttribute (StaticStrings.CONTENT_ATTRIBUTE, content_str);
    1438                     XMLTools.setValue (command_element, pattern_tokenizer.nextToken ());
    1439                     if(pattern_tokenizer.hasMoreTokens ()) {
    1440                         command_element.setAttribute (StaticStrings.OPTIONS_ATTRIBUTE, pattern_tokenizer.nextToken ());
    1441                     }
    1442                 }
    1443                 pattern_tokenizer = null;
     1441                    XMLTools.setValue (command_element, results[1]);
     1442                    if (results.length >= 3) {
     1443                        command_element.setAttribute (StaticStrings.OPTIONS_ATTRIBUTE, results[2]);
     1444                    }
     1445                }
    14441446            }
    14451447        }
Note: See TracChangeset for help on using the changeset viewer.