cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jburwell <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1735: CLOUDSTACK-9570: Bug in listSnapshots for sna...
Date Mon, 14 Nov 2016 23:12:22 GMT
Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1735#discussion_r87915067
  
    --- Diff: server/src/com/cloud/api/ApiResponseHelper.java ---
    @@ -526,16 +529,18 @@ public static DataStoreRole getDataStoreRole(Snapshot snapshot,
SnapshotDataStor
             }
     
             long storagePoolId = snapshotStore.getDataStoreId();
    -        DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
    +        if (snapshotStore.getState() != null && ! snapshotStore.getState().equals(ObjectInDataStoreStateMachine.State.Destroyed))
{
    +            DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
     
    -        Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
    +            Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
     
    -        if (mapCapabilities != null) {
    -            String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
    -            Boolean supportsStorageSystemSnapshots = new Boolean(value);
    +            if (mapCapabilities != null) {
    +                String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
    +                Boolean supportsStorageSystemSnapshots = new Boolean(value);
    --- End diff --
    
    `new Boolean` skips the constant pool -- putting unnecessary pressure on the heap and
creating a potential memory leak.  Please use `Boolean.valueOf` to part the value to avoid
this issue.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message