1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Do not pass an empty string.

This commit is contained in:
Alain Magloire 2004-02-02 14:18:09 +00:00
parent 0dc064bbd6
commit e2482f2bc6

View file

@ -41,28 +41,37 @@ public class TxThread extends Thread {
} }
if (cmd != null) { if (cmd != null) {
String str = cmd.toString();
// if string is empty consider as a noop
if (str.length() > 0) {
// Move to the RxQueue only if RxThread is alive. // Move to the RxQueue only if RxThread is alive.
Thread rx = session.getRxThread(); Thread rx = session.getRxThread();
if (rx != null && rx.isAlive()) { if (rx != null && rx.isAlive()) {
CommandQueue rxQueue = session.getRxQueue(); CommandQueue rxQueue = session.getRxQueue();
rxQueue.addCommand(cmd); rxQueue.addCommand(cmd);
} else { } else {
// The RxThread is not running
synchronized (cmd) { synchronized (cmd) {
cmd.notifyAll(); cmd.notifyAll();
} }
} }
// May need to fire event. // Process the Command line to recognise patterns we may need to fire event.
if (cmd instanceof CLICommand) { if (cmd instanceof CLICommand) {
cli.process((CLICommand)cmd); cli.process((CLICommand)cmd);
} }
// shove in the pipe // shove in the pipe
String str = cmd.toString(); if (out != null) {
if (out != null && str.length() > 0) {
out.write(str.getBytes()); out.write(str.getBytes());
out.flush(); out.flush();
} }
} else {
// String is empty consider as a noop
synchronized (cmd) {
cmd.notifyAll();
}
}
} }
} }
} catch (IOException e) { } catch (IOException e) {