Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3474

NPE in HttpServletResponse.getHeaders

    XMLWordPrintable

    Details

    • Steps to Reproduce:
      Hide

       
      public class TestServlet extends HttpServlet {
       
          @Override
          protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              resp.setHeader("Foo", "bar");
       
              Collection<String> foo = resp.getHeaders("Foo"); // ok
              Collection<String> unset = resp.getHeaders("unset"); // throws NPE
          }
      }
      

      Show
        public class TestServlet extends HttpServlet {   @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setHeader("Foo", "bar");   Collection<String> foo = resp.getHeaders("Foo"); // ok Collection<String> unset = resp.getHeaders("unset"); // throws NPE } }

      Description

      Calling getHeaders(java.lang.String name) on HttpServletResponse produces NullPointerException if the requested header is not set. An empty collection should be returned.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                swd847 Stuart Douglas
                Reporter:
                jmalek Jaroslav Málek
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: