Skip to content

Commit

Permalink
Merge #5304 from 3.0 into 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BalusC committed Sep 2, 2023
2 parents a8f7d0c + 5649a0c commit e0f7aa8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions impl/src/main/java/jakarta/faces/component/UIData.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public class UIData extends UIComponentBase implements NamingContainer, UniqueId
*/
public static final String COMPONENT_FAMILY = "jakarta.faces.Data";

// --------------------------------------------------------------- Constants

private static final ListDataModel EMPTY_DATA_MODEL = new ListDataModel(Collections.emptyList());

// ------------------------------------------------------------ Constructors

/**
Expand Down Expand Up @@ -655,7 +659,7 @@ public void setVar(String var) {

public boolean isRowStatePreserved() {
Boolean b = (Boolean) getStateHelper().get(PropertyKeys.rowStatePreserved);
return b == null ? false : b.booleanValue();
return b != null && b.booleanValue();
}

/**
Expand Down Expand Up @@ -1695,7 +1699,7 @@ protected DataModel getDataModel() {
// Synthesize a DataModel around our current value if possible
Object current = getValue();
if (current == null) {
setDataModel(new ListDataModel(Collections.EMPTY_LIST));
setDataModel(EMPTY_DATA_MODEL);
} else if (current instanceof DataModel) {
setDataModel((DataModel) current);
} else if (current instanceof List) {
Expand Down

0 comments on commit e0f7aa8

Please sign in to comment.