diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java index d79174c19..bd0bf499e 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java @@ -80,7 +80,8 @@ public final class ODataErrorResponseChecker { statusLine.getReasonPhrase()); } - if (statusLine.getStatusCode() >= 500 && (error.getDetails() == null || error.getDetails().isEmpty()) && + if (statusLine.getStatusCode() >= 500 && error!= null && + (error.getDetails() == null || error.getDetails().isEmpty()) && (error.getInnerError() == null || error.getInnerError().size() == 0)) { result = new ODataServerErrorException(statusLine); } else { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java index bca612fb9..b2c5c40e0 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java @@ -137,7 +137,7 @@ public class ODataBatchUtilities { notEndLine = isNotEndLine(controller, currentLine); - if (notEndLine && os != null) { + if (notEndLine && os != null && currentLine!=null) { os.write(currentLine.getBytes(Constants.UTF8)); os.write(ODataStreamer.CRLF); } @@ -256,11 +256,14 @@ public class ODataBatchUtilities { public static Map.Entry readResponseLine(final ODataBatchLineIterator iterator) { final String line = readBatchPart(new ODataBatchController(iterator, null), 1); LOG.debug("Response line '{}'", line); + + if(line !=null){ - final Matcher matcher = RESPONSE_PATTERN.matcher(line.trim()); + final Matcher matcher = RESPONSE_PATTERN.matcher(line.trim()); - if (matcher.matches()) { - return new AbstractMap.SimpleEntry(Integer.valueOf(matcher.group(1)), matcher.group(2)); + if (matcher.matches()) { + return new AbstractMap.SimpleEntry(Integer.valueOf(matcher.group(1)), matcher.group(2)); + } } throw new IllegalArgumentException("Invalid response line '" + line + "'"); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/metadatavalidator/CsdlTypeValidator.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/metadatavalidator/CsdlTypeValidator.java index 4eef83610..af35bc657 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/metadatavalidator/CsdlTypeValidator.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/metadatavalidator/CsdlTypeValidator.java @@ -19,10 +19,8 @@ package org.apache.olingo.client.core.metadatavalidator; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; import org.apache.olingo.client.api.edm.xml.XMLMetadata; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java index 614f44b0a..36f37059e 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java @@ -35,10 +35,12 @@ public class FilterFunction implements FilterArg { @Override public String build() { final String[] strParams = params == null || params.length == 0 ? new String[0] : new String[params.length]; - for (int i = 0; i < strParams.length; i++) { - strParams[i] = params[i].build(); + if(params !=null){ + for (int i = 0; i < strParams.length; i++) { + strParams[i] = params[i].build(); + } } - + return new StringBuilder(function). append('('). append(strParams.length == 0 ? StringUtils.EMPTY : StringUtils.join(strParams, ',')). diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabStacktrace.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabStacktrace.java index 310ec3ab9..72b4f51fc 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabStacktrace.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabStacktrace.java @@ -63,8 +63,10 @@ public class DebugTabStacktrace implements DebugTab { gen.writeFieldName("stacktrace"); gen.writeStartArray(); - for (final StackTraceElement stackTraceElement : exception.getStackTrace()) { - appendJsonStackTraceElement(gen, stackTraceElement); + if(exception != null){ + for (final StackTraceElement stackTraceElement : exception.getStackTrace()) { + appendJsonStackTraceElement(gen, stackTraceElement); + } } gen.writeEndArray(); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java index 75f511577..6cc2c1e15 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java @@ -71,12 +71,13 @@ public class ServiceDocumentJsonSerializer { } gen.writeArrayFieldStart(Constants.VALUE); - - final EdmEntityContainer container = metadata.getEdm().getEntityContainer(); - if (container != null) { - writeEntitySets(gen, container); - writeFunctionImports(gen, container); - writeSingletons(gen, container); + if(metadata != null){ + final EdmEntityContainer container = metadata.getEdm().getEntityContainer(); + if (container != null) { + writeEntitySets(gen, container); + writeFunctionImports(gen, container); + writeSingletons(gen, container); + } } }