This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch 2.0.X
in repository https://gitbox.apache.org/repos/asf/mina.git


The following commit(s) were added to refs/heads/2.0.X by this push:
     new 167d788  Backported Colm patch
167d788 is described below

commit 167d788e1f6db76b335036a2557b070cbfe596db
Author: emmanuel lecharny <elecha...@apache.org>
AuthorDate: Tue Feb 8 02:19:09 2022 +0100

    Backported Colm patch
---
 .../apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java  | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/mina-core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java
 
b/mina-core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java
index 627afb3..3c6381e 100644
--- 
a/mina-core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java
+++ 
b/mina-core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMUtilities.java
@@ -118,17 +118,17 @@ public class NTLMUtilities implements NTLMConstants {
         // an exception and deal with the special cases.
         try {
             Process pr = Runtime.getRuntime().exec("cmd /C ver");
-            BufferedReader reader = new BufferedReader(new 
InputStreamReader(pr.getInputStream()));
-            pr.waitFor();
 
             String line;
 
             // We loop as we may have blank lines.
-            do {
-                line = reader.readLine();
-            } while ((line != null) && (line.length() != 0));
+            try (BufferedReader reader = new BufferedReader(new 
InputStreamReader(pr.getInputStream()))) {
+                pr.waitFor();
 
-            reader.close();
+                do {
+                    line = reader.readLine();
+                } while ((line != null) && (line.length() != 0));
+            }
 
             // If line is null, we must not go any farther
             if (line == null) {

Reply via email to