gnodet-bot commented on code in PR #13955:
URL: https://github.com/apache/maven/pull/13955#discussion_r4561731525


##########
impl/maven-jline/src/main/java/org/apache/maven/jline/MessageUtils.java:
##########
@@ -39,37 +41,33 @@ public class MessageUtils {
 
     public static void systemInstall(Terminal terminal) {
         MessageUtils.terminal = terminal;
-        MessageUtils.reader = terminal != null ? createReader(terminal) : null;
+        MessageUtils.reader = createReader(terminal);

Review Comment:
   🐛 **Bug:** Null guard removed — `createReader(null)` does not return `null`. 
`LineReaderBuilder.build()` with a `null` terminal calls 
`TerminalBuilder.terminal()`, which opens a new system terminal. Callers that 
use `systemInstall((Terminal) null)` as a cleanup/reset (`MavenCli.java:321`, 
`MavenCliTest` `@AfterEach`) will now leak a terminal and leave `reader` in a 
live state instead of resetting it to `null`.
   
   ```suggestion
           MessageUtils.reader = terminal != null ? createReader(terminal) : 
null;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to