From 6a6c8bacda1e64b1be2bf561db92b99e50148126 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 16 Oct 2014 19:02:21 +1100 Subject: [PATCH] NPE protect DefaultServlet iteration through request fields --- .../eclipse/jetty/servlet/DefaultServlet.java | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java index 9e661ef1113..b45d7442853 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java @@ -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: + } } } }