Changeset 4580
- Timestamp:
- 2003-06-11T16:35:01+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
r4578 r4580 35 35 *######################################################################## 36 36 */ 37 38 39 40 41 42 43 /* GPL_HEADER */44 37 package org.greenstone.gatherer.cdm; 45 /************************************************************************************** 46 * Title: Gatherer 47 * Description: The Gatherer: a tool for gathering and enriching a digital collection. 48 * Company: The University of Waikato 49 * Written: 01/05/02 50 * Revised: 16/08/02 Optimized and Commented. 51 **************************************************************************************/ 38 52 39 import java.awt.BorderLayout; 53 40 import java.awt.Color; … … 289 276 Runtime runtime = Runtime.getRuntime(); 290 277 Process process = runtime.exec(args); 291 InputStream input_stream = process.getErrorStream();292 278 BufferedReader error_in = new BufferedReader(new InputStreamReader(process.getErrorStream())); 293 279 String line = ""; 294 280 StringBuffer xml = new StringBuffer(""); 281 boolean xml_content = false; 295 282 while((line = error_in.readLine()) != null) { 296 xml.append(line); 297 xml.append("\n"); 298 } 299 // Then read the xml from the piped input stream. 300 InputSource source = new InputSource(new StringReader(xml.toString())); 301 DOMParser parser = new DOMParser(); 302 parser.parse(source); 303 document = parser.getDocument(); 283 if(xml_content) { 284 xml.append(line); 285 xml.append("\n"); 286 } 287 else if(line.trim().startsWith("<?xml")) { 288 xml_content = true; 289 xml.append(line); 290 xml.append("\n"); 291 } 292 } 293 error_in = null; 294 process = null; 295 runtime = null; 296 // If something has gone horribly wrong then xml will be empty. 297 if(xml.length() != 0) { 298 // Then read the xml from the piped input stream. 299 InputSource source = new InputSource(new StringReader(xml.toString())); 300 DOMParser parser = new DOMParser(); 301 parser.parse(source); 302 document = parser.getDocument(); 303 parser = null; 304 source = null; 305 } 306 else { 307 String classifier_name = getClassifierName(classifier); 308 Gatherer.println("Zero length argument xml detected for: " + classifier_name); 309 JOptionPane.showMessageDialog(Gatherer.g_man, get("Classifier_XML_Parse_Failed", classifier_name), get("General.Error"), JOptionPane.ERROR_MESSAGE); 310 classifier_name = null; 311 } 304 312 } 305 313 catch (Exception error) { … … 537 545 * @see org.greenstone.gatherer.Gatherer 538 546 */ 539 private String get(String key, String args[]) { 547 private String get(String key, String arg) { 548 String[] args = null; 549 if(arg != null) { 550 args = new String[1]; 551 args[0] = arg; 552 } 540 553 if(key.indexOf(".") == -1) { 541 554 key = "CDM.ClassifierManager." + key;
Note:
See TracChangeset
for help on using the changeset viewer.