{"record":{"id":"31c99ad85a9d141f","repo":"stanfordnlp/CoreNLP","slug":"number-of-pointers-size-of-short-form","errorCode":null,"errorMessage":"Number of pointers != size of short form","messagePattern":"Number of pointers != size of short form","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/ie/pascal/Alignment.java","lineNumber":53,"sourceCode":"  public Alignment(BufferedReader reader) throws IOException {\n    String line;\n    line = reader.readLine();\n    if (line == null) {\n      throw new IOException();\n    }\n    longForm = line.toCharArray();\n    line = reader.readLine();\n    if (line == null) {\n      throw new IOException();\n    }\n    shortForm = line.toCharArray();\n    line = reader.readLine();\n    if (line == null) {\n      throw new IOException();\n    }\n    String[] pstrings = line.split(\"\\\\s+\");\n    if (pstrings.length != shortForm.length) {\n      throw new IOException(\"Number of pointers != size of short form\");\n    }\n    pointers = new int[pstrings.length];\n    for (int i = 0; i < pointers.length; ++i) {\n      pointers[i] = Integer.parseInt(pstrings[i]);\n    }\n  }\n\n  public void print() {\n    System.out.println(toString());\n  }\n\n  @Override\n  public String toString() {\n    return toString(\"\");\n  }\n\n  private static final char[] spaces = \"                      \".toCharArray();\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/ie/pascal/Alignment.java#L35-L71","documentation":"Alignment.loadPointers reads a whitespace-separated line of integer pointers and validates that its length equals shortForm.length before parsing. If the counts disagree, the file's pointer row does not correspond to the short form, and an IOException with this message is thrown rather than proceeding with a misaligned array.","triggerScenarios":"Loading a pascal alignment/shortform data file whose pointer-count line has fewer or more integers than the short form previously read (truncated file, wrong file pairing, hand-edited data).","commonSituations":"Passing mismatched file pair to Alignment (shortForm from one file, pointers from another), corrupted download of the alignment data, or editing the data file and dropping entries.","solutions":["Check that the shortform file and pointers file are a matched pair from the same dataset release.","Re-download or regenerate the alignment data files to fix truncation/corruption.","Count the entries: the pointer line must contain exactly one integer per shortForm element; fix the data file accordingly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-validate data file consistency\nString[] lines = Files.readAllLines(Paths.get(pointersFile)).toArray(new String[0]);\nint shortFormLen = shortForm.length;\nint pointerCount = lines[0].trim().split(\"\\\\s+\").length;\nif (pointerCount != shortFormLen) throw new IllegalStateException(\"Mismatched alignment files\");","typeGuard":null,"tryCatchPattern":"try {\n  Alignment a = new Alignment(reader, shortForm);\n} catch (IOException e) {\n  log.warning(\"Alignment data mismatch/corruption: \" + e.getMessage());\n  a = null; // fall back or abort\n}","preventionTips":["Keep shortform and pointer files from the same dataset release together.","Checksum data files after download and before use.","Never hand-edit alignment data without revalidating counts."],"tags":["io","data-format","pascal"],"backgroundTag":"file-read-failed","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"}