You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/09/03 18:37:15 UTC
olingo-odata4 git commit: [OLINGO-659] avoid null-pointer exception
in no-content case
Repository: olingo-odata4
Updated Branches:
refs/heads/master 4ff196cbe -> e92f66078
[OLINGO-659] avoid null-pointer exception in no-content case
Signed-off-by: Michael Bolz <mi...@sap.com>
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/e92f6607
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/e92f6607
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/e92f6607
Branch: refs/heads/master
Commit: e92f6607896d768c388bff07f50176e991664a04
Parents: 4ff196c
Author: Klaus Straubinger <kl...@sap.com>
Authored: Thu Sep 3 15:19:38 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Thu Sep 3 15:24:47 2015 +0200
----------------------------------------------------------------------
.../org/apache/olingo/commons/api/format/AcceptTypeTest.java | 5 ++++-
.../org/apache/olingo/server/core/ODataHttpHandlerImpl.java | 4 +++-
.../processor/queryoptions/expression/operand/TypedOperand.java | 4 ++--
3 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e92f6607/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
index 47cfc3f..589fae2 100644
--- a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
+++ b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
@@ -18,7 +18,10 @@
*/
package org.apache.olingo.commons.api.format;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e92f6607/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
index 75563b1..1624943 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
@@ -149,7 +149,9 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler {
}
}
- copyContent(odResponse, response);
+ if (odResponse.getContent() != null) {
+ copyContent(odResponse, response);
+ }
}
static void copyContent(final ODataResponse odataResponse, final HttpServletResponse servletResponse) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e92f6607/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operand/TypedOperand.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operand/TypedOperand.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operand/TypedOperand.java
index 9b18f46..11cf3ab 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operand/TypedOperand.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operand/TypedOperand.java
@@ -75,7 +75,7 @@ public class TypedOperand extends VisitorOperand {
// Use type conversion of EdmPrimitive types
try {
final String literal = getLiteral(value);
- newValue = tryCast(literal, (EdmPrimitiveType) asType);
+ newValue = tryCast(literal, asType);
} catch (EdmPrimitiveTypeException e) {
// Nothing to do
}
@@ -86,7 +86,7 @@ public class TypedOperand extends VisitorOperand {
}
}
- throw new ODataApplicationException("Cast failed ", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
+ throw new ODataApplicationException("Cast failed", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
}
public TypedOperand castToCommonType(final VisitorOperand otherOperand) throws ODataApplicationException {