Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1079

Audit, optimize and explicitly test YANG string unescaping

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 5.0.0, 4.0.8, 3.0.11
    • None
    • parser

      ArgumentContextUtils.stringFromStringContext() performs all the magic required to process YANG string handling, including proper quotes validation, unescaping and whitespace trimming. The unescaping part is using three nested Pattern.matchers() and did crop up in profiling runs.

      There are a few things we can do here, most notably we should be able to turn the entire class into an enum with one constant per YangVersion, so that we would not pass that as an argument.

      The pattern substitutions look a bit dodgy, and in some cases we are already performing a char-by-char walk, hence we should be able to remove the patterns completely. For that we need a proper test suite - some of which is in Bug6180Test, but we probably want to promote that to a suite providing 100% branch coverage (including pattern noop vs. real-op).

            vladyslav.marchenko Vladyslav Marchenko
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: