Beispiel #1
0
  /**
   * Basic parse of line into sentence parts
   *
   * @param line
   * @throws SentenceException
   */
  protected void baseParse(SentenceLine sl) throws SentenceException {
    this.orgLines.add(sl.getLine());

    // Save raw sentence
    rawSentences.add(sl.getSentence());

    // Check for comment block
    if (sl.getPrefix().length() > 0 && CommentBlock.hasCommentBlock(sl.getPrefix())) {
      addCommentBlock(sl.getPrefix());
    }

    // Check checksum
    if (!sl.isChecksumMatch()) {
      throw new SentenceException(
          "Invalid checksum for line: "
              + sl.getLine()
              + ": "
              + sl.getChecksumField()
              + " should have been: "
              + sl.getChecksumString());
    }

    if (sl.getFields().size() < 2) {
      throw new SentenceException("Invalid sentence, less than two fields");
    }

    // Check talker/formatter
    if (sl.getTalker() == null || sl.getFormatter() == null) {
      throw new SentenceException(
          "Invalid sentence, wrong talker/formatter: " + sl.getFields().get(0));
    }

    // Try to get MSSIS timestamp
    mssisTimestamp = findMssisTimestamp(sl);
  }