{"record":{"id":"0afa0a5d11c9a11f","repo":"stanfordnlp/CoreNLP","slug":"is-not-an-outputstyle","errorCode":null,"errorMessage":" is not an OutputStyle","messagePattern":" is not an OutputStyle","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/sequences/PlainTextDocumentReaderAndWriter.java","lineNumber":73,"sourceCode":"    }\n\n    private static final Map<String, OutputStyle> shortNames = Generics.newHashMap();\n\n    static {\n      for (OutputStyle style : OutputStyle.values())\n        shortNames.put(style.shortName, style);\n    }\n\n    /** Convert a String expressing an output format to its internal\n     *  coding as an OutputStyle.\n     *\n     *  @param name The String name\n     *  @return OutputStyle The internal constant\n     */\n    public static OutputStyle fromShortName(String name) {\n      OutputStyle result = shortNames.get(name);\n      if (result == null)\n        throw new IllegalArgumentException(name + \" is not an OutputStyle\");\n      return result;\n    }\n\n    public static boolean defaultToPreserveSpacing(String str) {\n      return str.equals(XML.shortName) || str.equals(INLINE_XML.shortName);\n    }\n\n  } // end enum Output style\n\n  private static final Pattern sgml = Pattern.compile(\"<[^>]*>\");\n  // TODO: allow for turning off splitting on . if we are processing already tokenized text\n  private final WordToSentenceProcessor<IN> wts =\n          new WordToSentenceProcessor<>(WordToSentenceProcessor.NewlineIsSentenceBreak.ALWAYS);\n\n  private SeqClassifierFlags flags; // = null;\n  private TokenizerFactory<IN> tokenizerFactory;\n\n  /**","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/sequences/PlainTextDocumentReaderAndWriter.java#L55-L91","documentation":"PlainTextDocumentReaderAndWriter.OutputStyle.fromShortName maps a user-supplied string (e.g. from the 'outputStyle' property) to an OutputStyle enum constant via the shortNames lookup table. If the name is not a registered short name (null result), it throws IllegalArgumentException. This guards against typo'd or unsupported output style names in configuration.","triggerScenarios":"Calling PlainTextDocumentReaderAndWriter.OutputStyle.fromShortName(\"...\") with any string not in the shortNames map, e.g. 'xml' when only 'XML' is registered, or an arbitrary style name.","commonSituations":"Typo in -outputStyle command-line flag or Properties value; case mismatch ('tsv' vs 'Tsv' vs 'tabbed'); copying a style name from another NLP library's docs.","solutions":["Use one of the registered short names exactly (check the OutputStyle enum / shortNames map, e.g. 'XML', 'INLINE_XML', 'TSV').","Fix the case of the name; the lookup is exact-match, so match the enum's shortName string.","Validate the style name against OutputStyle.values() shortNames before calling fromShortName."],"exampleFix":"// before\nOutputStyle style = OutputStyle.fromShortName(\"xml\");\n// after\nOutputStyle style = OutputStyle.fromShortName(\"XML\");","handlingStrategy":"validation","validationCode":"boolean valid = java.util.Arrays.stream(PlainTextDocumentReaderAndWriter.OutputStyle.values())\n    .anyMatch(s -> s.shortName.equals(name));","typeGuard":null,"tryCatchPattern":"try {\n  OutputStyle style = OutputStyle.fromShortName(name);\n} catch (IllegalArgumentException e) {\n  log.error(\"Unknown outputStyle '\" + name + \"', valid: \" + Arrays.toString(OutputStyle.values()));\n}","preventionTips":["Copy short names exactly from the OutputStyle enum, including case.","Centralize style-name constants instead of inlining strings in config.","Validate the outputStyle property at startup."],"tags":["enum","configuration","nlp","invalid-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}