Sharad Mishra has uploaded a new change for review.

Change subject: core: Fix possible NPE in GetoVirtISOsQuery.
......................................................................

core: Fix possible NPE in GetoVirtISOsQuery.

FindBugs issue -

GetoVirtISOsQuery.java:186, NP_DEREFERENCE_OF_READLINE_VALUE, Priority: Low

Dereference of the result of readLine() without nullcheck in 
org.ovirt.engine.core.bll.GetoVirtISOsQuery.readVdsmCompatibiltyVersion(String)

The result of invoking readLine() is dereferenced without checking to see if 
the result is null. If there are no more lines of text to read, readLine() will 
return null and dereferencing that will generate a null pointer exception.

Change-Id: I334832b5fefa24de732f919555b3ad26f11b8d08
Signed-off-by: Sharad Mishra <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/8686/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
index e20a356..0f3373b 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetoVirtISOsQuery.java
@@ -183,7 +183,10 @@
             BufferedReader input = null;
             try {
                 input = new BufferedReader(new FileReader(file));
-                versions = input.readLine().split(",");
+                String lineRead = input.readLine();
+                if (lineRead != null) {
+                    versions = lineRead.split(",");
+                }
             } catch (FileNotFoundException e) {
                 log.errorFormat("Failed to open version file {0} with error 
{1}",
                         file.getParent(),


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

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

Reply via email to