Freenet compilation errors.

Mark J. Roberts mjr@statesmean.com
Sun Jan 7 10:06:00 GMT 2001


Here's another test case, for a different bug:

import java.net.URL;
import java.net.URLConnection;

public class URLBug {
    public static void main(String [] args) throws Exception {
        URLConnection uc = (URLConnection) (new URL(" http://127.0.0.1/index.html ")).openConnection();

        uc.setDoInput(true);
        uc.setDoOutput(true);

        if (uc.getDoInput()) System.out.println("Does input.");
        if (uc.getDoOutput()) System.out.println("Does output.");
    }
}

which produces the following results:

[root@rm03-24-131-185-22 /freenet]# javac URLBug.java
[root@rm03-24-131-185-22 /freenet]# java URLBug
Does input.
Does output.
[root@rm03-24-131-185-22 /freenet]# gcj -o urltest --main=URLBug URLBug.java
[root@rm03-24-131-185-22 /freenet]# ./urltest
Does output.

The JavaDocs make it clear that doInput and doOutput may both be true at
once: "A URL connection can be used for input and/or output."

Setting doInput before reading and doOutput before writing solved the
problem, but it's a kludge.


-- 
Mark Roberts
mjr@statesmean.com



More information about the Java mailing list