Skip to content

Commit

Permalink
core: do not use double-brace initialization for parameter value
Browse files Browse the repository at this point in the history
Initializing a HashMap with double-brace create an inner class and the
value of diskImagesMap will be a HashMap wrapped in:
    org.ovirt.engine.core.bll.storage.lsm.LiveMigrateDiskCommand$1
Instead of just a HashMap, and LiveMigrateDiskCommand is not deserializable
which will prevent ovirt-engine from starting when it tries to reload
command_entities

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
  • Loading branch information
bennyz authored and ahadas committed Jul 14, 2022
1 parent 1691f23 commit 03cab35
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ private Map<Guid, DiskImage> createDiskImagesMap() {
DiskImage diskParams = new DiskImage();

diskParams.setInitialSizeInBytes(ImagesHandler.computeImageInitialSizeInBytes(disk.getImage()));
return new HashMap<>() {{
put(disk.getId(), diskParams);
}};
Map<Guid, DiskImage> diskImagesMap = new HashMap<>();
diskImagesMap.put(disk.getId(), diskParams);
return diskImagesMap;
}
}
return new HashMap<>();
Expand Down

0 comments on commit 03cab35

Please sign in to comment.