bhouse-nexthop opened a new issue, #14770:
URL: https://github.com/apache/cloudstack/issues/14770
### problem
`SnapshotDataFactoryImpl.getSnapshot(snapshotId, role, zoneId,
retrieveAnySnapshotFromVolume)` (used by `getSnapshotWithRoleAndZone`) has a
stray `;` in its fallback loop:
```java
if (zoneId == storeMgr.getStoreZoneId(ref.getDataStoreId(), ref.getRole()));
{
snapshotStore = ref;
break;
}
```
| Effect | |
|---|---|
| fallback loop | the `if` is a no-op, so the first copy of the snapshot
from **any** zone is returned |
| both loops | `long == Long` unboxes; if `getStoreZoneId` returns null (it
does when the primary pool lookup throws) this is an NPE |
Came in with #7873. Present on 4.22 and main.
### versions
4.19 onward, 4.22, main.
### The steps to reproduce the bug
1. Have a snapshot whose only copy is in zone A.
2. Call anything that looks it up with `getSnapshotWithRoleAndZone(id, role,
zoneB)`.
3. The zone A copy is returned instead of null.
### What to do about it?
Remove the `;` and compare null-safely in both loops.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]