-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Fail earlier on cache corruptions #6495
Conversation
@@ -1258,7 +1258,7 @@ class HttpUrl internal constructor( | |||
this.scheme = base.scheme | |||
} else { | |||
throw IllegalArgumentException( | |||
"Expected URL scheme 'http' or 'https' but no colon was found") | |||
"Expected URL scheme 'http' or 'https' but no scheme was found for $input") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to drop this for PII reasons if there is concern, although as a corrupted url, the debug value seems higher than normal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log up to 6 characters? Like www.ex...
?
val urlLine = source.readUtf8LineStrict() | ||
// Choice here is between failing with a correct RuntimeException | ||
// or mostly silently with an IOException | ||
url = urlLine.toHttpUrlOrNull() ?: throw IOException("Cache Failure for $urlLine").also { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 options here
- runtime exception - fatal...
- io exception only
- io exception and log a warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change cache failure
to cache corruption
?
@@ -1258,7 +1258,7 @@ class HttpUrl internal constructor( | |||
this.scheme = base.scheme | |||
} else { | |||
throw IllegalArgumentException( | |||
"Expected URL scheme 'http' or 'https' but no colon was found") | |||
"Expected URL scheme 'http' or 'https' but no scheme was found for $input") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log up to 6 characters? Like www.ex...
?
val urlLine = source.readUtf8LineStrict() | ||
// Choice here is between failing with a correct RuntimeException | ||
// or mostly silently with an IOException | ||
url = urlLine.toHttpUrlOrNull() ?: throw IOException("Cache Failure for $urlLine").also { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change cache failure
to cache corruption
?
Could this fix be backported to 4.9.x, please? |
Fail earlier on cache corruption, log warning instead of failing terminally.