Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public int getStepArgument(final int index) {
* @return the corresponding TypePath object, or {@literal null} if the path is empty.
*/
public static TypePath fromString(final String typePath) {
if (typePath == null || typePath.length() == 0) {
if (typePath == null || typePath.isEmpty()) {
Copy link
Member

@sbrannen sbrannen Sep 23, 2024

Choose a reason for hiding this comment

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

Please refrain from modifying classes under org.springframework.asm and org.springframework.objenesis. Those include repackaged forks of the third-party libraries ASM and Objenesis. Any refactoring to those classes should take place upstream in the originating repository. The Spring Framework will then pick up the changes when syncing with official updates of the forked third-party libraries.


Note, however, that we can revert this change manually if we decide to merge this PR.

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 I should revert files in org.springframework.asm and org.springframework.objenesis to prevent any unexpected exception related third-party

return null;
}
int typePathLength = typePath.length();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static String getPackageName(String className) {
}

public static String upperFirst(String s) {
if (s == null || s.length() == 0) {
if (s == null || s.isEmpty()) {
return s;
}
return Character.toUpperCase(s.charAt(0)) + s.substring(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private static String filterBindMarker(CharSequence input) {
builder.append(ch);
}
}
if (builder.length() == 0) {
if (builder.isEmpty()) {
return "";
}
return "_" + builder.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ public void append(String path) {
@Override
@Nullable
public PathComponent build() {
if (this.path.length() == 0) {
if (this.path.isEmpty()) {
return null;
}
String sanitized = getSanitizedPath(this.path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public boolean matches(int pathIndex, PathPattern.MatchingContext matchingContex
return false;
}
String candidateCapture = matchingContext.pathElementValue(pathIndex);
if (candidateCapture.length() == 0) {
if (candidateCapture.isEmpty()) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public boolean matches(int pathIndex, MatchingContext matchingContext) {
}
else {
return (matchingContext.isMatchOptionalTrailingSeparator() && // if optional slash is on...
segmentData != null && segmentData.length() > 0 && // and there is at least one character to match the *...
segmentData != null && !segmentData.isEmpty() && // and there is at least one character to match the *...
(pathIndex + 1) == matchingContext.pathLength && // and the next path element is the end of the candidate...
matchingContext.isSeparator(pathIndex)); // and the final element is a separator
}
}
}
else {
// Within a path (e.g. /aa/*/bb) there must be at least one character to match the wildcard
if (segmentData == null || segmentData.length() == 0) {
if (segmentData == null || segmentData.isEmpty()) {
return false;
}
return (this.next != null && this.next.matches(pathIndex, matchingContext));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ protected String createQueryString(List<Param> params, Set<String> usedParams, b
StringBuilder qs = new StringBuilder();
for (Param param : params) {
if (!usedParams.contains(param.getName()) && StringUtils.hasLength(param.getName())) {
if (includeQueryStringDelimiter && qs.length() == 0) {
if (includeQueryStringDelimiter && qs.isEmpty()) {
qs.append('?');
}
else {
Expand Down
Loading