- edited description
minor breakage with Composer constructor introduced in 1.31
Issue #560
resolved
Commit fc30078 back in April 2022 added this line (#3 here) to the 3-arg constructor for Composer:
public Composer(Parser parser, Resolver resolver, LoaderOptions loadingConfig) {
⋮
nestingDepthLimit = loadingConfig.getNestingDepthLimit();
}
prior to that change, passing null
as the loadingConfig
argument was acceptable in that it caused no problem, and there’s no annotation or documentation that suggests otherwise.
As of 1.31, doing so throws an opaque NullPointerException
.
This is easy to fix: e.g., if loadingConfig
is null
, create a new LoaderOptions()
a few lines earlier and thus get the default depth limit of 50, and prevent NPEs from later uses of this.loadingConfig
:
this.loadingConfig = loadingConfig == null ? new LoaderOptions() : loadingConfig;
⋮
nestingDepthLimit = this.loadingConfig.getNestingDepthLimit();
Even just a line of
assert loadingConfig != null : "loadingConfig parameter must not be null";
would be helpful when trouble-shooting.
Comments (5)
-
reporter -
- changed status to open
-
-
assigned issue to
-
assigned issue to
-
Feel free to review:
-
- changed status to resolved
fixed. It will be delivered in version 1.34
- Log in to comment