Copilot commented on code in PR #12937:
URL: https://github.com/apache/cloudstack/pull/12937#discussion_r3658391043
##########
server/src/main/java/com/cloud/user/DomainManagerImpl.java:
##########
@@ -958,7 +957,7 @@ private void updateDomainChildren(DomainVO domain, String
updatedDomainPrefix) {
List<DomainVO> domainChildren =
_domainDao.findAllChildren(domain.getPath(), domain.getId());
// for each child, update the path
for (DomainVO dom : domainChildren) {
- dom.setPath(dom.getPath().replaceFirst(domain.getPath(),
updatedDomainPrefix));
+ dom.setPath(StringUtils.replaceOnce(dom.getPath(),
domain.getPath(), updatedDomainPrefix));
Review Comment:
This change switches from regex-based replacement to literal replacement
when updating children domain paths. There is existing unit test coverage for
DomainManagerImpl (DomainManagerImplTest), but no test appears to cover path
updates when domain names include regex metacharacters (e.g., "company.com").
Adding a focused unit test would prevent regressions for this bug class.
This issue also appears in the following locations of the same file:
- line 1096
- line 1096
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]