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;) for (int i=fields.size();i-->0;)
{ {
HttpField field=fields.getField(i); HttpField field=fields.getField(i);
switch (field.getHeader()) if (field.getHeader() != null)
{ {
case IF_MATCH: switch (field.getHeader())
ifm=field.getValue(); {
break; case IF_MATCH:
case IF_NONE_MATCH: ifm=field.getValue();
ifnm=field.getValue(); break;
break; case IF_NONE_MATCH:
case IF_MODIFIED_SINCE: ifnm=field.getValue();
ifms=field.getValue(); break;
break; case IF_MODIFIED_SINCE:
case IF_UNMODIFIED_SINCE: ifms=field.getValue();
ifums=DateParser.parseDate(field.getValue()); break;
break; case IF_UNMODIFIED_SINCE:
default: ifums=DateParser.parseDate(field.getValue());
break;
default:
}
} }
} }
} }