MCPcopy Create free account
hub / github.com/BaseXdb/basex / error

Method error

basex-core/src/main/java/org/basex/util/Util.java:308–325  ·  view source on GitHub ↗

Returns the error message of a process. @param process process @param timeout time out in milliseconds @return error message or null

(final Process process, final int timeout)

Source from the content-addressed store, hash-verified

306 * @return error message or {@code null}
307 */
308 public static String error(final Process process, final int timeout) {
309 final int wait = 200, to = Math.max(timeout / wait, 1);
310 for(int c = 0; c < to; c++) {
311 try {
312 final int exit = process.exitValue();
313 if(exit == 1) return new IOStream(process.getErrorStream()).readString();
314 break;
315 } catch(final IllegalThreadStateException ex) {
316 debug(ex);
317 // process is still running
318 Performance.sleep(wait);
319 } catch(final IOException ex) {
320 // return error message of exception
321 return ex.getLocalizedMessage();
322 }
323 }
324 return null;
325 }
326
327 /**
328 * Returns the contents of a property resource.

Callers 2

startMethod · 0.95
startMethod · 0.95

Calls 5

debugMethod · 0.95
sleepMethod · 0.95
maxMethod · 0.45
readStringMethod · 0.45
getLocalizedMessageMethod · 0.45

Tested by

no test coverage detected