ITonyLi commented on a change in pull request #158: Fix AuthSupport
StringIndexOutOfBoundsException
URL:
https://github.com/apache/httpcomponents-client/pull/158#discussion_r312732760
##########
File path:
httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java
##########
@@ -54,20 +54,14 @@ public static void extractFromAuthority(
if (authority == null) {
return;
}
- final String userinfo = authority.getUserInfo();
- if (userinfo == null) {
+ final String userInfo = authority.getUserInfo();
+ if (userInfo == null) {
return;
}
- final int atColon = userinfo.indexOf(':');
- final String userName;
- final char[] password;
- if (atColon >= 0) {
- userName = userinfo.substring(0, atColon);
- password = userinfo.substring(atColon + 1).toCharArray();
- } else {
- userName = userinfo.substring(0, atColon);
Review comment:
@michael-o On un match ':', userName = userinfo.substring(0, atColon) will
throw exception
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]