Skip to content

Progress bar set value and set max-min order matters #8394

@abdullahtellioglu

Description

@abdullahtellioglu

Description

The following progress bar works without throwing an exception:

ProgressBar progressbar = new ProgressBar();
progressbar.setValue(1);
progressbar.setMax(100.0);
progressbar.setMin(20.0);
add(progressbar);

However,

ProgressBar progressbar = new ProgressBar();
progressbar.setMax(100.0);
progressbar.setMin(20.0);
progressbar.setValue(1);
add(progressbar);

fails with

Caused by: java.lang.IllegalArgumentException: value must be between min ('20.0') and max ('100.0')
	at com.vaadin.flow.component.progressbar.ProgressBar.setValue(ProgressBar.java:103) ~[vaadin-progress-bar-flow-25.0.0.jar:na]
	at test.vaadin.copilot.flow.testviews.ui.helloworld.HelloWorldView.<init>(HelloWorldView.java:43) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[na:na]
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:198) ~[spring-beans-7.0.1.jar:7.0.1]
	... 129 common frames omitted

Expected outcome

  • Both codes should work. It should not be a matter of when the range is set. It can be before or after the value call, but both cases are valid in my opinion
    Or
  • The exception should be thrown in both cases.

Minimal reproducible example

Example above

Steps to reproduce

Add the example above to an empty view and you will get the same exception

Environment

Flow: 25.0.0
Vaadin: 25.0-SNAPSHOT
Spring Boot: 4.0.0
Spring: 7.0.1
Spring Security:
Spring Data JPA:
Copilot: 25.1-SNAPSHOT
Frontend Hotswap: Enabled ⋅ Vite
OS: aarch64 Mac OS X 14.7.1
Java: JetBrains s.r.o. 21.0.5
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Java Hotswap: Java Hotswap is enabled
IDE Plugin: 1.5.6 IntelliJ

Browsers

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions