The URL: ftp://user@password@server/file
will cause the constructor for FtpURLConnection to throw
StringIndexOutOfBoundsException. This was not expected.
The code assumes that if a user is specified in the URL
then there will be a colon used to specify the password.
public FtpURLConnection(URL url) {
super(url);
host = url.getHost();
String userInfo = url.getUserInfo();
if (userInfo != null) { // get the user and password
int delimiter = userInfo.indexOf(':');
user = userInfo.substring(0, delimiter++);
password = userInfo.substring(delimiter);
}
}
Bug 4450673 has a stack trace of this problem.
% java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)
will cause the constructor for FtpURLConnection to throw
StringIndexOutOfBoundsException. This was not expected.
The code assumes that if a user is specified in the URL
then there will be a colon used to specify the password.
public FtpURLConnection(URL url) {
super(url);
host = url.getHost();
String userInfo = url.getUserInfo();
if (userInfo != null) { // get the user and password
int delimiter = userInfo.indexOf(':');
user = userInfo.substring(0, delimiter++);
password = userInfo.substring(delimiter);
}
}
Bug 4450673 has a stack trace of this problem.
% java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)
- duplicates
-
JDK-4398880 FTP URL processing modified to conform to RFC 1738 (4269403 follow-up)
-
- Resolved
-