Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$StaplerConverterImpl is invoked with unexpected arguments #2346

Open
daniel-beck opened this issue Aug 22, 2023 · 0 comments
Open

$StaplerConverterImpl is invoked with unexpected arguments #2346

daniel-beck opened this issue Aug 22, 2023 · 0 comments

Comments

@daniel-beck
Copy link
Member

Given a databound type with a List<SomeClass> property, and SomeClass$StaplerConverterImpl existing, this code appears to invoke the converter, passing the List<SomeClass> object, asking to get a SomeClass, when exporting a configuration:

final Attribute a = createAttribute(names[i], TypePair.of(p));
if (a != null) {
Object value = a.getValue(instance);
if (value != null) {
Object converted = Stapler.CONVERT_UTILS.convert(value, a.getType());

The correct behavior is implementation-dependent, but likely involves returning a List<?>.

This seems unexpected. My expectation was that the converter is invoked once for each SomeClass list entry.

See https://github.com/jenkinsci/matrix-auth-plugin/pull/145/files#diff-a714ec3c04d484b6a8bb5fa7b0bf64cf3ebb61dfc095fb4b826cdac479c257bfR62-R69 for an example of this in matrix-auth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant