Greg Padgett has uploaded a new change for review.

Change subject: core: Fix removing multiple snapshots from snapshots overview
......................................................................

core: Fix removing multiple snapshots from snapshots overview

When removing multiple snapshots at a time from the snapshots overview,
NPEs would occur due to referencing prior snapshots during the endAction
of successive snapshots.  Now, the last snapshot in the list is
referenced, and where applicable, it's okay for certain data to be
unavailable.

Change-Id: Iaf62d0c7a6d1aef0ebe874ec9da9dbc58b6d4dba
Related-To: https://bugzilla.redhat.com/1133890
Signed-off-by: Greg Padgett <gpadg...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskSnapshotsCommand.java
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/03/33003/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskSnapshotsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskSnapshotsCommand.java
index 839b7dd..43e84dd 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskSnapshotsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskSnapshotsCommand.java
@@ -219,9 +219,11 @@
     private List<String> getSnapshotsNames() {
         List<String> snapshotsNames = new LinkedList<>();
         for (DiskImage image : getImages()) {
-            Snapshot snapshot = getSnapshotDao().get(image.getSnapshotId());
-            if (snapshot != null) {
-                snapshotsNames.add(snapshot.getDescription());
+            if (image != null) {
+                Snapshot snapshot = 
getSnapshotDao().get(image.getSnapshotId());
+                if (snapshot != null) {
+                    snapshotsNames.add(snapshot.getDescription());
+                }
             }
         }
         return snapshotsNames;
@@ -288,7 +290,8 @@
     }
 
     protected DiskImage getRepresentativeImage() {
-        return getImages().get(0);
+        List<DiskImage> images = getImages();
+        return images.get(images.size() - 1);
     }
 
     @Override


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf62d0c7a6d1aef0ebe874ec9da9dbc58b6d4dba
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett <gpadg...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to