diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/CommandMain.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/CommandMain.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/cuchaz/enigma/CommandMain.java b/src/main/java/cuchaz/enigma/CommandMain.java index 54f2707..b0a4107 100644 --- a/src/main/java/cuchaz/enigma/CommandMain.java +++ b/src/main/java/cuchaz/enigma/CommandMain.java | |||
| @@ -134,9 +134,15 @@ public class CommandMain { | |||
| 134 | File fileMappings = getReadableFile(getArg(args, 1, "enigma mapping", true)); | 134 | File fileMappings = getReadableFile(getArg(args, 1, "enigma mapping", true)); |
| 135 | File result = getWritableFile(getArg(args, 2, "enigma mapping", true)); | 135 | File result = getWritableFile(getArg(args, 2, "enigma mapping", true)); |
| 136 | String name = getArg(args, 3, "format type", true); | 136 | String name = getArg(args, 3, "format type", true); |
| 137 | Mappings.FormatType formatType = Mappings.FormatType.valueOf(name.toUpperCase()); | 137 | Mappings.FormatType formatType; |
| 138 | if (formatType == null) | 138 | try |
| 139 | { | ||
| 140 | formatType = Mappings.FormatType.valueOf(name.toUpperCase()); | ||
| 141 | } catch (IllegalArgumentException e) | ||
| 142 | { | ||
| 139 | throw new IllegalArgumentException(name + "is not a valid mapping format!"); | 143 | throw new IllegalArgumentException(name + "is not a valid mapping format!"); |
| 144 | } | ||
| 145 | |||
| 140 | System.out.println("Reading mappings..."); | 146 | System.out.println("Reading mappings..."); |
| 141 | Mappings mappings = new MappingsEnigmaReader().read(fileMappings); | 147 | Mappings mappings = new MappingsEnigmaReader().read(fileMappings); |
| 142 | System.out.println("Saving new mappings..."); | 148 | System.out.println("Saving new mappings..."); |