NPE protect DefaultServlet iteration through request fields

This commit is contained in:
Jan Bartel 2014-10-16 19:02:21 +11:00
parent ec79a6f88e
commit 6a6c8bacda
1 changed files with 17 additions and 14 deletions

View File

@ -716,21 +716,24 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
for (int i=fields.size();i-->0;)
{
HttpField field=fields.getField(i);
switch (field.getHeader())
if (field.getHeader() != null)
{
case IF_MATCH:
ifm=field.getValue();
break;
case IF_NONE_MATCH:
ifnm=field.getValue();
break;
case IF_MODIFIED_SINCE:
ifms=field.getValue();
break;
case IF_UNMODIFIED_SINCE:
ifums=DateParser.parseDate(field.getValue());
break;
default:
switch (field.getHeader())
{
case IF_MATCH:
ifm=field.getValue();
break;
case IF_NONE_MATCH:
ifnm=field.getValue();
break;
case IF_MODIFIED_SINCE:
ifms=field.getValue();
break;
case IF_UNMODIFIED_SINCE:
ifums=DateParser.parseDate(field.getValue());
break;
default:
}
}
}
}