abstractdog commented on code in PR #508:
URL: https://github.com/apache/tez/pull/508#discussion_r3400981643
##########
tez-api/src/main/java/org/apache/tez/dag/api/client/TimelineReaderFactory.java:
##########
@@ -284,7 +285,7 @@ public HttpURLConnection getHttpURLConnection(URL url)
throws IOException {
URLEncoder.encode(UserGroupInformation.getCurrentUser().getShortUserName(),
"UTF8");
HttpURLConnection httpURLConnection =
- (HttpURLConnection) (new URL(url + tokenString)).openConnection();
+ (HttpURLConnection) URI.create(url +
tokenString).toURL().openConnection();
Review Comment:
personally, I prefer unchecked exceptions; code is always full of try-catch
boilerplates, 99% of them are re-throwing the original error wrapped to
RuntimeException, because these errors are considered fatal, and the developer
has no idea how to handle them (if it needs to be handled at all), so from this
point of view, `URI.create` looks easier and more convenient to me
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]