{"record":{"id":"5212c5078316e71a","repo":"stanfordnlp/CoreNLP","slug":"chineseutils-unsupported-parameter-option-middot","errorCode":null,"errorMessage":"ChineseUtils: Unsupported parameter option: midDot=","messagePattern":"ChineseUtils: Unsupported parameter option: midDot=","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/trees/international/pennchinese/ChineseUtils.java","lineNumber":193,"sourceCode":"        case LEAVE:\n          break;\n        case NORMALIZE:\n          if (isMidDot(cp)) {\n            cp = '\\u00B7';\n          }\n          break;\n        case FULLWIDTH:\n          if (isMidDot(cp)) {\n            cp = '\\u30FB';\n          }\n          break;\n        case DELETE:\n          if (isMidDot(cp)) {\n            delete = true;\n          }\n          break;\n        default:\n          throw new IllegalArgumentException(\"ChineseUtils: Unsupported parameter option: midDot=\" + midDot);\n      }\n      if ( ! delete) {\n        out.append(cp);\n      }\n    } // end for\n    return out.toString();\n  }\n\n  private static String normalizeUnicode(String in, int ascii, int spaceChar, int midDot) {\n    StringBuilder out = new StringBuilder();\n    int len = in.length();\n    // Do it properly with codepoints, for non-BMP Unicode as well\n    // int numCP = in.codePointCount(0, len);\n    int cpp = 0; // previous codepoint\n    for (int offset = 0, cp; offset < len; offset += Character.charCount(cp)) {\n      // int offset = in.offsetByCodePoints(0, offset);\n      cp = in.codePointAt(offset);\n      Character.UnicodeBlock cub = Character.UnicodeBlock.of(cp);","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/trees/international/pennchinese/ChineseUtils.java#L175-L211","documentation":"In ChineseUtils.normalizeBMP, the midDot option controls how the middle-dot character is treated (LEAVE, DELETE, etc.); an unrecognized value falls to the switch's default branch, throwing this IllegalArgumentException. It indicates an unsupported middle-dot handling mode rather than bad input text.","triggerScenarios":"Calling ChineseUtils.normalize with a midDot argument that is within the legal range but not one of the constants normalizeBMP's switch handles, e.g. a raw int or a constant from an incompatible library version.","commonSituations":"Copy-pasted option integers from old scripts, constants renamed between library releases, or hardcoded midDot values instead of the named constants.","solutions":["Use the named midDot constants from ChineseUtils (LEAVE, DELETE, etc.) instead of raw ints","Verify your library version's constant set matches what your code passes","Add an explicit check of midDot against known constants before calling normalize"],"exampleFix":"// before\nString norm = ChineseUtils.normalize(in, ascii, spaceChar, 5);\n// after\nString norm = ChineseUtils.normalize(in, ascii, spaceChar, ChineseUtils.DELETE);","handlingStrategy":"validation","validationCode":"Set<Integer> legalMidDot = Set.of(ChineseUtils.LEAVE, ChineseUtils.DELETE);\nif (!legalMidDot.contains(midDotMode)) throw new IllegalArgumentException(\"unknown midDot mode: \" + midDotMode);","typeGuard":null,"tryCatchPattern":"try {\n  String norm = ChineseUtils.normalize(in, ascii, spaceChar, midDotMode);\n} catch (IllegalArgumentException e) {\n  if (!e.getMessage().contains(\"midDot=\")) throw e;\n  norm = ChineseUtils.normalize(in, ascii, spaceChar, ChineseUtils.LEAVE);\n}","preventionTips":["Pass named midDot constants, not raw integers","Log the midDot value when normalization fails to identify bad callers","Synchronize constant usage with your library version"],"tags":["java","validation","normalization"],"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-15T23:17:13.987Z"}