You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Spring R2DBC URL parser fails when handling certain database URLs, specifically throwing an "Illegal character in path at index 88" error. This appears to be related to URL length and character positioning, as shorter URLs with similar patterns work correctly.
Environment
Spring Boot: 3.3.1
Spring Framework: 6.1.10
Java: JDK 22
Steps to Reproduce
Configure R2DBC with the following URL (FAILING URL):
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 88: r2dbc://app-service-alpha-stg.abc123def456.sa-east-1.rds.amazonaws.com:37039/mydb1
at java.base/java.net.URI.create(URI.java:932)
at io.r2dbc.spi.ConnectionUrlParser.parseQuery(ConnectionUrlParser.java:93)
at io.r2dbc.spi.ConnectionFactoryOptions.parse(ConnectionFactoryOptions.java:138)
Expected Behavior
The URL should be parsed successfully, as it's a valid PostgreSQL connection URL that works with JDBC and can connect successfully using other tools like DBeaver.
Actual Behavior
The application fails to start with an IllegalArgumentException about an illegal character at index 88. However, important to note:
The same exact URL works in DBeaver and other JDBC clients
The database is accessible using this connection string
Spring's R2DBC parser is the only component that fails to handle this URL
Interesting Observations
Similar but shorter URLs work fine. For example (WORKING URL):
r2dbc:postgresql://app-service-beta.xyz789uvw321.us-east-1.rds.amazonaws.com:37039/mydb1
Key differences between working and failing URLs:
Failing URL is 99 characters long
Working URL is 95 characters
Failing URL has additional segments in hostname (-stg)
These differences cause different character positioning
The error occurs specifically at index 88, where in the failing URL a '/' character is positioned
Workaround
The issue can be worked around by implementing a custom connection factory that bypasses Spring's URL parser:
Description
The Spring R2DBC URL parser fails when handling certain database URLs, specifically throwing an "Illegal character in path at index 88" error. This appears to be related to URL length and character positioning, as shorter URLs with similar patterns work correctly.
Environment
Steps to Reproduce
r2dbc:postgresql://app-service-alpha-stg.abc123def456.sa-east-1.rds.amazonaws.com:37039/mydb1
Error Message
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 88: r2dbc://app-service-alpha-stg.abc123def456.sa-east-1.rds.amazonaws.com:37039/mydb1
at java.base/java.net.URI.create(URI.java:932)
at io.r2dbc.spi.ConnectionUrlParser.parseQuery(ConnectionUrlParser.java:93)
at io.r2dbc.spi.ConnectionFactoryOptions.parse(ConnectionFactoryOptions.java:138)
Expected Behavior
The URL should be parsed successfully, as it's a valid PostgreSQL connection URL that works with JDBC and can connect successfully using other tools like DBeaver.
Actual Behavior
The application fails to start with an IllegalArgumentException about an illegal character at index 88. However, important to note:
Interesting Observations
Similar but shorter URLs work fine. For example (WORKING URL):
r2dbc:postgresql://app-service-beta.xyz789uvw321.us-east-1.rds.amazonaws.com:37039/mydb1
Key differences between working and failing URLs:
The error occurs specifically at index 88, where in the failing URL a '/' character is positioned
Workaround
The issue can be worked around by implementing a custom connection factory that bypasses Spring's URL parser:
The text was updated successfully, but these errors were encountered: