-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-49240][BUILD] Add scalastyle and checkstyle rules to avoid URL constructors
#47762
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,7 +150,10 @@ private[spark] object JettyUtils extends Logging { | |
| private def doRequest(request: HttpServletRequest, response: HttpServletResponse): Unit = { | ||
| beforeRedirect(request) | ||
| // Make sure we don't end up with "//" in the middle | ||
| val newUrl = new URL(new URL(request.getRequestURL.toString), prefixedDestPath).toString | ||
| val requestURL = new URI(request.getRequestURL.toString).toURL | ||
| // scalastyle:off URLConstructor | ||
| val newUrl = new URL(requestURL, prefixedDestPath).toString | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a little tricky to change. So, this PR allows this as the only exception.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. val requestURI = new URI(request.getRequestURL.toString)
val newUri = requestURI.resolve(prefixedDestPath).toString
response.sendRedirect(newUri)Will there be any problems with this change?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me check. Thanks, @LuciferYang .
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To @LuciferYang , I checked multiple corner cases. And, it's not the same in some cases like the following. I'd prefer to keep the existing logic to avoid any risk here.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be clear, this PR aims to prevent any future addition of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
| // scalastyle:on URLConstructor | ||
| response.sendRedirect(newUrl) | ||
| } | ||
| // SPARK-5983 ensure TRACE is not supported | ||
|
|
||
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.
not related to this PR, but it seems that
masterStreamhas not been closed.