Changeset 31641 for main/trunk/gli


Ignore:
Timestamp:
05/02/17 18:15:31 (4 years ago)
Author:
ak19
Message:

Bugfix after changing over to SafeProcess: XML parsing failed because of something else being printed to STDERR before the actual XML, which the old code had been handling. Now the new code handles it too.

File:
1 edited

Legend:

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

    r31636 r31641  
    206206    // Run pluginfo.pl to get the list of plugins
    207207    try {
    208         StringBuffer xml = null;
     208        String xml = null;
    209209        if (Gatherer.isGsdlRemote) {
    210210        String pluginfo_options = "&listall";
     
    213213        }
    214214        String pluginfo_output = Gatherer.remoteGreenstoneServer.getScriptOptions("pluginfo.pl", pluginfo_options);
    215         xml = new StringBuffer(pluginfo_output);
     215        xml = pluginfo_output;
    216216        }
    217217        else {
     
    247247                    + exitVal);
    248248        }
    249         // get the result: We expect XML to have come out of the process std error stream.
    250         xml = new StringBuffer(process.getStdError());
     249        // get the result: We expect XML to have come out of the process std error stream. 
     250        xml = process.getStdError();
     251
     252        // for pluginfo.pl -listall, we see a "AutoloadConverters" (PDFBox) message
     253        // before actual XML output, which breaks XML parsing. Get rid of output before "<?xml"
     254        int startIndex = xml.indexOf("<?xml");
     255        if(startIndex != 0) {
     256            xml = xml.substring(startIndex);
     257        }
    251258        ///System.err.println("*********\nPluginsList, got:\n" + xml + "\n**********\n");
    252259        }
     
    259266
    260267        if (collection_name != null) {
    261         collection_specific_plugins_list = parsePluginsListXML(xml.toString());
     268        collection_specific_plugins_list = parsePluginsListXML(xml);
    262269        }
    263270        else {
    264         core_greenstone_plugins_list = parsePluginsListXML(xml.toString());
     271        core_greenstone_plugins_list = parsePluginsListXML(xml);
    265272        }
    266273    }
Note: See TracChangeset for help on using the changeset viewer.