fixed receiving blank lines on stdin

This commit is contained in:
technillogue 2020-11-15 17:02:24 +00:00
parent 5f9d4f89e6
commit a746b8aae7
2 changed files with 30 additions and 31 deletions

View file

@ -45,9 +45,9 @@ class InputReader implements Runnable {
while (alive) { while (alive) {
try { try {
String in = br.readLine(); String in = br.readLine();
String args[] = in.split(":", 2);
// properly this ought to be json or some sort of serialization to not miss multiline messages // properly this ought to be json or some sort of serialization to not miss multiline messages
if (args.length == 2) { if (in != null && in.split(":", 2).length == 2) {
String args[] = in.split(":", 2);
String message = args[1]; String message = args[1];
List<String> recipients = new ArrayList<String>(); List<String> recipients = new ArrayList<String>();
recipients.add(args[0]); recipients.add(args[0]);
@ -57,15 +57,14 @@ class InputReader implements Runnable {
this.m.sendMessage(message, attachments, recipients); this.m.sendMessage(message, attachments, recipients);
} catch (AssertionError | EncapsulatedExceptions| AttachmentInvalidException | InvalidNumberException e) { } catch (AssertionError | EncapsulatedExceptions| AttachmentInvalidException | InvalidNumberException e) {
System.err.println("aaaaaa (DaemonCommand L59)"); System.err.println("aaaaaa (DaemonCommand L59)");
e.printStackTrace(System.out); e.printStackTrace(System.err);
} }
} }
} catch (IOException e) { } catch (IOException e) {
System.err.println("aaaaaa (DaemonCommand L64)");
System.err.println(e); System.err.println(e);
} }
// getMessageSender().sendTyping(signalServiceAddress?, ....) // getMessageSender().sendTyping(signalServiceAddress?, ....)
} }
} }
} }