You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2022/04/15 13:10:36 UTC

[wicket] branch wicket-9.x updated: [WICKET-6971] NullPointerException in ModificationWatcher (#510)

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

mgrigorov pushed a commit to branch wicket-9.x
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/wicket-9.x by this push:
     new 07b08ffd10 [WICKET-6971] NullPointerException in ModificationWatcher (#510)
07b08ffd10 is described below

commit 07b08ffd10c3aabbf6f1d8f4e44d2b49c679152f
Author: Ryo <tr...@gmail.com>
AuthorDate: Fri Apr 15 22:09:02 2022 +0900

    [WICKET-6971] NullPointerException in ModificationWatcher (#510)
    
    (cherry picked from commit 541615be7d6fec61db84e6f1f94fc65227d22eef)
---
 .../src/main/java/org/apache/wicket/util/io/Connections.java      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/wicket-util/src/main/java/org/apache/wicket/util/io/Connections.java b/wicket-util/src/main/java/org/apache/wicket/util/io/Connections.java
index 13d50c2a00..b7f419fa66 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/io/Connections.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/io/Connections.java
@@ -18,6 +18,7 @@ package org.apache.wicket.util.io;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.JarURLConnection;
 import java.net.URL;
@@ -129,7 +130,12 @@ public class Connections
 			// otherwise it leaks open file handles. See WICKET-4359.
 			// Most other connection types should not call getInputStream() here,
 			// especially remote connections.
-			connection.getInputStream().close();
+			InputStream inputStream = connection.getInputStream();
+
+			if (inputStream != null)
+			{
+				inputStream.close();
+			}
 		}
 
 		if (connection instanceof HttpURLConnection)