protected TerminateToolException createTerminationIOException(IOException e) { if (e instanceof InsufficientTrainingDataException) { return new TerminateToolException(-1, "\n\nERROR: Not enough training data\n" + "The provided training data is not sufficient to create enough events to train a model.\n" + "To resolve this error use more training data, if this doesn't help there might\n" + "be some fundamental problem with the training data itself."); } return new TerminateToolException(-1, "IO error while reading training data or indexing data: " + e.getMessage(), e); } }
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) { System.err.println(e.getMessage()); if (e.getCause() != null) { System.err.println(e.getCause().getMessage()); e.getCause().printStackTrace(System.err); System.exit(e.getCode());
@Test public void testCreation() { TerminateToolException e = new TerminateToolException(-500); Assert.assertEquals(-500, e.getCode()); } }
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) System.err.println(e.getMessage()); System.exit(e.getCode());
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) System.err.println(e.getMessage()); System.exit(e.getCode());
public static FileInputStream openInFile(File file) { try { return new FileInputStream(file); } catch (FileNotFoundException e) { throw new TerminateToolException(-1, "File '" + file + "' cannot be found", e); } }
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) { System.err.println(e.getMessage()); if (e.getCause() != null) { System.err.println(e.getCause().getMessage()); e.getCause().printStackTrace(System.err); System.exit(e.getCode());
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) System.err.println(e.getMessage()); System.exit(e.getCode());
public static TerminateToolException createObjectStreamError(IOException e) { return new TerminateToolException(-1, "IO Error while creating an Input Stream: " + e.getMessage(), e); }
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) { System.err.println(e.getMessage()); if (e.getCause() != null) { System.err.println(e.getCause().getMessage()); e.getCause().printStackTrace(System.err); System.exit(e.getCode());
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) System.err.println(e.getMessage()); System.exit(e.getCode());
public static void handleStdinIoError(IOException e) { throw new TerminateToolException(-1, "IO Error while reading from stdin: " + e.getMessage(), e); }
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) { System.err.println(e.getMessage()); if (e.getCause() != null) { System.err.println(e.getCause().getMessage()); e.getCause().printStackTrace(System.err); System.exit(e.getCode());
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) System.err.println(e.getMessage()); System.exit(e.getCode());
public Object parseArgument(Method method, String argName, String argValue) { Object value; try { value = Integer.parseInt(argValue); } catch (NumberFormatException e) { throw new TerminateToolException(1, String.format(INVALID_ARG, argName, argValue) + "Value must be an integer!", e); } return value; } }
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) { System.err.println(e.getMessage()); if (e.getCause() != null) { System.err.println(e.getCause().getMessage()); e.getCause().printStackTrace(System.err); System.exit(e.getCode());
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) System.err.println(e.getMessage()); System.exit(e.getCode());
public Object parseArgument(Method method, String argName, String charsetName) { try { if (OptionalParameter.DEFAULT_CHARSET.equals(charsetName)) { return Charset.defaultCharset(); } else if (Charset.isSupported(charsetName)) { return Charset.forName(charsetName); } else { throw new TerminateToolException(1, String.format(INVALID_ARG, argName, charsetName) + "Encoding not supported on this platform."); } } catch (IllegalCharsetNameException e) { throw new TerminateToolException(1, String.format(INVALID_ARG, argName, charsetName) + "Illegal encoding name."); } } }
throw new TerminateToolException(1, "Tool " + toolName + " is not found."); ((BasicCmdLineTool) tool).run(toolArguments); } else { throw new TerminateToolException(1, "Tool " + toolName + " does not support formats."); throw new TerminateToolException(1, "Tool " + toolName + " is not supported."); if (e.getMessage() != null) { System.err.println(e.getMessage()); if (e.getCause() != null) { System.err.println(e.getCause().getMessage()); e.getCause().printStackTrace(System.err); System.exit(e.getCode());
public static void checkLanguageCode(String code) { List<String> languageCodes = new ArrayList<>(); languageCodes.addAll(Arrays.asList(Locale.getISOLanguages())); languageCodes.add("x-unspecified"); if (!languageCodes.contains(code)) { throw new TerminateToolException(1, "Unknown language code " + code + ", " + "must be an ISO 639 code!"); } }