Polishing (aligned with main)

This commit is contained in:
Juergen Hoeller
2025-08-06 19:01:18 +02:00
parent da13a24604
commit 5df9fd4eff
5 changed files with 31 additions and 14 deletions
@@ -30,7 +30,6 @@ import org.springframework.util.Assert;
*
* @author Rossen Stoyanchev
* @since 6.2
*
* @see <a href="https://www.rfc-editor.org/info/rfc3986">RFC 3986</a>
*/
abstract class RfcUriParser {
@@ -78,10 +77,10 @@ abstract class RfcUriParser {
* @param query the query, if present
* @param fragment the fragment, if present
*/
record UriRecord(@Nullable String scheme, boolean isOpaque,
@Nullable String user, @Nullable String host, @Nullable String port,
@Nullable String path, @Nullable String query, @Nullable String fragment) {
record UriRecord(
@Nullable String scheme, boolean isOpaque,
@Nullable String user, @Nullable String host, @Nullable String port,
@Nullable String path, @Nullable String query, @Nullable String fragment) {
}
@@ -130,6 +129,7 @@ abstract class RfcUriParser {
}
},
HOST_OR_PATH {
@Override
@@ -158,6 +158,7 @@ abstract class RfcUriParser {
}
},
SCHEME_OR_PATH {
@Override
@@ -188,6 +189,7 @@ abstract class RfcUriParser {
}
},
HOST {
@Override
@@ -229,6 +231,7 @@ abstract class RfcUriParser {
}
},
IPV6 {
@Override
@@ -259,6 +262,7 @@ abstract class RfcUriParser {
}
},
PORT {
@Override
@@ -291,6 +295,7 @@ abstract class RfcUriParser {
}
},
PATH {
@Override
@@ -319,6 +324,7 @@ abstract class RfcUriParser {
}
},
QUERY {
@Override
@@ -334,7 +340,9 @@ abstract class RfcUriParser {
}
},
FRAGMENT {
@Override
public void handleNext(InternalParser parser, char c, int i) {
}
@@ -345,6 +353,7 @@ abstract class RfcUriParser {
}
},
WILDCARD {
@Override
@@ -358,6 +367,7 @@ abstract class RfcUriParser {
}
};
/**
* Method to handle each character from the input string.
* @param parser provides access to parsing state, and helper methods
@@ -429,6 +439,7 @@ abstract class RfcUriParser {
this.uri = uri;
}
// Check internal state
public boolean hasScheme() {
@@ -451,6 +462,7 @@ abstract class RfcUriParser {
return (this.index == this.componentIndex);
}
// Top-level parse loop, iterate over chars and delegate to states
public UriRecord parse() {
@@ -475,6 +487,7 @@ abstract class RfcUriParser {
return this.uri.charAt(this.index);
}
// Transitions and index updates
public void advanceTo(State state) {
@@ -500,6 +513,7 @@ abstract class RfcUriParser {
this.index = index;
}
// Component capture
public InternalParser resolveIfOpaque() {
@@ -593,6 +607,7 @@ abstract class RfcUriParser {
return this;
}
// Encoding and curly bracket handling
/**
@@ -643,6 +658,7 @@ abstract class RfcUriParser {
return (this.openCurlyBracketCount > 0);
}
@Override
public String toString() {
return "[State=" + this.state + ", index=" + this.index + ", componentIndex=" + this.componentIndex +