From c1ad909bd6227f437334a91f71bd108a69369cf2 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Wed, 25 Oct 2023 15:49:02 +0200 Subject: [PATCH] Small improvements to DaemonPrompter --- .../mvndaemon/mvnd/common/logging/TerminalOutput.java | 10 ++++++---- .../mvndaemon/mvnd/interactivity/DaemonPrompter.java | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java b/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java index b2d44bff4..72fa82e43 100644 --- a/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java +++ b/common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalOutput.java @@ -346,10 +346,12 @@ private boolean doAccept(Message entry) { readInput.writeLock().lock(); try { clearDisplay(); - String msg = (maxThreads > 1) - ? String.format("[%s] %s", prompt.getProjectId(), prompt.getMessage()) - : prompt.getMessage(); - terminal.writer().print(msg); + if (prompt.getMessage() != null) { + String msg = (maxThreads > 1) + ? String.format("[%s] %s", prompt.getProjectId(), prompt.getMessage()) + : prompt.getMessage(); + terminal.writer().print(msg); + } terminal.flush(); StringBuilder sb = new StringBuilder(); while (true) { diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/interactivity/DaemonPrompter.java b/daemon/src/main/java/org/mvndaemon/mvnd/interactivity/DaemonPrompter.java index 38f5104e0..56ef25d5b 100644 --- a/daemon/src/main/java/org/mvndaemon/mvnd/interactivity/DaemonPrompter.java +++ b/daemon/src/main/java/org/mvndaemon/mvnd/interactivity/DaemonPrompter.java @@ -153,7 +153,7 @@ private void doDisplay(String message) throws IOException { Connection con = Objects.requireNonNull(Connection.getCurrent()); String projectId = ProjectBuildLogAppender.getProjectId(); Message.ProjectEvent msg = Message.display(projectId, message); - LOGGER.info("Sending display request: {}", msg); + LOGGER.debug("Sending display request: {}", msg); con.dispatch(msg); } catch (Exception e) { throw new IOException("Unable to display message", e); @@ -166,9 +166,9 @@ private String doPrompt(String message, boolean password) throws IOException { String projectId = ProjectBuildLogAppender.getProjectId(); String uid = UUID.randomUUID().toString(); Message.Prompt msg = new Message.Prompt(projectId, uid, message, password); - LOGGER.info("Requesting prompt: {}", msg); + LOGGER.debug("Requesting prompt: {}", msg); Message.PromptResponse res = con.request(msg, Message.PromptResponse.class, r -> uid.equals(r.getUid())); - LOGGER.info("Received response: {}", res.getMessage()); + LOGGER.debug("Received response: {}", res.getMessage()); return res.getMessage(); } catch (Exception e) { throw new IOException("Unable to prompt user", e);