GUACAMOLE-362: Avoid NullPointerException when closing input stream.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/32ccde08
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/32ccde08
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/32ccde08

Branch: refs/heads/master
Commit: 32ccde08d242f4ca3257d6bb800153b36d1e9325
Parents: 91e5702
Author: Nick Couchman <vn...@apache.org>
Authored: Sat Oct 28 14:19:37 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Sat Oct 28 14:19:37 2017 -0400

----------------------------------------------------------------------
 .../guacamole/auth/cas/conf/PrivateKeyGuacamoleProperty.java      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/32ccde08/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/conf/PrivateKeyGuacamoleProperty.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/conf/PrivateKeyGuacamoleProperty.java
 
b/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/conf/PrivateKeyGuacamoleProperty.java
index d71ae1a..455f177 100644
--- 
a/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/conf/PrivateKeyGuacamoleProperty.java
+++ 
b/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/conf/PrivateKeyGuacamoleProperty.java
@@ -81,7 +81,8 @@ public abstract class PrivateKeyGuacamoleProperty implements 
GuacamoleProperty<P
                 throw new GuacamoleServerException("Key is not in expected 
PKCS8 encoding.", e);
             }
             finally {
-                keyStreamIn.close();
+                if (keyStreamIn != null)
+                    keyStreamIn.close();
             }
         }
         catch (IOException e) {

Reply via email to