@Inject @CookiePram throws NullPointerException if the client browser does not send any
cookie.CookieParamProducer implementation broken.
-----------------------------------------------------------------------------------------------------------------------------------------
Key: SOLDER-302
URL:
https://issues.jboss.org/browse/SOLDER-302
Project: Seam Solder
Issue Type: Bug
Components: Servlet
Affects Versions: 3.0.0.Final
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;
{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() is 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