You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by zm...@apache.org on 2016/10/18 19:00:11 UTC

aurora git commit: Handle the case where content type header is null.

Repository: aurora
Updated Branches:
  refs/heads/master 8e228b681 -> 8c1200894


Handle the case where content type header is null.

Per the
[documentation](http://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequestWrapper.html#getContentType--)
`getContentType` can return `null`. This now handles that case gracefully.

Bugs closed: AURORA-1795

Reviewed at https://reviews.apache.org/r/52957/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/8c120089
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/8c120089
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/8c120089

Branch: refs/heads/master
Commit: 8c120089481df92f64f2a46ba05d716e5fbd5c7b
Parents: 8e228b6
Author: Zameer Manji <zm...@apache.org>
Authored: Tue Oct 18 12:00:03 2016 -0700
Committer: Zameer Manji <zm...@apache.org>
Committed: Tue Oct 18 12:00:03 2016 -0700

----------------------------------------------------------------------
 .../apache/aurora/scheduler/http/api/TContentAwareServlet.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/8c120089/src/main/java/org/apache/aurora/scheduler/http/api/TContentAwareServlet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/api/TContentAwareServlet.java b/src/main/java/org/apache/aurora/scheduler/http/api/TContentAwareServlet.java
index 1634cb8..d9df968 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/api/TContentAwareServlet.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/api/TContentAwareServlet.java
@@ -119,8 +119,8 @@ public class TContentAwareServlet extends HttpServlet {
   protected void doPost(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
 
-    Optional<ContentFactoryPair> factoryOptional =
-        inputConfig.getFactory(Optional.of(request.getContentType()).map(MediaType::valueOf));
+    Optional<ContentFactoryPair> factoryOptional = inputConfig
+        .getFactory(Optional.ofNullable(request.getContentType()).map(MediaType::valueOf));
 
     if (!factoryOptional.isPresent()) {
       response.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);