Return-Path: X-Original-To: apmail-olingo-commits-archive@minotaur.apache.org Delivered-To: apmail-olingo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5AFD510B80 for ; Thu, 12 Sep 2013 14:42:49 +0000 (UTC) Received: (qmail 94640 invoked by uid 500); 12 Sep 2013 14:42:49 -0000 Delivered-To: apmail-olingo-commits-archive@olingo.apache.org Received: (qmail 93455 invoked by uid 500); 12 Sep 2013 14:42:44 -0000 Mailing-List: contact commits-help@olingo.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@olingo.incubator.apache.org Delivered-To: mailing list commits@olingo.incubator.apache.org Received: (qmail 93217 invoked by uid 99); 12 Sep 2013 14:42:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Sep 2013 14:42:43 +0000 X-ASF-Spam-Status: No, hits=-2000.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 12 Sep 2013 14:42:42 +0000 Received: (qmail 89347 invoked by uid 99); 12 Sep 2013 14:42:22 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Sep 2013 14:42:22 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E7EA88BFC8A; Thu, 12 Sep 2013 14:42:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sklevenz@apache.org To: commits@olingo.incubator.apache.org Message-Id: <23586888797b4fccbc83135bfb0f28d7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: Issue OLINGO-3 - NPE guard for missing Accept headers Date: Thu, 12 Sep 2013 14:42:21 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org 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 Authored: Thu Sep 12 16:40:00 2013 +0200 Committer: Stephan Klevenz 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 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)); + } } } }