From c5de677d8cf02f535d89a0946f65c6997758da74 Mon Sep 17 00:00:00 2001 From: Andrea Spadaccini Date: Sat, 25 Jan 2020 16:47:55 +0000 Subject: [PATCH] Fix ReportDialog's code loading logic (#275) * Fix bug in ReportDialog Now it will always contain the last file opened. * Mention the new report dialog in release notes --- RELEASE_NOTES | 3 ++- src/main/java/org/edumips64/Main.java | 5 +++-- src/main/java/org/edumips64/core/parser/Parser.java | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 798d47e50..62dff0ffa 100755 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -12,7 +12,8 @@ Notes for this release: This is version 1.2.6 of EduMIPS64, a release that follows up on version 1.2.5, that was released in August 2018. This release contains a couple of changes, a new instruction alias (DMULU for DMULTU), an increased memory -size (640kB) and several bug fixes. +size (640kB), a better way to report bugs via GitHub and several bug fixes. + The codename for this release is Phlegmatic. First because it took a while to release a new version after 1.2.5. Second because I am releasing it while fighting with a bad and annoying cough, which I hope goes away as soon as diff --git a/src/main/java/org/edumips64/Main.java b/src/main/java/org/edumips64/Main.java index 62bc38a7d..ba4b65307 100644 --- a/src/main/java/org/edumips64/Main.java +++ b/src/main/java/org/edumips64/Main.java @@ -501,7 +501,6 @@ private static void openFile(String file) { cpu.reset(); symTab.reset(); dinero.reset(); - try { // Update GUI components front.updateComponents(); @@ -515,7 +514,9 @@ private static void openFile(String file) { try { String absoluteFilename = new File(file).getAbsolutePath(); - code = parser.parse(absoluteFilename); + LocalFileUtils lfu = new LocalFileUtils(); + code = lfu.ReadFile(absoluteFilename); + parser.parse(absoluteFilename); } catch (ParserMultiWarningException pmwe) { new ErrorDialog(mainFrame, pmwe.getExceptionList(), CurrentLocale.getString("GUI_PARSER_ERROR"), configStore.getBoolean(ConfigKey.WARNINGS)); } catch (NullPointerException e) { diff --git a/src/main/java/org/edumips64/core/parser/Parser.java b/src/main/java/org/edumips64/core/parser/Parser.java index a1b05c904..a1e8f2d2f 100644 --- a/src/main/java/org/edumips64/core/parser/Parser.java +++ b/src/main/java/org/edumips64/core/parser/Parser.java @@ -110,14 +110,13 @@ public Parser(FileUtils utils, SymbolTable symTab, Memory memory, InstructionBui * @throws SecurityException if a security manager exists and its checkRead method denies read access to the file. * @returns A string containing the code parsed. */ - public String parse(String filename) throws ParserMultiException, ReadException { + public void parse(String filename) throws ParserMultiException, ReadException { logger.info("About to parse " + filename); this.filename = filename; basePath = fileUtils.GetBasePath(filename); String code = preprocessor(filename); doParsing(code); logger.info(filename + " correctly parsed."); - return code; } /** Replace all Tabulator with space