Name: yyC67448 Date: 06/15/98
The java.net.URL.sameFile method return false on URLs, that are equal modulo
url encoding.
Here is the simple test demonstrating the bug:
-------------------------------- Test.java -----------------------------
import java.net.*;
class test
{
public static void main(String args[])
{
URL url = null;
URL url1 = null;
try {
url = new URL("http://web2.javasoft.com/some+file.html");
url1 = new URL("http://web2.javasoft.com/some%20file.html");
} catch(Exception e)
{
System.out.println("Unexpected exception :" + e);
System.exit(-1);
}
if(url.sameFile(url1))
{
System.out.println("OKAY");
System.exit(0);
}
else
{
System.out.println("Failed. ");
System.exit(-1);
}
}
}
---------------------- Output from the test --------------------
Failed.
-----------------------------------------------------------------
======================================================================
The java.net.URL.sameFile method return false on URLs, that are equal modulo
url encoding.
Here is the simple test demonstrating the bug:
-------------------------------- Test.java -----------------------------
import java.net.*;
class test
{
public static void main(String args[])
{
URL url = null;
URL url1 = null;
try {
url = new URL("http://web2.javasoft.com/some+file.html");
url1 = new URL("http://web2.javasoft.com/some%20file.html");
} catch(Exception e)
{
System.out.println("Unexpected exception :" + e);
System.exit(-1);
}
if(url.sameFile(url1))
{
System.out.println("OKAY");
System.exit(0);
}
else
{
System.out.println("Failed. ");
System.exit(-1);
}
}
}
---------------------- Output from the test --------------------
Failed.
-----------------------------------------------------------------
======================================================================
- duplicates
-
JDK-4793105 The expected encoding for java.net.URL needs clarification
- Closed