plasma-umass / doppio

Breaks the browser language barrier (includes a plugin-free JVM).

Home Page:http://plasma-umass.github.io/doppio-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using Scanner with File hangs

Loccy opened this issue · comments

commented

Hi all,

Having run into some issues with using Scanner to read files within the Browser.FS filesystem, I've tried the following on your demo page just to confirm it's not something in my project:

import java.util.Scanner;
import java.io.File;

public class FileTest {
public static void main(String[] args) throws Exception {
File f = new File("test.txt");
Scanner fr = new Scanner(f);
System.out.println("About to try to read...");
while (fr.hasNextLine())
{
System.out.println(fr.nextLine());
}
}
}

I get the same symptoms as in my own project that uses Doppio; the Scanner is instantiated seemingly without incident, but the moment one tries to do anything that involves reading the file, execution seems to hang. It fails silently in that the browser does not block and no console errors are generated.

Attempting a similar simple line-by-line read from a test file using BufferedReader(new FileReader(FILENAME)) works fine - so there seems to be something causing problems in the interaction between Scanner and the Browser.FS-based filesystem.

Have hacked around it for now by using an alternate version of Scanner - see http://nifty.stanford.edu/2006/reges-anagrams/ - but the year on that says it all! Would be nice if the "real" Scanner could be made to work...