Java EE 7 Specification, EL 3.0. changes regarding coercion type

So, I was away from Java EE for six months, and now I’ve come back and redirected the application to Java EE 7 and I noticed that the JSR-341 / EL 3.0 specification contains changes in the Type Conversion section (now, section 1.23, previously section 1.18).

In section 1.23, the very first rule in all different types except String is that if X is null and Y is not a primitive null return. This is a very nice change.

So my first question is: regarding section 1.23.3. Forcing A to Type N,

In EL 2.1:

If A is null or "", return 0.

In EL 3.0:

If A is null and N is not a primitive type, return null.
Else if A is null or "", return 0.

Now there is no need to set a system property org.apache.el.parser.COERCE_TO_ZERO=false?


Further, there are several other changes that raise questions:

In the very first subsection, section 1.23.1 (previously 1.18.1) To force the value of X to enter Y, a rule is given for the general case. Now a new bullet has been added (my attention):

If X is null and Y is not a primitive type, nor is it a string, return null.

Section 1.23.2. Forcing A to String the first two bullets were turned upside down. Now they are in the following order:

If A is null: return ""
Otherwise, if A is a string: return A

, , . : , String , ? , ?

, , , null . , , , , .

, , : bean ? , @NotNull beans , String ? , , .

+4
1

org.apache.el.parser.COERCE_TO_ZERO=false?

Apache EL ( , , Tomcat), . , .

, Wildfly, , Apache EL, EL RI (, , GlassFish), . EL spec, Tomcat ( Tomcat 6.0.16, , "" 6.0.17, ).


, String , ?

. , . null String. , .

JSF EL spec EL- HTML ( String), /// , , web.xml, JSF null:

<context-param>
    <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
    <param-value>true</param-value>
</context-param>

JSF 2.0/2.1.

+3

Source: https://habr.com/ru/post/1542104/


All Articles