Allon Mureinik has uploaded a new change for review. Change subject: engine: Avoid lower-case l ......................................................................
engine: Avoid lower-case l Using a lower case "l" to denote a long literal is visually confusing since an "l" is graphically similar to a "1" in a lot of fonts. Thus, using an upper-case "L" is considered less confusing. This patch fixes all the occasions where a lower case "l" is used and adds a checkstyle validation to prevent this mistake from re-occurring. Change-Id: I33cafbcc46e4162d7f31871a16c52a511d4c90c4 Signed-off-by: Allon Mureinik <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddQuotaCommandTest.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveQuotaCommandTest.java M backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ListUtilsTest.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/QuotaDAOTest.java M backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/ovf/OvfParserTest.java M build-tools-root/checkstyles/src/main/resources/checkstyle.xml 8 files changed, 21 insertions(+), 20 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/07/15007/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java index 5ffdd25..06b5a73 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java @@ -222,7 +222,7 @@ } List<DiskImage> diskImages = storageToDiskEntry.getValue(); - long sizeRequested = 0l; + long sizeRequested = 0L; for (DiskImage diskImage : diskImages) { sizeRequested += diskImage.getActualSize(); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java index b26df27..a260b73 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java @@ -60,7 +60,7 @@ } public ValidationResult isDomainHasSpaceForRequest(final long requestedSize, final boolean useThresHold) { - long size = useThresHold ? getLowDiskSpaceThreshold() : 0l; + long size = useThresHold ? getLowDiskSpaceThreshold() : 0L; if (storageDomain.getAvailableDiskSize() != null && storageDomain.getAvailableDiskSize() - requestedSize < size) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN, diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddQuotaCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddQuotaCommandTest.java index 8ac9a34..0bc8500 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddQuotaCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddQuotaCommandTest.java @@ -67,15 +67,15 @@ generalQuota.setDescription("New Quota to create"); generalQuota.setQuotaName("New Quota Name"); QuotaStorage storageQuota = new QuotaStorage(); - storageQuota.setStorageSizeGB(100l); + storageQuota.setStorageSizeGB(100L); storageQuota.setStorageSizeGBUsage(0d); generalQuota.setGlobalQuotaStorage(storageQuota); QuotaVdsGroup vdsGroupQuota = new QuotaVdsGroup(); vdsGroupQuota.setVirtualCpu(0); vdsGroupQuota.setVirtualCpuUsage(0); - vdsGroupQuota.setMemSizeMB(0l); - vdsGroupQuota.setMemSizeMBUsage(0l); + vdsGroupQuota.setMemSizeMB(0L); + vdsGroupQuota.setMemSizeMBUsage(0L); generalQuota.setGlobalQuotaVdsGroup(vdsGroupQuota); generalQuota.setId(Guid.NewGuid()); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveQuotaCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveQuotaCommandTest.java index fb9aede..0cf071c 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveQuotaCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveQuotaCommandTest.java @@ -19,8 +19,8 @@ import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum; import org.ovirt.engine.core.common.businessentities.QuotaStorage; import org.ovirt.engine.core.common.businessentities.QuotaVdsGroup; -import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.StoragePool; +import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dao.QuotaDAO; import org.ovirt.engine.core.dao.StoragePoolDAO; @@ -106,15 +106,15 @@ generalQuota.setDescription("New Quota to create"); generalQuota.setQuotaName("New Quota Name"); QuotaStorage storageQuota = new QuotaStorage(); - storageQuota.setStorageSizeGB(100l); + storageQuota.setStorageSizeGB(100L); storageQuota.setStorageSizeGBUsage(0d); generalQuota.setGlobalQuotaStorage(storageQuota); QuotaVdsGroup vdsGroupQuota = new QuotaVdsGroup(); vdsGroupQuota.setVirtualCpu(0); vdsGroupQuota.setVirtualCpuUsage(0); - vdsGroupQuota.setMemSizeMB(0l); - vdsGroupQuota.setMemSizeMBUsage(0l); + vdsGroupQuota.setMemSizeMB(0L); + vdsGroupQuota.setMemSizeMBUsage(0L); generalQuota.setGlobalQuotaVdsGroup(vdsGroupQuota); generalQuota.setId(generalGuidQuota); diff --git a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ListUtilsTest.java b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ListUtilsTest.java index 8d79143..6ad8a0d 100644 --- a/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ListUtilsTest.java +++ b/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/ListUtilsTest.java @@ -40,7 +40,7 @@ } })); - Assert.assertEquals("only one element should match the criteria", 1l, filtered.size()); + Assert.assertEquals("only one element should match the criteria", 1, filtered.size()); Assert.assertEquals("and it should be 'bla'", "bla", filtered.get(0)); } @@ -48,7 +48,7 @@ public void nullSafeAdd() { ListUtils.nullSafeAdd(null, "foo"); ListUtils.nullSafeAdd(null, new Object()); - ListUtils.nullSafeAdd(null, 1l); + ListUtils.nullSafeAdd(null, 1L); final ArrayList<String> list = new ArrayList<String>(); ListUtils.nullSafeAdd(list, "foo"); diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/QuotaDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/QuotaDAOTest.java index 6e02195..33b6864 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/QuotaDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/QuotaDAOTest.java @@ -91,7 +91,7 @@ quota.setGraceStoragePercentage(Config.<Integer> GetValue(ConfigValues.QuotaGraceStorage)); quota.setQuotaVdsGroups(getQuotaVdsGroup(getSpecificQuotaVdsGroup(quotaId))); quota.setQuotaStorages(getQuotaStorage(null)); - quota.setGlobalQuotaStorage(new QuotaStorage(null, null, null, 10000l, 0d)); + quota.setGlobalQuotaStorage(new QuotaStorage(null, null, null, 10000L, 0d)); dao.save(quota); Quota quotaEntity = dao.getById(quota.getId()); @@ -555,7 +555,7 @@ quotaStorage.setQuotaId(quotaId); quotaStorage.setQuotaStorageId(Guid.NewGuid()); quotaStorage.setStorageId(FixturesTool.STORAGE_DOAMIN_NFS_MASTER); - quotaStorage.setStorageSizeGB(10000l); + quotaStorage.setStorageSizeGB(10000L); quotaStorage.setStorageSizeGBUsage(0d); return quotaStorage; @@ -567,9 +567,9 @@ quotaVdsGroup.setQuotaId(quotaId); quotaVdsGroup.setVdsGroupId(FixturesTool.VDS_GROUP_RHEL6_NFS); quotaVdsGroup.setVirtualCpu(2880); - quotaVdsGroup.setMemSizeMB(16000000l); + quotaVdsGroup.setMemSizeMB(16000000L); quotaVdsGroup.setVirtualCpuUsage(0); - quotaVdsGroup.setMemSizeMBUsage(0l); + quotaVdsGroup.setMemSizeMBUsage(0L); return quotaVdsGroup; } @@ -594,12 +594,12 @@ QuotaVdsGroup quotaVdsGroup = new QuotaVdsGroup(); // Set Quota storage capacity definition. - quotaStorage.setStorageSizeGB(10000l); + quotaStorage.setStorageSizeGB(10000L); quotaStorage.setStorageSizeGBUsage(0d); // Set Quota cluster virtual memory definition. - quotaVdsGroup.setMemSizeMB(16000000l); - quotaVdsGroup.setMemSizeMBUsage(0l); + quotaVdsGroup.setMemSizeMB(16000000L); + quotaVdsGroup.setMemSizeMBUsage(0L); // Set Quota cluster virtual CPU definition. quotaVdsGroup.setVirtualCpu(2880); diff --git a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/ovf/OvfParserTest.java b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/ovf/OvfParserTest.java index 4a22b7d..cf379b5 100644 --- a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/ovf/OvfParserTest.java +++ b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/ovf/OvfParserTest.java @@ -11,7 +11,7 @@ public void UtcDateStringToLocaDate_nodep() { Date date = OvfParser.UtcDateStringToLocaDate("1984/06/19 14:25:11"); - Assert.assertEquals(456503111000l, date.getTime()); + Assert.assertEquals(456503111000L, date.getTime()); } static class Checker implements Runnable { @@ -46,7 +46,7 @@ final Thread[] threads = new Thread[8]; final Checker[] checkers = new Checker[threads.length]; for (int i = 0; i < threads.length; i++) { - checkers[i] = new Checker("1984/06/19 14:25:11", 456503111000l, 100000); + checkers[i] = new Checker("1984/06/19 14:25:11", 456503111000L, 100000); threads[i] = new Thread(checkers[i], "ovf-checker-" + i); threads[i].start(); } diff --git a/build-tools-root/checkstyles/src/main/resources/checkstyle.xml b/build-tools-root/checkstyles/src/main/resources/checkstyle.xml index 68be13f..1f0992d 100644 --- a/build-tools-root/checkstyles/src/main/resources/checkstyle.xml +++ b/build-tools-root/checkstyles/src/main/resources/checkstyle.xml @@ -18,6 +18,7 @@ <module name="RedundantImport"/> <module name="UnusedImports"/> <module name="AvoidStarImport"/> + <module name="UpperEll"/> <module name="checks.NlsCheck"> <property name="run" value="${runNlsCheck}" default="false"/> </module> -- To view, visit http://gerrit.ovirt.org/15007 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I33cafbcc46e4162d7f31871a16c52a511d4c90c4 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
