aboutsummaryrefslogtreecommitdiff
path: root/juick-console/src/main/java/com/juick/console
diff options
context:
space:
mode:
Diffstat (limited to 'juick-console/src/main/java/com/juick/console')
-rw-r--r--juick-console/src/main/java/com/juick/console/ConsoleApp.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/juick-console/src/main/java/com/juick/console/ConsoleApp.java b/juick-console/src/main/java/com/juick/console/ConsoleApp.java
index 22a26609..bfa3eae3 100644
--- a/juick-console/src/main/java/com/juick/console/ConsoleApp.java
+++ b/juick-console/src/main/java/com/juick/console/ConsoleApp.java
@@ -10,6 +10,8 @@ import org.jline.reader.LineReaderBuilder;
import org.jline.reader.UserInterruptException;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
@@ -22,6 +24,9 @@ import java.lang.reflect.InvocationTargetException;
* Created by vitalyster on 19.12.2016.
*/
public class ConsoleApp {
+
+ private static final Logger logger = LoggerFactory.getLogger(ConsoleApp.class);
+
@Inject
JuickProtocol juickProtocol;
@Inject
@@ -49,19 +54,20 @@ public class ConsoleApp {
while (true) {
try {
String input = reader.readLine(prompt, null, null);
+ if (input == null) {
+ logger.error("invalid terminal");
+ break;
+ }
ProtocolReply reply = juickProtocol.getReply(user, input);
out.println(reply.getResult());
out.flush();
} catch (UserInterruptException e) {
-
+ logger.debug("user interrupt");
} catch (EndOfFileException e) {
+ logger.debug("app exit");
break;
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
+ } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+ logger.warn("protocol exception", e);
}
}
} else {