- Timestamp:
- 2017-04-21T21:09:08+12:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/greenstone/Classifiers.java
r20924 r31636 37 37 import org.greenstone.gatherer.cdm.Classifier; 38 38 import org.greenstone.gatherer.remote.RemoteGreenstoneServer; 39 import org.greenstone.gatherer.util.SafeProcess; 39 40 import org.greenstone.gatherer.util.StaticStrings; 40 41 import org.greenstone.gatherer.util.Utility; … … 150 151 args.add(classifier.getName()); 151 152 152 // Run the classinfo.pl process 153 Runtime runtime = Runtime.getRuntime(); 154 Process process = runtime.exec((String[]) args.toArray(new String[] { })); 155 InputStream input_stream = process.getErrorStream(); 156 StringBuffer classinfo_xml_buffer = XMLTools.readXMLStream(input_stream); 157 if (classinfo_xml_buffer != null) { 158 classinfo_xml = classinfo_xml_buffer.toString(); 159 } 153 154 // Run the classinfo.pl process: 155 // Create the process. 156 SafeProcess process = new SafeProcess((String[]) args.toArray(new String[] { })); 157 158 // run the SafeProcess 159 int exitVal = process.runProcess(); 160 if(exitVal != 0) { 161 throw new Exception("*** Error running classify.pl loadClassifierInfo, process exited with: " 162 + exitVal); 163 } 164 // get the result: We expect XML to have come out of the process std error stream. 165 classinfo_xml = process.getStdError(); 166 ///System.err.println("*********\nClassifierInfo, got:\n" + classinfo_xml + "\n**********\n"); 160 167 } 161 168 … … 208 215 args.add("-xml"); 209 216 210 // Run the classinfo.pl process 211 Runtime runtime = Runtime.getRuntime(); 212 Process process = runtime.exec((String[]) args.toArray(new String[] { })); 213 InputStream input_stream = process.getErrorStream(); 214 xml = XMLTools.readXMLStream(input_stream); 217 // Run the classinfo.pl process: 218 // Create the process. 219 SafeProcess process = new SafeProcess((String[]) args.toArray(new String[] { })); 220 221 // run the SafeProcess 222 int exitVal = process.runProcess(); 223 if(exitVal != 0) { 224 throw new Exception("*** Error running classify.pl loadClassifiersList, process exited with: " 225 + exitVal); 226 } 227 // get the result: We expect XML to have come out of the process std error stream. 228 xml = new StringBuffer(process.getStdError()); 229 ///System.err.println("*********\nClassifierList, got:\n" + xml + "\n**********\n"); 215 230 } 216 231
Note:
See TracChangeset
for help on using the changeset viewer.