olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sklev...@apache.org
Subject git commit: Issue OLINGO-3 - NPE guard for missing Accept headers
Date Thu, 12 Sep 2013 14:42:21 GMT
Updated Branches:
  refs/heads/master 99e549dde -> 6174b7c28


Issue OLINGO-3 - NPE guard for missing Accept headers


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/6174b7c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/6174b7c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/6174b7c2

Branch: refs/heads/master
Commit: 6174b7c2892f097d89226bc9c409d2757ad82467
Parents: 99e549d
Author: Stephan Klevenz <sklevenz@apache.org>
Authored: Thu Sep 12 16:40:00 2013 +0200
Committer: Stephan Klevenz <sklevenz@apache.org>
Committed: Thu Sep 12 16:41:56 2013 +0200

----------------------------------------------------------------------
 .../org/apache/olingo/odata2/core/rest/RestUtil.java    | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6174b7c2/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/RestUtil.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/RestUtil.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/RestUtil.java
index f134859..56b883d 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/RestUtil.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/rest/RestUtil.java
@@ -131,11 +131,13 @@ public class RestUtil {
     // first validate all accept header content types are 'parseable' and valif from our
point of view
     List<String> acceptHeaders = param.getHttpHeaders().getRequestHeader(HttpHeaders.ACCEPT);
 
-    for (String acceptHeader : acceptHeaders) {
-      String[] contentTypes = acceptHeader.split(",");
-      for (String contentType : contentTypes) {
-        if (!ContentType.isParseable(contentType.trim())) {
-          throw new ODataBadRequestException(ODataBadRequestException.INVALID_HEADER.addContent(HttpHeaders.ACCEPT,
acceptHeader));
+    if (acceptHeaders != null) {
+      for (String acceptHeader : acceptHeaders) {
+        String[] contentTypes = acceptHeader.split(",");
+        for (String contentType : contentTypes) {
+          if (!ContentType.isParseable(contentType.trim())) {
+            throw new ODataBadRequestException(ODataBadRequestException.INVALID_HEADER.addContent(HttpHeaders.ACCEPT,
acceptHeader));
+          }
         }
       }
     }


Mime
View raw message