Repository: cloudstack Updated Branches: refs/heads/master 3100fc155 -> bd71fcb65
Fixed two coverity reported issues Dereference after null check Dm: Dubious method used This closes #219 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bd71fcb6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bd71fcb6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bd71fcb6 Branch: refs/heads/master Commit: bd71fcb650d0469ebf1409fef618e5851eafad81 Parents: 3100fc1 Author: Rajani Karuturi <[email protected]> Authored: Fri May 1 14:39:59 2015 +0530 Committer: Rajani Karuturi <[email protected]> Committed: Fri May 1 16:08:26 2015 +0530 ---------------------------------------------------------------------- server/src/com/cloud/storage/VolumeApiServiceImpl.java | 7 +++---- utils/src/com/cloud/utils/EncryptionUtil.java | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd71fcb6/server/src/com/cloud/storage/VolumeApiServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java index 7a450e7..964c7bc 100644 --- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java @@ -325,10 +325,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic // set the post url, this is used in the monitoring thread to determine the SSVM VolumeDataStoreVO volumeStore = _volumeStoreDao.findByVolume(vol.getId()); - if (volumeStore != null) { - volumeStore.setExtractUrl(url); - _volumeStoreDao.persist(volumeStore); - } + assert (volumeStore != null) : "sincle volume is registered, volumestore cannot be null at this stage"; + volumeStore.setExtractUrl(url); + _volumeStoreDao.persist(volumeStore); response.setId(UUID.fromString(vol.getUuid())); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd71fcb6/utils/src/com/cloud/utils/EncryptionUtil.java ---------------------------------------------------------------------- diff --git a/utils/src/com/cloud/utils/EncryptionUtil.java b/utils/src/com/cloud/utils/EncryptionUtil.java index e46bb9f..b82842e 100644 --- a/utils/src/com/cloud/utils/EncryptionUtil.java +++ b/utils/src/com/cloud/utils/EncryptionUtil.java @@ -19,7 +19,6 @@ package com.cloud.utils; import java.io.UnsupportedEncodingException; -import java.nio.charset.Charset; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; @@ -63,7 +62,7 @@ public class EncryptionUtil { final Mac mac = Mac.getInstance("HmacSHA1"); final SecretKeySpec keySpec = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA1"); mac.init(keySpec); - mac.update(data.getBytes(Charset.defaultCharset())); + mac.update(data.getBytes("UTF-8")); final byte[] encryptedBytes = mac.doFinal(); return Base64.encodeBase64String(encryptedBytes); } catch (NoSuchAlgorithmException | InvalidKeyException | UnsupportedEncodingException e) {
