remove redundant/diverging hardcoded defaults in parseInt/parseLong wrapping ConfigKey reads
@DaanHoogland 已经在做这个了。
开始于 2026年8月18日。
评估
这个 Issue 还没有评估数据。
描述
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.
- 主要语言
- Java
- 星标
- 3.1k
- 派生
- 1.4k
- 平均合并
- 7 天 5 小时
- 30 天内合并 PR
- 28
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/cloudstack 的其他 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 90/100
apache/cloudstack#14222 ·
-
bug component:kubernetes
难度 1/5 1 小时以内 新手友好度 88/100
apache/cloudstack#14180 ·
-
bug component:projects component:UI
难度 1/5 1 小时以内 新手友好度 88/100
apache/cloudstack#14070 · 5 条评论 ·
-
component:backup
难度 2/5 1-3 小时 新手友好度 76/100
apache/cloudstack#14013 ·
-
KVM agent fails to connect to Ceph RBD storage pool after upgrading Ceph client to Tentacle 20.2.4 未关闭bug component:ceph
难度 2/5 1-3 小时 新手友好度 78/100
apache/cloudstack#13989 · 3 条评论 ·
查看 apache/cloudstack 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
-
1.0.0-alpha2 Type/Improvement
难度 2/5 1-3 小时 新手友好度 68/100
wso2/dpdp-accelerator#272 ·
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
apache/rocketmq-dashboard#4860 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
infinispan/infinispan#18150 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
puj-course/FIS_2630_1204_G1#294 ·