Name: diC59631 Date: 12/14/98
On an NT machine locate a file that
can be accessed both by "regular" path names like
c:\temp\foo.txt AND a UNC path
\\demomachine\temp\foo.txt
Run the test program with both JDK1.1.7 and 1.2
using both file urls and straight file paths
jdk1.1.7\bin\java Fopen file:\\HOST\PATH
WORKS
jdk1.1.7\bin\java Fopen file:Drive\PATH
WORKS
jdk1.1.7\bin\java Fopen \\HOST\PATH
WORKS
jdk1.1.7\bin\java Fopen Drive\PATH
WORKS
jdk1.2\bin\java Fopen file:\\HOST\PATH
DOES NOT WORK
jdk1.2\bin\java Fopen file:Drive\PATH
WORKS
jdk1.2\bin\java Fopen \\HOST\PATH
WORKS
jdk1.2\bin\java Fopen Drive\PATH
WORKS
-----------------------------TEST PROGRAM
import java.io.*;
import java.net.*;
public class Fopen {
public static void main(String [] argv) throws Exception {
InputStream is = null;
if (argv[0].startsWith("file:") ) {
URL u = new URL(argv[0]);
System.out.println("URL = " + u.toString() );
is = u.openStream();
} else {
is = new FileInputStream(argv[0]);
System.out.println("FILE = " + argv[0] );
}
int nread = 0;
byte [] buff = new byte[1024];
while( nread >= 0 ) {
nread = is.read(buff);
System.out.println("READ " + nread);
}
}
}
(Review ID: 47861)
======================================================================
Name: dbT83986 Date: 05/13/99
If a user has a System.getProperty("user.home") located on a
network drive, the .java.policy file located in that directory
does not take effect. If the .java.policy file is on a lettered
drive (i.e. c:\windows\profiles\user) then it does take effect
and the policies work as expected. Perhaps the policy file reading
code cannot handle UNC filenames?
This occurs on Windows 95. Have not tried other versions of
windows yet but may occur on those also. Problem occurs in
jdk 1.2 and jdk 1.2.1.
java -version = java version "1.2.1"
Classic VM (build JDK-1.2.1-A, native threads)
java -fullversion = java full version "JDK-1.2.1-A"
(Review ID: 58082)
======================================================================
Name: krT82822 Date: 10/14/99
On Windows, if you have a file which you are trying to reference
via a network (UNC) pathname, URLConnection.getInputStream()
throws an IOException. Here is the code to reproduce the
problem (change the string to point to a file on your system):
String loc = "file:\\\\home-toaster\\cwood\\begin_here.html";
try {
URL url = new URL(loc);
try {
URLConnection uc = url.openConnection();
InputStream inputStream = uc.getInputStream();
}
catch (IOException e) {
System.out.println("IOException caught: " + e);
}
}
catch (MalformedURLException e) {
System.out.println("couldn't parse url");
}
The message that appears is:
java.net.ConnectException: Connection refused: no further information
java -version:
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
Note: This code works without any problems with the MicrosoftVM.
(Review ID: 96556)
======================================================================