fixing FindBugs scariest for replaceFirst() method call that does not assign the return value
Signed-off-by: Hugo Trippaers <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0ff94333 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0ff94333 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0ff94333 Branch: refs/heads/master Commit: 0ff943337c20e02fd39597a0977cff531a73ecae Parents: 16aa73c Author: wrodrigues <[email protected]> Authored: Mon Feb 10 15:13:56 2014 +0100 Committer: Hugo Trippaers <[email protected]> Committed: Fri Feb 14 18:37:44 2014 +0100 ---------------------------------------------------------------------- .../CloudStackPrimaryDataStoreLifeCycleImpl.java | 15 +++++++-------- .../CloudStackPrimaryDataStoreProviderImpl.java | 9 ++++----- 2 files changed, 11 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ff94333/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java ---------------------------------------------------------------------- diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java index 37861b4..b90d5fc 100644 --- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java +++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java @@ -27,8 +27,6 @@ import java.util.UUID; import javax.inject.Inject; -import org.apache.log4j.Logger; - import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; @@ -40,6 +38,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -250,7 +249,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore if (clusterId == null) { throw new IllegalArgumentException("IscsiLUN need to have clusters specified"); } - hostPath.replaceFirst("/", ""); + hostPath = hostPath.replaceFirst("/", ""); parameters.setType(StoragePoolType.IscsiLUN); parameters.setHost(storageHost); parameters.setPort(port); @@ -321,7 +320,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore } else if (scheme.equalsIgnoreCase("PreSetup")) { uuid = hostPath.replace("/", ""); } else { - uuid = UUID.nameUUIDFromBytes(new String(storageHost + hostPath).getBytes()).toString(); + uuid = UUID.nameUUIDFromBytes((storageHost + hostPath).getBytes()).toString(); } List<StoragePoolVO> spHandles = primaryDataStoreDao.findIfDuplicatePoolsExistByUUID(uuid); @@ -348,9 +347,9 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore s_logger.debug("creating pool " + pool.getName() + " on host " + hostId); if (pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.Filesystem && - pool.getPoolType() != StoragePoolType.IscsiLUN && pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.VMFS && - pool.getPoolType() != StoragePoolType.SharedMountPoint && pool.getPoolType() != StoragePoolType.PreSetup && pool.getPoolType() != StoragePoolType.OCFS2 && - pool.getPoolType() != StoragePoolType.RBD && pool.getPoolType() != StoragePoolType.CLVM && pool.getPoolType() != StoragePoolType.SMB) { + pool.getPoolType() != StoragePoolType.IscsiLUN && pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.VMFS && + pool.getPoolType() != StoragePoolType.SharedMountPoint && pool.getPoolType() != StoragePoolType.PreSetup && pool.getPoolType() != StoragePoolType.OCFS2 && + pool.getPoolType() != StoragePoolType.RBD && pool.getPoolType() != StoragePoolType.CLVM && pool.getPoolType() != StoragePoolType.SMB) { s_logger.warn(" Doesn't support storage pool type " + pool.getPoolType()); return false; } @@ -377,7 +376,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore PrimaryDataStoreInfo primarystore = (PrimaryDataStoreInfo)store; // Check if there is host up in this cluster List<HostVO> allHosts = - _resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, primarystore.getClusterId(), primarystore.getPodId(), primarystore.getDataCenterId()); + _resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, primarystore.getClusterId(), primarystore.getPodId(), primarystore.getDataCenterId()); if (allHosts.isEmpty()) { primaryDataStoreDao.expunge(primarystore.getId()); throw new CloudRuntimeException("No host up to associate a storage pool with in cluster " + primarystore.getClusterId()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ff94333/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/provider/CloudStackPrimaryDataStoreProviderImpl.java ---------------------------------------------------------------------- diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/provider/CloudStackPrimaryDataStoreProviderImpl.java b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/provider/CloudStackPrimaryDataStoreProviderImpl.java index 410416c..a02e366 100644 --- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/provider/CloudStackPrimaryDataStoreProviderImpl.java +++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/provider/CloudStackPrimaryDataStoreProviderImpl.java @@ -34,7 +34,6 @@ import com.cloud.utils.component.ComponentContext; public class CloudStackPrimaryDataStoreProviderImpl implements PrimaryDataStoreProvider { - private final String providerName = DataStoreProvider.DEFAULT_PRIMARY; protected PrimaryDataStoreDriver driver; protected HypervisorHostListener listener; protected DataStoreLifeCycle lifecycle; @@ -45,12 +44,12 @@ public class CloudStackPrimaryDataStoreProviderImpl implements PrimaryDataStoreP @Override public String getName() { - return providerName; + return DataStoreProvider.DEFAULT_PRIMARY; } @Override public DataStoreLifeCycle getDataStoreLifeCycle() { - return this.lifecycle; + return lifecycle; } @Override @@ -63,12 +62,12 @@ public class CloudStackPrimaryDataStoreProviderImpl implements PrimaryDataStoreP @Override public PrimaryDataStoreDriver getDataStoreDriver() { - return this.driver; + return driver; } @Override public HypervisorHostListener getHostListener() { - return this.listener; + return listener; } @Override
