Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cleanup #17801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ngocnhan-tran1996 wants to merge 7 commits into spring-projects:main
base: main
Choose a base branch
Loading
from ngocnhan-tran1996:cleanup
Open

Conversation

Copy link
Contributor

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

This PR includes

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

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
@@ -110,7 +114,7 @@ private String getQueryString(final HttpServletRequest request, final Pattern ar
return null;
}
String result = artifactPattern.matcher(query).replaceFirst("");
if (result.length() == 0) {
if (result.isEmpty()) {
return null;
}
Copy link
Contributor

@ronodhirSoumik ronodhirSoumik Aug 26, 2025
edited
Loading

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

@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.

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

*/
private static String getRoleWithDefaultPrefix(@Nullable String defaultRolePrefix, String role) {
if (role == null) {
return role;
}
if (defaultRolePrefix == null || defaultRolePrefix.length() == 0) {
if (defaultRolePrefix == null || defaultRolePrefix.isEmpty()) {
Copy link
Contributor

@ronodhirSoumik ronodhirSoumik Aug 26, 2025
edited
Loading

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

@ngocnhan-tran1996 ngocnhan-tran1996 Aug 26, 2025

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

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
1 more reviewer

@ronodhirSoumik ronodhirSoumik ronodhirSoumik left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /