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

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


The following commit(s) were added to refs/heads/2.1.X by this push:
     new 1f65b00  Make sure the input stream is closed
     new 0771aa8  Merge pull request #23 from coheigea/ioclose
1f65b00 is described below

commit 1f65b00a781b9e7fa4552a2b984c83c2e3fa9ebd
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Tue Jun 18 10:52:59 2019 +0100

    Make sure the input stream is closed
---
 .../mina/proxy/handlers/http/ntlm/NTLMUtilities.java      | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 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..ac6dd43 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,16 @@ 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();
+                   // We loop as we may have blank lines.
+                   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