Skip to content

Conversation

ngocnhan-tran1996
Copy link
Contributor

@ngocnhan-tran1996 ngocnhan-tran1996 commented Aug 24, 2025

This PR includes

  • Use StringUtils#hasLength
  • Remove redundant check and exception
  • Update javadoc
  • Polish some methods

Signed-off-by: Tran Ngoc Nhan <[email protected]>
Signed-off-by: Tran Ngoc Nhan <[email protected]>
Signed-off-by: Tran Ngoc Nhan <[email protected]>
Signed-off-by: Tran Ngoc Nhan <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 24, 2025
if (result.length() == 0) {
if (result.isEmpty()) {
return null;
}
Copy link
Contributor

@ronodhirSoumik ronodhirSoumik Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String result = (query == null) ? "" : artifactPattern.matcher(query).replaceFirst("");

if (result.isEmpty()) {
    return null;
}

* @return
* @param artifactParameterName the artifactParameterName that is removed from the
* current URL. The result becomes the service url. Cannot be null and cannot be an
* empty String.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot be null and cannot be an empty String -> Cannot be null or empty String

return role;
}
if (defaultRolePrefix == null || defaultRolePrefix.length() == 0) {
if (defaultRolePrefix == null || defaultRolePrefix.isEmpty()) {
Copy link
Contributor

@ronodhirSoumik ronodhirSoumik Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there are several uses of str == null || str.isEmpty() I think a common util function will be helpful

boolean isEmpty(String str) {
	return str == null || str.length == 0;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use !org.springframework.util.StringUtils#hasLength

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants