Changeset 4510


Ignore:
Timestamp:
2003-06-09T11:46:48+12:00 (21 years ago)
Author:
jmt12
Message:

2030109: If can now read in some crazily (but not poorly) formed collect.cfg files.

File:
1 edited

Legend:

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

    r4494 r4510  
    235235     * @see org.greenstone.gatherer.util.EmailAddress
    236236     */
     237    private BufferedReader in;
     238    /** If one of the submanagers detects that it hasn't been provided enough arguments (such as format which always requires at least three) it can call this method to request another line of text from the collect.cfg. If the collect.cfg was not well formed this will cause some problems, but that can't be helped.
     239     * @param prefix the String we have so far
     240     * @return a String with a further line form the collect.cfg appended
     241     */
     242    public String parseMore(String prefix) {
     243    ///ystem.err.println("Command incomplete: " + prefix);
     244    try {
     245        String suffix = in.readLine();
     246        ///ystem.err.println("Adding: " + suffix);
     247        if(suffix != null) {
     248        prefix = prefix + " " + suffix;
     249        }
     250        suffix = null;
     251    }
     252    catch(Exception error) {
     253        error.printStackTrace();
     254    }
     255    return prefix;
     256    }
     257
    237258    public void parse(String filename) {
    238259    try {
    239260        in_file = new File(filename);
    240261        FileReader in_reader = new FileReader(in_file);
    241         BufferedReader in = new BufferedReader(in_reader);
     262        in = new BufferedReader(in_reader);
    242263        String command = null;
    243264        while((command = in.readLine()) != null) {
    244265        if(command.length() > 0) {
     266            // Now we've finished parsing a command line, see what manager wants a piece of it.
    245267            // We have to test the end of command for the special character '\'. If found, remove it and append the next line, then repeat.
    246268            while(command.trim().endsWith("\\")) {
    247             command = command.substring(0, command.lastIndexOf("\\"));
    248             String next_line = in.readLine();
    249             if(next_line != null) {
     269            String next_line = (in.readLine()).trim();
     270            if(next_line != null && next_line.length() > 0) {
     271                command = command.substring(0, command.lastIndexOf("\\"));
    250272                command = command + next_line;
    251273            }
Note: See TracChangeset for help on using the changeset viewer.