Am 16.07.2017 um 15:59 schrieb Vladimir Sitnikov:
Emilian>The reason being that I expect getPropDefault to already return a
valid value or *my* default which I also know it's valid.

+1


Emilian>A solution would be to validate the whole configuration file at
start up.

There always might be "runtime validations", so we can't rely on "validate
everything at startup time".

JMeter has lots of features and lots of options. Should it warn user if
some unused feature is misconfigured?

Alternative (additional) option is to define properties via  some
class-interface like entities.
That is tie validator to the property, and not to the call site.
Something like find all classes with interface PropertyValidatorInitializer (or something like that) and run them on startup. These classes could register (in a central registry) validators for property names.

Than getPropDefault (or other getProp-variants) could ask the central registry to validate the values and even give specific error messages on failure.


Note: "string -> whatever" conversion might need to use original string
value in order to make error message clear.

Do you think error messages should be localizable?
Might be nice, so I think it would definitely be a plus.
Do you think error messages should refer to the relevant documentation
sections and/or provide corrective actions?
Would be nice, too.

Felix

PS. Here's a relevant quote:
https://twitter.com/mezzoblue/status/878336246996647938

Vladimir


Reply via email to