leaningtech / cheerpj-meta

Run Java 8 applications, libraries, applets, Java Web Start, and Oracle Forms on the web without legacy plugins.
https://labs.leaningtech.com/cheerpj
459 stars 21 forks source link

Exception thrown when using `RandomAccessFile` #161

Closed neoFuzz closed 1 year ago

neoFuzz commented 1 year ago

I'm having an issue where my main program fails to run and stops at an exception. I managed to work out where the program is stopped and isolated the module. The module when run stand-alone encounters the error below:

Uncaught (in promise) ReferenceError: buf is not defined
    at Object.eval [as func] (eval at buildContinuations (loader.js:220:20), <anonymous>:3:43)
    at runContinuationStack (loader.js:491:10)
    at cheerpjSchedule (loader.js:1271:5)
    at cheerpjWakeThread (cheerpOS.js:2493:4)
    at dl.onEnd (eval at buildContinuations (loader.js:220:20), <anonymous>:63:6)

    at cheerpOS.js:351:16

The error is thrown when this block of code is run, specifically strBuffer = randomAccessFile.readLine();

String strBuffer;
try {
    strBuffer = randomAccessFile.readLine();
} catch (Exception e) {
    System.out.error("Error reading to buffer");
    return;
}

Is this unimplemented in CheerpJ or a bug?

I have attached the program in Zip. Use java -jar JCFont.jar \fonts\serif11.jcf a b c C to observe expected output JCFont.zip

saarikoski-jules commented 1 year ago

This issue has been fixed in a later version of CheerpJ. You can use the following runtime https://cjrtnc.leaningtech.com/20230216/loader.js. Please note that any jar.js files compiled with CheerpJ 2.3 won't be compatible with this version.