Skip to content

HasStyle.addClassNames() doesn't handle multiple whitespaces #11709

Closed

Description

@mvysny

Description of the bug / feature

new Div().addClassNames("   foo  bar    baz")

fails with

java.lang.IllegalArgumentException: Class name cannot be empty
	at com.vaadin.flow.internal.nodefeature.ElementClassList$ClassListView.validate(ElementClassList.java:45)
	at com.vaadin.flow.internal.nodefeature.ElementClassList$ClassListView.validate(ElementClassList.java:31)
	at com.vaadin.flow.internal.nodefeature.NodeList$SetView.add(NodeList.java:113)
	at com.vaadin.flow.internal.nodefeature.NodeList$SetView.add(NodeList.java:86)
	at com.vaadin.flow.component.HasStyle.addClassNames(HasStyle.java:144)

Expected behavior

The div should have three class names added.

Actual behavior

The code fails with an exception

Versions:

- Vaadin / Flow version: 14.6.8
- Java version: 8

Activity

  1. self-assigned this
    on Sep 1, 2021
  2. added a commit that references this issue on Sep 17, 2021
    d319ea2
  3. added 6 commits that reference this issue on Sep 17, 2021
    4af39ea
    b0f9c48
    f8fca52
    d275569
    aabc631
    83fa614
  4. vaadin-bot commented on Sep 20, 2021

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with platform 22.0.0.alpha4 and is also targeting the upcoming stable 22.0.0 version.

  5. vaadin-bot commented on Sep 27, 2021

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with platform 21.0.2.

  6. vaadin-bot commented on Sep 27, 2021

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with platform 14.7.1.

  7. vaadin-bot commented on Oct 8, 2021

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with platform 20.0.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions