1
0
forked from xjboss/KCauldronX

Jline's ConsoleReader reads empty string instead of null in stdin-less

environment, like exec() from many languages. Add empty check.
This commit is contained in:
Sergey Shatunov 2016-02-09 21:19:36 +07:00
parent 3b244893d9
commit 0dd6c7efdf
2 changed files with 3 additions and 16 deletions

View File

@ -12,20 +12,7 @@
{ {
if (!this.running) if (!this.running)
{ {
@@ -53,6 +53,12 @@ @@ -110,26 +110,23 @@
BufferedInputStream bufferedinputstream = new BufferedInputStream(this.clientSocket.getInputStream());
int i = bufferedinputstream.read(this.buffer, 0, 1460);
+ if (i < 10)
+ {
+ this.running = false; // Cauldron
+ return;
+ }
+
if (10 <= i)
{
byte b0 = 0;
@@ -110,26 +116,23 @@
} }
} }
} }
@ -55,7 +42,7 @@
} }
private void sendResponse(int p_72654_1_, int p_72654_2_, String p_72654_3_) throws IOException private void sendResponse(int p_72654_1_, int p_72654_2_, String p_72654_3_) throws IOException
@@ -167,6 +170,7 @@ @@ -167,6 +164,7 @@
private void closeSocket() private void closeSocket()
{ {

View File

@ -86,7 +86,7 @@
+ { + {
+ s = bufferedreader.readLine(); + s = bufferedreader.readLine();
+ } + }
+ if (s != null) + if (s != null && !s.isEmpty())
+ { + {
+ this.server.addPendingCommand(s, this.server); + this.server.addPendingCommand(s, this.server);
+ } + }