Skip to content

SpEL incorrectly splits string arguments by comma for Object... varargs method #33013

Closed
@weiw005

Description

@weiw005

Affects

4.1.2.RELEASE or higher

Summary

In SpEL, a registered varargs function incorrectly splits string arguments by comma when varargs type is Object / Any.

Overview

This is related to previously reported #27582. The issue was likely not fully fixed yet.

I created a unit test here to demo the bug: https://github.com/weiw005/playground/blob/e6f1ae9336b8ac5e294758a90d2639c6a075df5b/spel-vararg/src/test/kotlin/SpelVarargTest.kt

It seems that when a registered function has vararg args: Any as the argument type, SpEL would have inconsistent behavior when there is single vs. multiple argument(s) of string type:

  • Single argument: SpEL will split the string by comma, and take the first part only
  • Multiple arguments: SpEL will take all arguments as is (expected behavior)

This bug doesn't manifest when the function signature declares vararg args: String instead (all arguments would be taken as is correctly).

I have also confirmed that version 4.1.1.RELEASE or lower did not have this bug.

Related Issues

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions