Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Download the following html to your local directory
curl -O http://www.apache.org/foundation/how-it-works.html
and run this Test case.
========================
import java.net.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
File f = new File("how-it-works.html");
URL anchor = new URL(f.toURL(), "#meritocracy");
System.out.println("Anchor : " + anchor);
URLConnection connection = anchor.openConnection();
DataInputStream dis = new DataInputStream(connection.getInputStream());
String inputLine;
while ((inputLine = dis.readLine()) != null)
{ System.out.println(inputLine); } dis.close();
}
}
========================
Here's the stack trace :
[dims@dims-desktop sample]$../jdk/bin/java -cp . Main
Anchor : file:/home/dims/harmony/target/hdk/sample/how-it-works.html#meritocracy
Uncaught exception in main:
java.io.FileNotFoundException: /home/dims/harmony/target/hdk/sample/how-it-works.html#meritocracy
at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:235)
at java.io.FileInputStream.<init>(FileInputStream.java:76)
at org.apache.harmony.luni.internal.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:91)
at org.apache.harmony.luni.internal.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:189)
at Main.main(Main.java:10)