Class MiniBundleParser

  • public class MiniBundleParser
    extends Object

    Parse and validate mini-bundles for SAS. Does an ugly double load so we can produce human readable error messages for the common bundle syntax errors. SnakeYAML doesn’t make it easy to return your own error messages for things like misnamed or mistyped fields. A typical exception from SnakeYAML is

    Can't construct a java object for,; exception=Cannot create property=avents for; Unable to find property 'avents' on class:
    in 'reader', line 2, column 1:

    Stripping the layers of wrapping gives:

    Unable to find property 'avents' on class:

    This loses the position of the error. What we want is to report errors with the position and a clear explanation. We can give the explanation by performing semantic validation on a Map representation of the bundle and preserve position data for unexpected cases by wrapping the initial cause of the ConstructorException. This class is not thread safe.