Allon Mureinik has uploaded a new change for review.

Change subject: tools: StandaloneDataSource: configReader.close
......................................................................

tools: StandaloneDataSource: configReader.close

Fixed a possible NPE when closing configReader in the finally block if
it wasn't initialized properly.

Change-Id: Ia0352afa56f226d8573fc4f55bf08db32510e3b0
Signed-off-by: Allon Mureinik <[email protected]>
---
M 
backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/36/12336/1

diff --git 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
index 0558842..008b8f7 100644
--- 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
+++ 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
@@ -59,11 +59,12 @@
             throw new SQLException("Can't load engine configuration file \"" + 
configFile.getAbsolutePath() + "\".", exception);
         }
         finally {
-            try {
-                configReader.close();
-            }
-            catch (IOException exception) {
-                log.warn("Strange, failed to close file \"" + 
configFile.getAbsolutePath() + "\".", exception);
+            if (configReader != null) {
+                try {
+                    configReader.close();
+                } catch (IOException exception) {
+                    log.warn("Strange, failed to close file \"" + 
configFile.getAbsolutePath() + "\".", exception);
+                }
             }
         }
 


--
To view, visit http://gerrit.ovirt.org/12336
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia0352afa56f226d8573fc4f55bf08db32510e3b0
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to