-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.3.0
-
sparc
-
solaris_2.6
Name: ksC84122 Date: 07/02/99
JDK 1.3 java.net.URL(String spec) constructs an incorrect URL
if parameter spec contains a file name followed by "/../".
It does not reduce the spec and java.net.URL methods can not resolve such a url.
To set up the test example, please create any file like "anyfile.txt" in some
directory like "/tmp" and change the following line in the test case accordingly:
String URLDIR = "file:/tmp/anyfile.txt/../";
A test example which demonstrates this problem.
===== test.java ========
import java.net.*;
import java.io.*;
public class test {
public static void main (String argv[]) {
URL url = null;
String URLDIR = "file:/tmp/anyfile.txt/../";
try {
url = new URL(URLDIR);
System.out.println(url);
} catch(MalformedURLException e) {
System.out.println("FAIL: MalformedURLException: parsing of URL failed:\n"
+ URLDIR);
}
try {
System.out.println("content: " + url.openConnection().getContent());
} catch (IOException ioe) {
System.out.println("error openning connection");
}
return;
}
}
========= Sample run (JDK1.3) ==========
#>java test
file:/tmp/anyfile.txt/../
error openning connection
========= Sample run (JDK1.2.2) ==========
#>java test
file:/tmp/
content: java.io.ByteArrayInputStream@b812b0d1
======================================================================