Skip to content
Merged
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
9 changes: 5 additions & 4 deletions api/src/main/java/jakarta/faces/component/MessageFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import jakarta.faces.application.Application;
import jakarta.faces.application.ApplicationFactory;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.application.FacesMessage.Severity;
import jakarta.faces.context.FacesContext;

/**
Expand Down Expand Up @@ -79,7 +80,7 @@ static FacesMessage getMessage(FacesContext context, String messageId, FacesMess
* @param messageId - the key of the message in the resource bundle
* @param params - substittion parameters
*
* @return a localized <code>FacesMessage</code> with the severity of FacesMessage.SEVERITY_ERROR
* @return a localized <code>FacesMessage</code> with the severity of Severity.ERROR
*/
static FacesMessage getMessage(String messageId, Object... params) {
Locale locale = null;
Expand All @@ -106,7 +107,7 @@ static FacesMessage getMessage(String messageId, Object... params) {
* @param messageId - the key of the message in the resource bundle
* @param params - substittion parameters
*
* @return a localized <code>FacesMessage</code> with the severity of FacesMessage.SEVERITY_ERROR
* @return a localized <code>FacesMessage</code> with the severity of Severity.ERROR
*/
static FacesMessage getMessage(Locale locale, String messageId, Object... params) {
String summary = null;
Expand Down Expand Up @@ -163,7 +164,7 @@ static FacesMessage getMessage(Locale locale, String messageId, Object... params

// At this point, we have a summary and a bundle.
FacesMessage ret = new BindingFacesMessage(locale, summary, detail, params);
ret.setSeverity(FacesMessage.SEVERITY_ERROR);
ret.setSeverity(Severity.ERROR);
return ret;
}

Expand All @@ -176,7 +177,7 @@ static FacesMessage getMessage(Locale locale, String messageId, Object... params
* @param messageId - the key of the message in the resource bundle
* @param params - substittion parameters
*
* @return a localized <code>FacesMessage</code> with the severity of FacesMessage.SEVERITY_ERROR
* @return a localized <code>FacesMessage</code> with the severity of Severity.ERROR
*/
static FacesMessage getMessage(FacesContext context, String messageId, Object... params) {

Expand Down
3 changes: 2 additions & 1 deletion api/src/main/java/jakarta/faces/component/UIData.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import jakarta.faces.FacesException;
import jakarta.faces.application.Application;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.application.FacesMessage.Severity;
import jakarta.faces.application.StateManager;
import jakarta.faces.component.visit.VisitCallback;
import jakarta.faces.component.visit.VisitContext;
Expand Down Expand Up @@ -2128,7 +2129,7 @@ private Boolean isNestedWithinIterator(FacesContext context) {
private boolean contextHasErrorMessages(FacesContext context) {

FacesMessage.Severity sev = context.getMaximumSeverity();
return sev != null && FacesMessage.SEVERITY_ERROR.compareTo(sev) >= 0;
return sev != null && Severity.ERROR.compareTo(sev) >= 0;

}

Expand Down
21 changes: 11 additions & 10 deletions api/src/main/java/jakarta/faces/component/UIInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import jakarta.faces.FacesException;
import jakarta.faces.application.Application;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.application.FacesMessage.Severity;
import jakarta.faces.context.ExceptionHandler;
import jakarta.faces.context.ExternalContext;
import jakarta.faces.context.FacesContext;
Expand Down Expand Up @@ -155,12 +156,12 @@ public class UIInput extends UIOutput implements EditableValueHolder {
* </p>
*/
public static final String ALWAYS_PERFORM_VALIDATION_WHEN_REQUIRED_IS_TRUE = "jakarta.faces.ALWAYS_PERFORM_VALIDATION_WHEN_REQUIRED_IS_TRUE";

/**
* <p class="changed_added_5_0">
* Allowed values for the initialization parameter named by the {@value UIInput#VALIDATE_EMPTY_FIELDS_PARAM_NAME} constant.
* </p>
*
*
* @since 5.0
*/
public enum ValidateEmptyFields {
Expand All @@ -171,14 +172,14 @@ public enum ValidateEmptyFields {
* </p>
*/
AUTO,

/**
* <p>
* Indicates that empty fields should always be validated.
* </p>
*/
TRUE,

/**
* <p>
* Indicates that empty fields should never be validated.
Expand Down Expand Up @@ -738,7 +739,7 @@ public void updateModel(FacesContext context) {
if (null == messageStr) {
message = MessageFactory.getMessage(context, UPDATE_MESSAGE_ID, MessageFactory.getLabel(context, this));
} else {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr, messageStr);
message = new FacesMessage(Severity.ERROR, messageStr, messageStr);
}
setValid(false);
} catch (Exception e) {
Expand Down Expand Up @@ -1008,7 +1009,7 @@ protected Object getConvertedValue(FacesContext context, Object newSubmittedValu
* the value is <code>null</code> or equal <span class="changed_modified_5_0">(ignoring case) to the enum constant {@link ValidateEmptyFields#AUTO}</span> take
* appropriate action to determine if Bean Validation is present in the runtime environment. If not, validation should
* not proceed. If so, validation should proceed. If the value is equal (ignoring case) to
* <span class="changed_modified_5_0">the enum constant {@link ValidateEmptyFields#TRUE}</span> validation should proceed. Otherwise,
* <span class="changed_modified_5_0">the enum constant {@link ValidateEmptyFields#TRUE}</span> validation should proceed. Otherwise,
* <span class="changed_added_5_0">if the value is equal (ignoring case) to the enum constant {@link ValidateEmptyFields#FALSE}</span> validation should not
* proceed.
* </p>
Expand All @@ -1035,7 +1036,7 @@ protected void validateValue(FacesContext context, Object newValue) {
String requiredMessageStr = getRequiredMessage();
FacesMessage message;
if (null != requiredMessageStr) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessageStr, requiredMessageStr);
message = new FacesMessage(Severity.ERROR, requiredMessageStr, requiredMessageStr);
} else {
message = MessageFactory.getMessage(context, REQUIRED_MESSAGE_ID, MessageFactory.getLabel(context, this));
}
Expand All @@ -1058,8 +1059,8 @@ protected void validateValue(FacesContext context, Object newValue) {
String validatorMessageString = getValidatorMessage();

if (null != validatorMessageString) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR, validatorMessageString, validatorMessageString);
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message = new FacesMessage(Severity.ERROR, validatorMessageString, validatorMessageString);
message.setSeverity(Severity.ERROR);
} else {
Collection<FacesMessage> messages = ve.getFacesMessages();
if (null != messages) {
Expand Down Expand Up @@ -1362,7 +1363,7 @@ private void addConversionErrorMessage(FacesContext context, ConverterException
FacesMessage message;
String converterMessageString = getConverterMessage();
if (null != converterMessageString) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR, converterMessageString, converterMessageString);
message = new FacesMessage(Severity.ERROR, converterMessageString, converterMessageString);
} else {
message = ce.getFacesMessage();
if (message == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import jakarta.el.ValueExpression;
import jakarta.faces.FactoryFinder;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.application.FacesMessage.Severity;
import jakarta.faces.context.FacesContext;
import jakarta.faces.convert.Converter;
import jakarta.faces.convert.ConverterException;
Expand Down Expand Up @@ -251,7 +252,7 @@ public void processValidators(FacesContext context) {
String requiredMessageStr = getRequiredMessage();
FacesMessage message;
if (null != requiredMessageStr) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessageStr, requiredMessageStr);
message = new FacesMessage(Severity.ERROR, requiredMessageStr, requiredMessageStr);
} else {
message = MessageFactory.getMessage(context, REQUIRED_MESSAGE_ID, MessageFactory.getLabel(context, this));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public boolean isResetValues() {
* sequence:
* <ol>
* <li>If {@link #isResetValues()} returns <code>true</code>, then call
* {@link UIViewRoot#resetValues(FacesContext, Collection)}, passing {@link #getRenderIds()}.</li>
* {@link UIViewRoot#resetValues(FacesContext, Collection, jakarta.faces.component.visit.VisitHint...)}, passing {@link #getRenderIds()}.</li>
* <li>If {@link #isRenderAll()} returns <code>false</code>, then render any component resource of {@link UIViewRoot}
* whose {@link ResourceHandler#getRendererTypeForResourceName(String)} does not return <code>null</code>, and whose
* {@link UIComponent#getChildCount()} is zero, and whose
Expand Down
9 changes: 5 additions & 4 deletions api/src/main/java/jakarta/faces/convert/MessageFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import jakarta.faces.application.Application;
import jakarta.faces.application.ApplicationFactory;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.application.FacesMessage.Severity;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;

Expand Down Expand Up @@ -81,7 +82,7 @@ static FacesMessage getMessage(FacesContext context, String messageId, FacesMess
* @param messageId - the key of the message in the resource bundle
* @param params - substittion parameters
*
* @return a localized <code>FacesMessage</code> with the severity of FacesMessage.SEVERITY_ERROR
* @return a localized <code>FacesMessage</code> with the severity of Severity.ERROR
*/
static FacesMessage getMessage(String messageId, Object... params) {
Locale locale = null;
Expand All @@ -108,7 +109,7 @@ static FacesMessage getMessage(String messageId, Object... params) {
* @param messageId - the key of the message in the resource bundle
* @param params - substittion parameters
*
* @return a localized <code>FacesMessage</code> with the severity of FacesMessage.SEVERITY_ERROR
* @return a localized <code>FacesMessage</code> with the severity of Severity.ERROR
*/
static FacesMessage getMessage(Locale locale, String messageId, Object... params) {
String summary = null;
Expand Down Expand Up @@ -165,7 +166,7 @@ static FacesMessage getMessage(Locale locale, String messageId, Object... params

// At this point, we have a summary and a bundle.
FacesMessage ret = new BindingFacesMessage(locale, summary, detail, params);
ret.setSeverity(FacesMessage.SEVERITY_ERROR);
ret.setSeverity(Severity.ERROR);
return ret;
}

Expand All @@ -178,7 +179,7 @@ static FacesMessage getMessage(Locale locale, String messageId, Object... params
* @param messageId - the key of the message in the resource bundle
* @param params - substittion parameters
*
* @return a localized <code>FacesMessage</code> with the severity of FacesMessage.SEVERITY_ERROR
* @return a localized <code>FacesMessage</code> with the severity of Severity.ERROR
*/
static FacesMessage getMessage(FacesContext context, String messageId, Object... params) {

Expand Down
9 changes: 5 additions & 4 deletions api/src/main/java/jakarta/faces/validator/MessageFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import jakarta.faces.application.Application;
import jakarta.faces.application.ApplicationFactory;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.application.FacesMessage.Severity;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;

Expand Down Expand Up @@ -82,7 +83,7 @@ static FacesMessage getMessage(FacesContext context, String messageId, FacesMess
* @param messageId - the key of the message in the resource bundle
* @param params - substittion parameters
*
* @return a localized <code>FacesMessage</code> with the severity of FacesMessage.SEVERITY_ERROR
* @return a localized <code>FacesMessage</code> with the severity of Severity.ERROR
*/
static FacesMessage getMessage(String messageId, Object... params) {
Locale locale = null;
Expand All @@ -109,7 +110,7 @@ static FacesMessage getMessage(String messageId, Object... params) {
* @param messageId - the key of the message in the resource bundle
* @param params - substittion parameters
*
* @return a localized <code>FacesMessage</code> with the severity of FacesMessage.SEVERITY_ERROR
* @return a localized <code>FacesMessage</code> with the severity of Severity.ERROR
*/
static FacesMessage getMessage(Locale locale, String messageId, Object... params) {
String summary = null;
Expand Down Expand Up @@ -166,7 +167,7 @@ static FacesMessage getMessage(Locale locale, String messageId, Object... params

// At this point, we have a summary and a bundle.
FacesMessage ret = new BindingFacesMessage(locale, summary, detail, params);
ret.setSeverity(FacesMessage.SEVERITY_ERROR);
ret.setSeverity(Severity.ERROR);
return ret;
}

Expand All @@ -179,7 +180,7 @@ static FacesMessage getMessage(Locale locale, String messageId, Object... params
* @param messageId - the key of the message in the resource bundle
* @param params - substittion parameters
*
* @return a localized <code>FacesMessage</code> with the severity of FacesMessage.SEVERITY_ERROR
* @return a localized <code>FacesMessage</code> with the severity of Severity.ERROR
*/
static FacesMessage getMessage(FacesContext context, String messageId, Object... params) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package jakarta.faces.validator;

import jakarta.faces.application.FacesMessage;
import jakarta.faces.application.FacesMessage.Severity;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIInput;
import jakarta.faces.context.FacesContext;
Expand Down Expand Up @@ -63,7 +64,7 @@ public void validate(FacesContext context, UIComponent component, Object value)

// respect the message string override on the component to emulate required="true" behavior
if (requiredMessageStr != null) {
msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessageStr, requiredMessageStr);
msg = new FacesMessage(Severity.ERROR, requiredMessageStr, requiredMessageStr);
} else {
msg = MessageFactory.getMessage(context, UIInput.REQUIRED_MESSAGE_ID, MessageFactory.getLabel(context, component));
}
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/renderkitdoc/standard-html-renderkit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4922,10 +4922,10 @@
resolve the associated component.</p> This will be
the only message we render. Obtain the severity style for this
message. If the severity of the message is
<code>FacesMessage.SEVERITY_INFO</code>, the severity style
<code>Severity.INFO</code>, the severity style
comes from the value of the "infoStyle" attribute. If the
severity of the message is
<code>FacesMessage.SEVERITY_WARN</code>, the severity style
<code>Severity.WARN</code>, the severity style
comes from the value of the "warnStyle" attribute, and so on for
each of the severities, <code>INFO, WARN, ERROR</code> and
<code>FATAL</code>. The same rules apply for obtaining the
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/vdldoc/faces.html.taglib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5418,11 +5418,11 @@
will be
the only message we render. Obtain the severity style for this
message. If the severity of the message is
&lt;code&gt;FacesMessage.SEVERITY_INFO&lt;/code&gt;, the severity
&lt;code&gt;Severity.INFO&lt;/code&gt;, the severity
style
comes from the value of the "infoStyle" attribute. If the
severity of the message is
&lt;code&gt;FacesMessage.SEVERITY_WARN&lt;/code&gt;, the severity
&lt;code&gt;Severity.WARN&lt;/code&gt;, the severity
style
comes from the value of the "warnStyle" attribute, and so on for
each of the severities, &lt;code&gt;INFO, WARN, ERROR&lt;/code&gt;
Expand Down