remove redundant/diverging hardcoded defaults in parseInt/parseLong wrapping ConfigKey reads
@DaanHoogland đang làm issue này rồi.
Từ ngày 18/8/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Many call sites read a ConfigKey via the raw DAO and wrap the result in NumbersUtil.parseInt(value, someLiteral) / NumbersUtil.parseLong(...) / Integer.parseInt(...), supplying a hardcoded fallback even though the ConfigKey already carries its own default via .defaultValue() (and .value() applies that default automatically when no DB row exists). Most of the time the literal happens to match the ConfigKey's declared default, so it's just redundant. But it doesn't always match — which is a latent bug, not just noise, since the two numbers silently diverge depending on which code path executes.
Found during the .value() migration pass (issue #10752):
DeploymentPlanningManagerImpl.java—HostReservationReleasePeriod:ConfigKeydefault is"300000", but the field's Java-level initializer is60L * 60L * 1000L(3,600,000), and the code only falls back to theConfigKeydefault when the persisted value is<= 0— not when the row is simply missing (null), in which case it silently keeps 3,600,000 instead of 300,000.StorageCacheManagerImpl.java—ExpungeWorkers:ConfigKeydefault is"1", but the read isNumbersUtil.parseInt(configDao.getValue(...), 10)— a hardcoded fallback of 10 vs. the registered default of 1.UcsManagerImpl.java—UCSSyncBladeInterval:ConfigKeydefault is"3600", but a leftovercatch (NumberFormatException e) { syncBladeInterval = 600; }uses 600. Low risk in practice since.value()no longer throws on parse, but the mismatched literal is still latent debt.
These three were left un-migrated to .value() specifically because of this discrepancy — picking either number without a decision would silently change fresh-install/edge-case behavior. Worth a repo-wide sweep for the same parseInt/parseLong-with-hardcoded-default pattern, since these three were only found incidentally while migrating unrelated call sites, not through an exhaustive search.
- Ngôn ngữ chính
- Java
- Star
- 3.1k
- Fork
- 1.4k
- Merge trung bình
- 6 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 27
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/cloudstack
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
apache/cloudstack#14222 ·
-
create-kubernetes-binaries-iso.sh builds the ISO without setting a volume ID on EL8 based os's Đang mởbug component:kubernetes
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
apache/cloudstack#14180 ·
-
bug component:projects component:UI
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
apache/cloudstack#14070 · 5 bình luận ·
-
component:backup
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
apache/cloudstack#14013 ·
-
KVM agent fails to connect to Ceph RBD storage pool after upgrading Ceph client to Tentacle 20.2.4 Đang mởbug component:ceph
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/cloudstack#13989 · 3 bình luận ·
Tất cả issue của apache/cloudstack
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
checkstyle/test-configs#263 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Cannot differ own consent and managed consents in My Consents view and detailed consent view. Đang mở1.0.0-alpha2 Type/Improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
wso2/dpdp-accelerator#272 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
apache/rocketmq-dashboard#4860 · 1 bình luận ·