Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ public String getRendererType()
public boolean getRendersChildren()
{
Renderer renderer = getRenderer(getFacesContext());
return renderer != null ? renderer.getRendersChildren() : false;
return renderer != null && renderer.getRendersChildren();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/jakarta/faces/component/UIData.java
Original file line number Diff line number Diff line change
Expand Up @@ -2281,7 +2281,7 @@ public void setVar(String var)
public boolean isRowStatePreserved()
{
Boolean b = (Boolean) getStateHelper().get(PropertyKeys.rowStatePreserved);
return b == null ? false : b;
return b != null && b;
}

public void setRowStatePreserved(boolean preserveComponentState)
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/jakarta/faces/component/UIOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void setConverter(Converter converter)
private boolean _isSetConverter()
{
Boolean value = (Boolean) getStateHelper().get(PropertyKeys.converterSet);
return value == null ? false : value;
return value != null && value;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/jakarta/faces/component/UIViewRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ public boolean getRendersChildren()
// If PartialViewContext.isAjaxRequest() returns true this method must return true.
PartialViewContext context = getFacesContext().getPartialViewContext();

return (context.isAjaxRequest()) ? true : super.getRendersChildren();
return context.isAjaxRequest() || super.getRendersChildren();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ else if (FACET_CREATED_UIPANEL_MARKER.length() == keyLength &&
}

PropertyDescriptorWrapper pd = getPropertyDescriptor((String) key);
return pd == null || pd.getReadMethod() == null
? getUnderlyingMap().containsKey(key)
: false;
return (pd == null || pd.getReadMethod() == null) && getUnderlyingMap().containsKey(key);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public Object put(String key, Object value)
&& RESOURCE_DEPENDENCY_UNIQUE_ID_KEY.equals(key))
{
boolean b = _root.isResourceDependencyUniqueId();
_root.setResourceDependencyUniqueId(value == null ? false : (Boolean) value);
_root.setResourceDependencyUniqueId(value != null && (Boolean) value);
return b;
}
if (UNIQUE_ID_COUNTER_KEY.length() == keyLength
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void setValueExpression(String name, ValueExpression expression)
public boolean isDisabled()
{
Boolean retVal = (Boolean) getStateHelper().eval(ATTR_DISABLED);
retVal = (retVal == null) ? false : retVal;
retVal = retVal != null && retVal;
return retVal;
}

Expand All @@ -177,7 +177,7 @@ public void setDisabled(boolean disabled)
public boolean isImmediate()
{
Boolean retVal = (Boolean) getStateHelper().eval(ATTR_IMMEDIATE);
retVal = (retVal == null) ? false : retVal;
retVal = retVal != null && retVal;
return retVal;
}

Expand All @@ -198,7 +198,7 @@ public boolean isImmediateSet()
public boolean isResetValues()
{
Boolean retVal = (Boolean) getStateHelper().eval(ATTR_RESET_VALUES);
retVal = (retVal == null) ? false : retVal;
retVal = retVal != null && retVal;
return retVal;
}

Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/jakarta/faces/view/ViewMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static Collection<UIViewAction> getViewActions(UIViewRoot root)
public static boolean hasMetadata(UIViewRoot root)
{
UIComponent metadataFacet = root.getFacet(UIViewRoot.METADATA_FACET_NAME);
return metadataFacet != null ? metadataFacet.getChildCount() > 0 : false;
return metadataFacet != null && metadataFacet.getChildCount() > 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,21 @@ public int size()
public boolean isEmpty()
{
Map<Object, Object> wrapped = getWrapped(false);
return wrapped == null ? true : wrapped.isEmpty();
return wrapped == null || wrapped.isEmpty();
}

@Override
public boolean containsKey(Object key)
{
Map<Object, Object> wrapped = getWrapped(false);
return wrapped == null ? false : wrapped.containsKey(key);
return wrapped != null && wrapped.containsKey(key);
}

@Override
public boolean containsValue(Object value)
{
Map<Object, Object> wrapped = getWrapped(false);
return wrapped == null ? false : wrapped.containsValue(value);
return wrapped != null && wrapped.containsValue(value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public void storeViewStructureMetadata(FacesContext context, UIViewRoot root)
{
FaceletState faceletState = (FaceletState) root.getAttributes().get(
ComponentSupport.FACELET_STATE_INSTANCE);
boolean isDynamic = faceletState != null ? faceletState.isDynamic() : false;
boolean isDynamic = faceletState != null && faceletState.isDynamic();
if (!isDynamic)
{
viewPool.storeStaticViewStructureMetadata(context, root, faceletState);
Expand All @@ -451,7 +451,7 @@ public ViewStructureMetadata retrieveViewStructureMetadata(FacesContext context,
{
FaceletState faceletState = (FaceletState) root.getAttributes().get(
ComponentSupport.FACELET_STATE_INSTANCE);
boolean isDynamic = faceletState != null ? faceletState.isDynamic() : false;
boolean isDynamic = faceletState != null && faceletState.isDynamic();
if (!isDynamic)
{
return viewPool.retrieveStaticViewStructureMetadata(context, root);
Expand All @@ -469,7 +469,7 @@ public void pushResetableView(FacesContext context, UIViewRoot view, FaceletStat
ViewPool viewPool = getViewPool(context, view);
if (viewPool != null)
{
boolean isDynamic = faceletViewState != null ? faceletViewState.isDynamic() : false;
boolean isDynamic = faceletViewState != null && faceletViewState.isDynamic();
if (!isDynamic)
{
clearTransientAndNonFaceletComponentsForStaticView(context, view);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public boolean isEmpty()
{
if (_markCreated == null)
{
return _attributes == null ? false : _attributes.isEmpty();
return _attributes != null && _attributes.isEmpty();
}
else
{
Expand All @@ -518,7 +518,7 @@ public boolean containsKey(Object key)
}
else
{
return (_attributes == null ? false :_attributes.containsKey(key));
return (_attributes != null && _attributes.containsKey(key));
}
}

Expand All @@ -529,7 +529,7 @@ public boolean containsValue(Object value)
{
return true;
}
return (_attributes == null) ? false : _attributes.containsValue(value);
return _attributes != null && _attributes.containsValue(value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public Map<String, ValueExpression> getParametersMap()

public boolean isParametersMapEmpty()
{
return _parameters == null ? true : _parameters.isEmpty();
return _parameters == null || _parameters.isEmpty();
}

public Set<String> getKnownParameters()
Expand All @@ -226,7 +226,7 @@ public Set<String> getKnownParameters()

public boolean isKnownParametersEmpty()
{
return _knownParameters == null ? true : _knownParameters.isEmpty();
return _knownParameters == null || _knownParameters.isEmpty();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,9 @@ public TagAttributeImpl(Location location, String ns, String localName, String q
throw new TagAttributeException(this, e);
}

compositeComponentExpression = !literal
? CompositeComponentELUtils.isCompositeComponentExpression(this.value)
: false;
compositeComponentAttrMethodExpression = compositeComponentExpression
? CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(this.value)
: false;
resourceExpression = !literal
? ResourceELUtils.isResourceExpression(this.value)
: false;
compositeComponentExpression = !literal && CompositeComponentELUtils.isCompositeComponentExpression(this.value);
compositeComponentAttrMethodExpression = compositeComponentExpression && CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(this.value);
resourceExpression = !literal && ResourceELUtils.isResourceExpression(this.value);

this.capabilities = (literal ? EL_LITERAL : 0)
| (compositeComponentExpression ? EL_CC : 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void setTransient(boolean newTransientValue)

public boolean isDynamic()
{
return stateMap == null ? false : !stateMap.isEmpty();
return stateMap != null && !stateMap.isEmpty();
}

public void putBinding(String uniqueId, String key, ValueExpression expr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ public boolean isRequestedSessionIdValid()
/** {@inheritDoc} */
public boolean isUserInRole(String role)
{
return (this.roles != null) ? this.roles.contains(role) : false;
return this.roles != null && this.roles.contains(role);
}

// ------------------------------------------------- ServletRequest Methods
Expand Down