Skip to content
Snippets Groups Projects
Commit 5300fefa authored by dgelessus's avatar dgelessus
Browse files

Declare that Translator cannot throw IOException

The current BParser APIs don't throw IOExceptions directly anymore and
instead wrap them in BCompoundExceptions.
parent 7b7d5c5f
Branches
Tags
No related merge requests found
Pipeline #140183 passed
...@@ -108,11 +108,10 @@ public class TLC4B { ...@@ -108,11 +108,10 @@ public class TLC4B {
* Be aware that this method may take a long time to run for large/complex machines. * Be aware that this method may take a long time to run for large/complex machines.
* *
* @param path path to B machine file * @param path path to B machine file
* @throws IOException if files could not be read
* @throws BCompoundException if the machine file could not be parsed * @throws BCompoundException if the machine file could not be parsed
* @throws TLC4BException if translation fails for any other reason * @throws TLC4BException if translation fails for any other reason
*/ */
public static void checkTLC4BIsApplicable(String path) throws IOException, BCompoundException { public static void checkTLC4BIsApplicable(String path) throws BCompoundException {
TLC4B tlc4B = new TLC4B(); TLC4B tlc4B = new TLC4B();
tlc4B.processArgs(new String[]{path, SILENT.cliArg()}); tlc4B.processArgs(new String[]{path, SILENT.cliArg()});
tlc4B.translate(); tlc4B.translate();
...@@ -134,7 +133,7 @@ public class TLC4B { ...@@ -134,7 +133,7 @@ public class TLC4B {
try { try {
checkTLC4BIsApplicable(path); checkTLC4BIsApplicable(path);
return null; return null;
} catch (BCompoundException | IOException | TLC4BException e) { } catch (BCompoundException | TLC4BException e) {
return e; return e;
} }
}); });
...@@ -386,7 +385,7 @@ public class TLC4B { ...@@ -386,7 +385,7 @@ public class TLC4B {
printlnVerbose(""); printlnVerbose("");
} }
private void translate() throws IOException, BCompoundException { private void translate() throws BCompoundException {
StopWatch.start(PARSING_TIME); StopWatch.start(PARSING_TIME);
MP.printSilent("Parsing... "); MP.printSilent("Parsing... ");
translator = new Translator(machineFileNameWithoutFileExtension, translator = new Translator(machineFileNameWithoutFileExtension,
......
package de.tlc4b; package de.tlc4b;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -58,8 +57,7 @@ public class Translator { ...@@ -58,8 +57,7 @@ public class Translator {
start = parser.parseMachine(machineString); start = parser.parseMachine(machineString);
} }
public Translator(String machineName, File machineFile, String ltlFormula, String constantSetup) public Translator(String machineName, File machineFile, String ltlFormula, String constantSetup) throws BCompoundException {
throws BCompoundException, IOException {
this.machineName = machineName; this.machineName = machineName;
this.ltlFormula = ltlFormula; this.ltlFormula = ltlFormula;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment