-
Bug
-
Resolution: Done
-
Major
-
2.2.2.GA, 2.3.2.Final
-
None
Making a PUT call without setting the Content-Type header triggers a NPE:
java.lang.NullPointerException at org.jboss.resteasy.plugins.server.servlet.HttpServletInputMessage.getPutFormParameters(HttpServletInputMessage.java:67) at org.jboss.resteasy.plugins.server.servlet.HttpServletInputMessage.getFormParameters(HttpServletInputMessage.java:114) at org.jboss.resteasy.plugins.server.servlet.HttpServletInputMessage.getPutDecodedFormParameters(HttpServletInputMessage.java:88) at org.jboss.resteasy.plugins.server.servlet.HttpServletInputMessage.getDecodedFormParameters(HttpServletInputMessage.java:127) at org.jboss.resteasy.core.FormParamInjector.inject(FormParamInjector.java:27) at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:114)
From what I see, the fix would be to modify org.jboss.resteasy.plugins.server.servlet.HttpServletInputMessage#getPutFormParameters():
replace
if (getHttpHeaders().getMediaType().isCompatible(MediaType.valueOf("application/x-www-form-urlencoded")))
with
if (MediaType.valueOf("application/x-www-form-urlencoded").isCompatible(getHttpHeaders().getMediaType()))