Fix: preserving blank characters (tabulator and space) in Cooja serial output

This commit is contained in:
Eugen Berlin 2013-11-26 16:43:31 +01:00
parent ec5039b9eb
commit a415c2bb1b

View file

@ -102,7 +102,7 @@ public abstract class SerialUI extends Log implements SerialPort {
if (data == '\n') { if (data == '\n') {
/* Notify observers of new log */ /* Notify observers of new log */
lastLogMessage = newMessage.toString(); lastLogMessage = newMessage.toString();
lastLogMessage = lastLogMessage.replaceAll("[^\\p{Print}]", ""); lastLogMessage = lastLogMessage.replaceAll("[^\\p{Print}\\p{Blank}]", "");
newMessage.setLength(0); newMessage.setLength(0);
this.setChanged(); this.setChanged();
this.notifyObservers(getMote()); this.notifyObservers(getMote());
@ -111,7 +111,7 @@ public abstract class SerialUI extends Log implements SerialPort {
if (newMessage.length() > MAX_LENGTH) { if (newMessage.length() > MAX_LENGTH) {
/*logger.warn("Dropping too large log message (>" + MAX_LENGTH + " bytes).");*/ /*logger.warn("Dropping too large log message (>" + MAX_LENGTH + " bytes).");*/
lastLogMessage = "# [1024 bytes, no line ending]: " + newMessage.substring(0, 20) + "..."; lastLogMessage = "# [1024 bytes, no line ending]: " + newMessage.substring(0, 20) + "...";
lastLogMessage = lastLogMessage.replaceAll("[^\\p{Print}]", ""); lastLogMessage = lastLogMessage.replaceAll("[^\\p{Print}\\p{Blank}]", "");
newMessage.setLength(0); newMessage.setLength(0);
this.setChanged(); this.setChanged();
this.notifyObservers(getMote()); this.notifyObservers(getMote());