This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
Re: Freenet compilation errors.
- To: Bryce McKinlay <bryce at albatross dot co dot nz>
- Subject: Re: Freenet compilation errors.
- From: "Mark J. Roberts" <mjr at statesmean dot com>
- Date: Sun, 7 Jan 2001 12:07:21 -0600 (CST)
- cc: java-discuss at sources dot redhat dot com
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