[
https://issues.jboss.org/browse/SOLDER-302?page=com.atlassian.jira.plugin...
]
Jason Porter resolved SOLDER-302.
---------------------------------
Resolution: Done
Please try HEAD from Solder.
@Inject @CookiePram throws NullPointerException if the client browser
does not send any cookie.CookieParamProducer and ImplicitHttpServletObjectsProducer
implementations are broken.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: SOLDER-302
URL:
https://issues.jboss.org/browse/SOLDER-302
Project: Solder
Issue Type: Bug
Components: Servlet
Affects Versions: 3.0.0.Final, 3.1.0.Beta5
Environment: CentOS
Reporter: Assen Todorov
Fix For: 3.1.0.Final
The following code snippet throws a NullPointerException if the client does not send any
cookie.
{code}
@Inject
@CookieParam("lang")
@DefaultValue("en")
private Instance<String> languageResolver;
...
final String language = languageResolver.get();
{code}
The problem is in org.jboss.seam.servlet.http.CookieParamProducer.getCookieValue()
{code:title=CookieParamProducer.java}
for (Cookie c : request.getCookies()) {
{code}
The servlet specification says the following about HttpServletRequest.getCookies():
{quote}
Returns an array containing all of the Cookie objects the client sent with this request.
This method returns null if no cookies were sent.
{quote}
So CookieParamProducer.java throws NullPointerException when it try to iterate over
NULL.
org.jboss.seam.servlet.http.CookieParamProducer.getCookie() and
org.jboss.seam.servlet.http.ImplicitHttpServletObjectsProducer.getCookies() are also
broken because of the same reason.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira