Skip to content

Commit

Permalink
Disallow ValueExpression on var property
Browse files Browse the repository at this point in the history
  • Loading branch information
BalusC committed Mar 27, 2021
1 parent 9d05155 commit 33c3d06
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions impl/src/main/java/jakarta/faces/component/UISelectItems.java
Expand Up @@ -16,6 +16,7 @@

package jakarta.faces.component;

import jakarta.el.ValueExpression;
import jakarta.faces.model.SelectItem;

/**
Expand Down Expand Up @@ -75,6 +76,27 @@ public UISelectItems() {

}

// ---------------------------------------------------------------- Bindings

/**
* <p class="changed_added_4_0">
* Set the {@link ValueExpression} used to calculate the value for the specified attribute or property name, if any.
* In addition, if a {@link ValueExpression} is set for the <code>var</code> property, regardless of the value, throw an illegal argument exception.
* </p>
*
* @throws IllegalArgumentException If <code>name</code> is one of <code>id</code>, <code>parent</code>, or <code>var</code>.
* @throws NullPointerException {@inheritDoc}
*/
@Override
public void setValueExpression(String name, ValueExpression binding) {

if ("var".equals(name)) {
throw new IllegalArgumentException();
}

super.setValueExpression(name, binding);
}

// -------------------------------------------------------------- Properties

@Override
Expand Down

0 comments on commit 33c3d06

Please sign in to comment.