Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty String as Null is not effective in 2.2.0 #1203

Closed
eclipse-faces-bot opened this issue Jul 4, 2013 · 13 comments
Closed

Empty String as Null is not effective in 2.2.0 #1203

eclipse-faces-bot opened this issue Jul 4, 2013 · 13 comments

Comments

@eclipse-faces-bot
Copy link

GlassFish 4.0 uses EL 3.0.
Section 1.23.2 in EL 3.0 states that null String will be converted to empty String.
So we need a ELResolver to handle the conversion somethig like this

public class NullStringHanlder  extends ELResolver
{

	@Override
	public Class<?> getCommonPropertyType(ELContext context, Object base)
	{

		return String.class;
	}

	@Override
	public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
			Object base)
	{
		return null;
	}

	@Override
	public Class<?> getType(ELContext context, Object base, Object property)
	{

		return null;
	}

	@Override
	public Object getValue(ELContext context, Object base, Object property)
	{

		return null;
	}

	@Override
	public boolean isReadOnly(ELContext context, Object base, Object property)
	{

		return true;
	}

	@Override
	public void setValue(ELContext context, Object base, Object property,
			Object value)
	{

	}

	@Override
	public Object convertToType(ELContext context, Object obj,
			Class<?> targetType)
	{
		if (obj==null && String.class.equals(targetType))
		{
			context.setPropertyResolved(true);;
			return null;
		}
		return null;

	}

}

Environment

glassfish 4.0, EL 3.0

Affected Versions

[1.1, 1.2, 2.0, 2.1, 2.2]

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Reported by jasonzhang2002gmailcom

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Issue-Links:
is related to
JAVASERVERFACES-3071

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Was assigned to cappi

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Thanks for taking the time to report this. How do you suggest we reconcile this issue with the meaning of the javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL context-param? This param is described in section 11.1.3 Application Configuration Parameters of the spec.

javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL – If this param is set, and calling toLowerCase().equals("true") on a String representation of its value returns true, any implementation of UIInput.validate() must take the following additional action.
If the javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL context parameter value is true (ignoring case), and UIInput.getSubmittedValue() returns a zero-length String call UIInput.setSubmittedValue(null) and continue processing using null as the current submitted value

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
jasonzhang2002gmailcom said:
This is integration issue. Mojarra definitely follows the specification. However, the problem is deeply down into EL implementation/Spec. I am currently using a custom ELResolver(see above) only for this string conversion. By this way, no mojarra or EL is effected. Mojarra can come with such a resolver to explicitly to control the string conversion by default.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
We need to move this to the spec issue tracker because what you are asking is a spec change. We understand that EL 3.0 allows this, but we would need to bring this issue up to the expert group.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
rekiem87 said:
Glassfish 4.0.1 with the latest mojarra still have the issue

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@manfredriem said:
Setting priority to Critical

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@BalusC said:
Root cause of problem is in EL not JSF. The issue https://java.net/jira/browse/EL_SPEC-18 has been created on this.

This was proactively fixed in Oracle EL 3.0.1-b05 which is included in GlassFish since version 4.1.

See this blog for history and details on this particular problem: http://balusc.omnifaces.org/2015/10/the-empty-string-madness.html

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Marked as won't fix on Monday, August 8th 2016, 1:46:50 am

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-1203

@eclipse-faces-bot
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants