Skip to content

$StaplerConverterImpl is invoked with unexpected arguments #2346

@daniel-beck

Description

@daniel-beck

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions