diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-05-15 16:40:46 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-05-15 16:40:46 +0200 |
commit | bb1941650805ea7772082ee2724b98bb8154148e (patch) | |
tree | da29625e487f77563476c1d2c36e0a62b31fc280 /src/main/FarmShell.java | |
parent | f94162b0c8e6a7b7bd62087f14fcb1c646a6fe84 (diff) | |
download | Goldfarmer-bb1941650805ea7772082ee2724b98bb8154148e.tar.gz |
Catch a more specific NoSuchElementException, fix lexicon reading
Diffstat (limited to 'src/main/FarmShell.java')
-rw-r--r-- | src/main/FarmShell.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/FarmShell.java b/src/main/FarmShell.java index 3c6f17f..7186c2f 100644 --- a/src/main/FarmShell.java +++ b/src/main/FarmShell.java @@ -64,8 +64,6 @@ public class FarmShell { // print prompt for reading next line printPrompt(); } - // prevent corrupted compressed files when exiting without a command - throw new NoSuchElementException(); } /** @@ -102,8 +100,13 @@ public class FarmShell { System.err.println("Command " + args[0] + " failed with " + ex); ex.printStackTrace(); } catch (NoSuchElementException ex) { - // thrown by the "exit" command to signal exit - return false; + if ("EXIT NOW".equals(ex.getMessage())) { + // thrown by the "exit" command to signal exit + return false; + } else { + System.err.println("ZOMG SOMETHIGN FAILED: " + ex.getMessage()); + ex.printStackTrace(); + } } catch (SQLException ex) { System.err.println("such " + ex); } @@ -145,7 +148,7 @@ public class FarmShell { } break; case exit: - throw new NoSuchElementException(); + throw new NoSuchElementException("EXIT NOW"); default: throw new AssertionError(command.name()); } |