harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-5737) FileURLConnection.connect fails in presence of anchor's
Date Tue, 15 Apr 2008 22:40:21 GMT
FileURLConnection.connect fails in presence of anchor's
-------------------------------------------------------

                 Key: HARMONY-5737
                 URL: https://issues.apache.org/jira/browse/HARMONY-5737
             Project: Harmony
          Issue Type: Bug
            Reporter: Davanum Srinivas


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)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message