This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

swt fileviewer


Hi John

Your original assessment seems to be right one!

The bugs with fileviewer have probably nothing to do with inner classes, nor
with threading!

The first culprit sits here (line 1050 and following):

	static File[] getDirectoryList(File file)
	{
		File[] list = file.listFiles();
		...
	}

The list array is completely out of whack. If the parameter file gets, for
example, created with "C:" then file.listFiles() returns the content of pwd!
It doesn't fail at all ... which it should, instead of returning things out
of the blue.

SWT fileviewer starts up correctly, if you change the lines 1102 ... 1115:

			list.add(new File(DRIVE_A)); //not properly understood
			list.add(new File(DRIVE_B)); //not properly understood
			list.add(new File("/")); //understood as "C:"
//X			for (char i = 'c'; i <= 'z'; ++i) {
//X				File drive = new File(i + ":" + File.separator);
//X				if (drive.isDirectory() && drive.exists()) {
//X					list.add(drive);
//X					if (initial && i == 'c') {
//X						currentDirectory = drive;
//X						initial = false;
//X					}
//X				}
//X			}

You can then start browsing "C:" (represented as "/"). After a while though,
it starts going wrong again. Probably something to do with the File class
again and the fact that it doesn't properly understand those insidious
Windows drive letters. I'll have a look at it again (but not today!), unless
you want to look first; then tell me what the remaining bugs are; that
spares me from looking :)

Greetings
Erik


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]