You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/06/15 11:33:06 UTC

[2/2] camel git commit: CAMEL-11413: camel-olingo - Potential NPE in getting content-type header

CAMEL-11413: camel-olingo - Potential NPE in getting content-type header


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3d33970a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3d33970a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3d33970a

Branch: refs/heads/camel-2.19.x
Commit: 3d33970afb5352bd1c9e6b327c214095bfc0ae3b
Parents: b0bf09a
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jun 15 13:31:59 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jun 15 13:32:23 2017 +0200

----------------------------------------------------------------------
 .../api/impl/AbstractFutureCallback.java        |  3 +-
 .../olingo2/api/impl/Olingo2AppImpl.java        |  2 -
 .../olingo2/api/impl/Olingo2Helper.java         | 42 ++++++++++++++++++++
 .../olingo2/api/impl/Olingo4Helper.java         | 42 --------------------
 4 files changed, 43 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3d33970a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java
index 04e22b1..08df91f 100644
--- a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java
+++ b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.util.regex.Pattern;
 
 import org.apache.camel.component.olingo2.api.Olingo2ResponseHandler;
-import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.StatusLine;
 import org.apache.http.concurrent.FutureCallback;
@@ -33,7 +32,7 @@ import org.apache.olingo.odata2.api.exception.ODataApplicationException;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.api.processor.ODataErrorContext;
 
-import static org.apache.camel.component.olingo2.api.impl.Olingo4Helper.getContentTypeHeader;
+import static org.apache.camel.component.olingo2.api.impl.Olingo2Helper.getContentTypeHeader;
 
 /**
 * Helper implementation of {@link org.apache.http.concurrent.FutureCallback}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d33970a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
index 7b3e0ed..59218a7 100644
--- a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
+++ b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
@@ -91,8 +91,6 @@ import org.apache.olingo.odata2.api.processor.ODataResponse;
 import org.apache.olingo.odata2.api.uri.PathSegment;
 import org.apache.olingo.odata2.api.uri.UriParser;
 
-import static org.apache.camel.component.olingo2.api.impl.Olingo4Helper.getContentTypeHeader;
-
 /**
  * Application API used by Olingo2 Component.
  */

http://git-wip-us.apache.org/repos/asf/camel/blob/3d33970a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2Helper.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2Helper.java b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2Helper.java
new file mode 100644
index 0000000..1d87e45
--- /dev/null
+++ b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2Helper.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.olingo2.api.impl;
+
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpResponse;
+import org.apache.http.entity.ContentType;
+
+/**
+ * Helper
+ */
+public final class Olingo2Helper {
+
+    private Olingo2Helper() {
+    }
+
+    /**
+     * Gets the content type header in a safe way
+     */
+    public static ContentType getContentTypeHeader(HttpResponse response) {
+        if (response.containsHeader(HttpHeaders.CONTENT_TYPE)) {
+            return ContentType.parse(response.getFirstHeader(HttpHeaders.CONTENT_TYPE).getValue());
+        } else {
+            return null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d33970a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo4Helper.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo4Helper.java b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo4Helper.java
deleted file mode 100644
index 749ea6b..0000000
--- a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo4Helper.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.olingo2.api.impl;
-
-import org.apache.http.HttpHeaders;
-import org.apache.http.HttpResponse;
-import org.apache.http.entity.ContentType;
-
-/**
- * Helper
- */
-public final class Olingo4Helper {
-
-    private Olingo4Helper() {
-    }
-
-    /**
-     * Gets the content type header in a safe way
-     */
-    public static ContentType getContentTypeHeader(HttpResponse response) {
-        if (response.containsHeader(HttpHeaders.CONTENT_TYPE)) {
-            return ContentType.parse(response.getFirstHeader(HttpHeaders.CONTENT_TYPE).getValue());
-        } else {
-            return null;
-        }
-    }
-
-}