You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/08/17 15:43:30 UTC

[1/2] olingo-odata4 git commit: [OLINGO-659] Fix code analysis issues

Repository: olingo-odata4
Updated Branches:
  refs/heads/master 75b552308 -> 33478d8cc


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
index b40d4ef..899226f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
@@ -73,6 +73,7 @@ import org.apache.olingo.server.core.serializer.utils.ContextURLBuilder;
 import org.apache.olingo.server.core.serializer.utils.ExpandSelectHelper;
 
 public class ODataXmlSerializer extends AbstractODataSerializer {
+
   private static final String DATA = "d";
   private static final String CONTEXT = "context";
   /** The default character set is UTF-8. */
@@ -103,11 +104,11 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -132,11 +133,11 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -178,11 +179,11 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -267,11 +268,11 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -309,11 +310,11 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -838,7 +839,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
 
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
-      cachedException = new SerializerException("An I/O exception occurred.", e,
+      cachedException = new SerializerException(IO_EXCEPTION_TEXT, e,
           SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (final EdmPrimitiveTypeException e) {
@@ -848,7 +849,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -890,11 +891,11 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -937,7 +938,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
 
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
-      cachedException = new SerializerException("An I/O exception occurred.", e,
+      cachedException = new SerializerException(IO_EXCEPTION_TEXT, e,
           SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (final EdmPrimitiveTypeException e) {
@@ -947,7 +948,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -982,11 +983,11 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -1017,11 +1018,11 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -1085,11 +1086,11 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final XMLStreamException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java
index 850a5d2..ae2700d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java
@@ -85,7 +85,7 @@ public class UriHelperImpl implements UriHelper {
                 edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode()));
         result.append(Encoder.encode(value));
       } catch (final EdmPrimitiveTypeException e) {
-        throw new SerializerException("Wrong key value!",
+        throw new SerializerException("Wrong key value!", e,
             SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, edmProperty.getName(), propertyValue.toString());
       }
     }
@@ -114,7 +114,7 @@ public class UriHelperImpl implements UriHelper {
       throw new DeserializerException("Invalid entity binding link", MessageKeys.INVALID_ENTITY_BINDING_LINK,
           entityId);
     } catch (UriParserException e) {
-      throw new DeserializerException("Invalid entity binding link", MessageKeys.INVALID_ENTITY_BINDING_LINK,
+      throw new DeserializerException("Invalid entity binding link", e, MessageKeys.INVALID_ENTITY_BINDING_LINK,
           entityId);
     }
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
index 312b324..0e3ab99 100644
--- a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
+++ b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
@@ -99,6 +99,7 @@ SerializerException.WRONG_PROPERTY_VALUE=The value '%2$s' is not valid for prope
 SerializerException.WRONG_PRIMITIVE_VALUE=The value '%2$s' is not valid for the primitive type '%1$s' and the given facets.
 SerializerException.UNKNOWN_TYPE=Type '%1s' not found in metadata.
 SerializerException.WRONG_BASE_TYPE=Type '%1s' is not derived from '%2s'.
+SerializerException.UNSUPPORTED_ENCODING=The encoding '%1s' is not supported.
 
 DeserializerException.NOT_IMPLEMENTED=The requested deserialization method has not been implemented yet.
 DeserializerException.IO_EXCEPTION=An I/O exception occurred.


[2/2] olingo-odata4 git commit: [OLINGO-659] Fix code analysis issues

Posted by ch...@apache.org.
[OLINGO-659] Fix code analysis issues


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/33478d8c
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/33478d8c
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/33478d8c

Branch: refs/heads/master
Commit: 33478d8ccc72fade75ffcf0ff4f744bf3effca2d
Parents: 75b5523
Author: Christian Amend <ch...@sap.com>
Authored: Mon Aug 17 15:42:42 2015 +0200
Committer: Christian Amend <ch...@sap.com>
Committed: Mon Aug 17 15:42:42 2015 +0200

----------------------------------------------------------------------
 .../api/serializer/SerializerException.java     |   4 +-
 .../olingo/server/core/ODataDispatcher.java     |  53 ++++----
 .../server/core/ODataExceptionHelper.java       |   4 +
 .../apache/olingo/server/core/ODataHandler.java |   6 +-
 .../server/core/ODataHandlerException.java      |   5 +
 .../server/core/ODataHttpHandlerImpl.java       |   2 +-
 .../core/debug/DebugResponseHelperImpl.java     |  14 +-
 .../olingo/server/core/debug/DebugTab.java      |   6 +-
 .../olingo/server/core/debug/DebugTabBody.java  |   2 +-
 .../server/core/debug/DebugTabException.java    | 136 -------------------
 .../server/core/debug/DebugTabRequest.java      |  13 +-
 .../server/core/debug/DebugTabRuntime.java      |  10 +-
 .../server/core/debug/DebugTabStacktrace.java   | 136 +++++++++++++++++++
 .../core/debug/ExpressionJsonVisitor.java       | 136 ++++++++++++-------
 .../core/deserializer/batch/BatchPart.java      |   4 +-
 .../batch/BatchTransformatorCommon.java         |   6 +-
 .../json/ODataJsonDeserializer.java             |  43 +++---
 .../deserializer/xml/ODataXmlDeserializer.java  |  50 ++++---
 .../olingo/server/core/etag/ETagParser.java     |   4 +
 .../olingo/server/core/prefer/PreferParser.java |   4 +
 .../serializer/AbstractODataSerializer.java     |   2 +
 .../serializer/BatchResponseSerializer.java     |   2 +-
 .../serializer/FixedFormatSerializerImpl.java   |   7 +-
 .../serializer/json/ODataJsonSerializer.java    |  24 ++--
 .../serializer/utils/ContentTypeHelper.java     |   5 +
 .../xml/MetadataDocumentXmlSerializer.java      |  18 +--
 .../core/serializer/xml/ODataXmlSerializer.java |  45 +++---
 .../olingo/server/core/uri/UriHelperImpl.java   |   4 +-
 .../server-core-exceptions-i18n.properties      |   1 +
 29 files changed, 407 insertions(+), 339 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java
index 4e1a035..64eb5d2 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java
@@ -45,7 +45,9 @@ public class SerializerException extends ODataLibraryException {
     /** parameters: primitive-type name, value */
     WRONG_PRIMITIVE_VALUE,
     UNKNOWN_TYPE,
-    WRONG_BASE_TYPE;
+    WRONG_BASE_TYPE,
+    /** parameter: encoding-name */
+    UNSUPPORTED_ENCODING;
 
     @Override
     public String getKey() {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
index ff2b599..459c1ae 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
@@ -73,12 +73,11 @@ import org.apache.olingo.server.core.etag.PreconditionsValidator;
 
 public class ODataDispatcher {
 
-  private final HttpMethod method;
+  private static final String NOT_IMPLEMENTED_MESSAGE = "not implemented";
   private final UriInfo uriInfo;
   private final ODataHandler handler;
 
-  public ODataDispatcher(HttpMethod method, UriInfo uriInfo, ODataHandler handler) {
-    this.method = method;
+  public ODataDispatcher(UriInfo uriInfo, ODataHandler handler) {
     this.uriInfo = uriInfo;
     this.handler = handler;
   }
@@ -87,7 +86,7 @@ public class ODataDispatcher {
       ODataLibraryException {
     switch (uriInfo.getKind()) {
     case metadata:
-      checkMethod(method, HttpMethod.GET);
+      checkMethod(request.getMethod(), HttpMethod.GET);
       final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
           request, handler.getCustomContentTypeSupport(), RepresentationType.METADATA);
       handler.selectProcessor(MetadataProcessor.class)
@@ -95,7 +94,7 @@ public class ODataDispatcher {
       break;
 
     case service:
-      checkMethod(method, HttpMethod.GET);
+      checkMethod(request.getMethod(), HttpMethod.GET);
       if ("".equals(request.getRawODataPath())) {
         handler.selectProcessor(RedirectProcessor.class)
             .redirect(request, response);
@@ -112,13 +111,13 @@ public class ODataDispatcher {
       break;
 
     case batch:
-      checkMethod(method, HttpMethod.POST);
+      checkMethod(request.getMethod(), HttpMethod.POST);
       new BatchHandler(handler, handler.selectProcessor(BatchProcessor.class))
           .process(request, response, true);
       break;
 
     default:
-      throw new ODataHandlerException("not implemented",
+      throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
           ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
     }
   }
@@ -170,7 +169,7 @@ public class ODataDispatcher {
       break;
 
     default:
-      throw new ODataHandlerException("not implemented",
+      throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
           ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
     }
   }
@@ -195,7 +194,7 @@ public class ODataDispatcher {
       handleComplexDispatching(request, response, returnType.isCollection());
       break;
     default:
-      throw new ODataHandlerException("not implemented",
+      throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
           ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
     }
   }
@@ -258,7 +257,7 @@ public class ODataDispatcher {
         break;
 
       default:
-        throw new ODataHandlerException("not implemented",
+        throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
             ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
       }
     }
@@ -266,44 +265,48 @@ public class ODataDispatcher {
 
   private void handleReferenceDispatching(final ODataRequest request, final ODataResponse response,
       final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
-    final HttpMethod method = request.getMethod();
+    final HttpMethod httpMethod = request.getMethod();
     final boolean isCollection = ((UriResourcePartTyped) uriInfo.getUriResourceParts()
         .get(lastPathSegmentIndex - 1))
         .isCollection();
 
-    if (isCollection && method == HttpMethod.GET) {
+    if (isCollection && httpMethod == HttpMethod.GET) {
       final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
           request, handler.getCustomContentTypeSupport(), RepresentationType.COLLECTION_REFERENCE);
       handler.selectProcessor(ReferenceCollectionProcessor.class)
           .readReferenceCollection(request, response, uriInfo, responseFormat);
 
-    } else if (isCollection && method == HttpMethod.POST) {
+    } else if (isCollection && httpMethod == HttpMethod.POST) {
       final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
       checkContentTypeSupport(requestFormat, RepresentationType.REFERENCE);
       handler.selectProcessor(ReferenceProcessor.class)
           .createReference(request, response, uriInfo, requestFormat);
 
-    } else if (!isCollection && method == HttpMethod.GET) {
+    } else if (!isCollection && httpMethod == HttpMethod.GET) {
       final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
           request, handler.getCustomContentTypeSupport(), RepresentationType.REFERENCE);
       handler.selectProcessor(ReferenceProcessor.class).readReference(request, response, uriInfo, responseFormat);
 
-    } else if (!isCollection && (method == HttpMethod.PUT || method == HttpMethod.PATCH)) {
+    } else if (!isCollection && (httpMethod == HttpMethod.PUT || httpMethod == HttpMethod.PATCH)) {
       final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
       checkContentTypeSupport(requestFormat, RepresentationType.REFERENCE);
       handler.selectProcessor(ReferenceProcessor.class)
           .updateReference(request, response, uriInfo, requestFormat);
 
-    } else if (method == HttpMethod.DELETE) {
+    } else if (httpMethod == HttpMethod.DELETE) {
       handler.selectProcessor(ReferenceProcessor.class)
           .deleteReference(request, response, uriInfo);
 
     } else {
-      throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
-          ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
+      throw new ODataHandlerException(getMethodNotAllowedStringMessage(httpMethod),
+          ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, httpMethod.toString());
     }
   }
 
+  private String getMethodNotAllowedStringMessage(final HttpMethod httpMethod) {
+    return "HTTP method " + httpMethod + " is not allowed.";
+  }
+
   private void handleValueDispatching(final ODataRequest request, final ODataResponse response,
       final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
     final HttpMethod method = request.getMethod();
@@ -335,7 +338,7 @@ public class ODataDispatcher {
         handler.selectProcessor(PrimitiveValueProcessor.class)
             .deletePrimitiveValue(request, response, uriInfo);
       } else {
-        throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+        throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
             ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
       }
     } else {
@@ -356,7 +359,7 @@ public class ODataDispatcher {
         handler.selectProcessor(MediaEntityProcessor.class)
             .deleteMediaEntity(request, response, uriInfo);
       } else {
-        throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+        throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
             ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
       }
     }
@@ -400,7 +403,7 @@ public class ODataDispatcher {
             .deleteComplex(request, response, uriInfo);
       }
     } else {
-      throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+      throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
           ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
     }
   }
@@ -443,7 +446,7 @@ public class ODataDispatcher {
             .deletePrimitive(request, response, uriInfo);
       }
     } else {
-      throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+      throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
           ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
     }
   }
@@ -490,7 +493,7 @@ public class ODataDispatcher {
               .createEntity(request, response, uriInfo, requestFormat, responseFormat);
         }
       } else {
-        throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+        throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
             ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
       }
     } else {
@@ -512,7 +515,7 @@ public class ODataDispatcher {
         handler.selectProcessor(isMedia ? MediaEntityProcessor.class : EntityProcessor.class)
             .deleteEntity(request, response, uriInfo);
       } else {
-        throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+        throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
             ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
       }
     }
@@ -534,7 +537,7 @@ public class ODataDispatcher {
   private void checkMethod(final HttpMethod requestMethod, final HttpMethod allowedMethod)
       throws ODataHandlerException {
     if (requestMethod != allowedMethod) {
-      throw new ODataHandlerException("HTTP method " + requestMethod + " is not allowed.",
+      throw new ODataHandlerException(getMethodNotAllowedStringMessage(requestMethod),
           ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, requestMethod.toString());
     }
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
index 8c48d5f..830867b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
@@ -34,6 +34,10 @@ import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
 import org.apache.olingo.server.core.uri.validator.UriValidationException;
 
 public class ODataExceptionHelper {
+  
+  private ODataExceptionHelper() {
+    //Private Constructor
+  }
 
   public static ODataServerError createServerErrorObject(final UriValidationException e,
       final Locale requestedLocale) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
index 80d548a..5dedc11 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
@@ -132,7 +132,7 @@ public class ODataHandler {
     debugger.stopRuntimeMeasurement(measurementUriValidator);
 
     int measurementDispatcher = debugger.startRuntimeMeasurement("Dispatcher", "dispatch");
-    new ODataDispatcher(method, uriInfo, this).dispatch(request, response);
+    new ODataDispatcher(uriInfo, this).dispatch(request, response);
     debugger.stopRuntimeMeasurement(measurementDispatcher);
   }
 
@@ -162,11 +162,9 @@ public class ODataHandler {
   private void validateODataVersion(final ODataRequest request)
       throws ODataHandlerException {
     final String maxVersion = request.getHeader(HttpHeader.ODATA_MAX_VERSION);
-    if (maxVersion != null) {
-      if (ODataServiceVersion.isBiggerThan(ODataServiceVersion.V40.toString(), maxVersion)) {
+    if (maxVersion != null && ODataServiceVersion.isBiggerThan(ODataServiceVersion.V40.toString(), maxVersion)) {
         throw new ODataHandlerException("ODataVersion not supported: " + maxVersion,
             ODataHandlerException.MessageKeys.ODATA_VERSION_NOT_SUPPORTED, maxVersion);
-      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java
index 145bae9..62adf19 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java
@@ -51,6 +51,11 @@ public class ODataHandlerException extends ODataLibraryException {
     super(developmentMessage, messageKey, parameters);
   }
 
+  public ODataHandlerException(final String developmentMessage, final Throwable cause, final MessageKey messageKey,
+      final String... parameters) {
+    super(developmentMessage, cause, messageKey, parameters);
+  }
+  
   @Override
   protected String getBundleName() {
     return DEFAULT_SERVER_BUNDLE_NAME;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/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 59fa697..5170185 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
@@ -229,7 +229,7 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler {
         return httpRequestMethod;
       }
     } catch (IllegalArgumentException e) {
-      throw new ODataHandlerException("Invalid HTTP method" + httpRequest.getMethod(),
+      throw new ODataHandlerException("Invalid HTTP method" + httpRequest.getMethod(), e,
           ODataHandlerException.MessageKeys.INVALID_HTTP_METHOD, httpRequest.getMethod());
     }
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java
index aec8858..f81a256 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java
@@ -29,6 +29,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.apache.olingo.commons.api.ODataRuntimeException;
 import org.apache.olingo.commons.api.format.ContentType;
@@ -127,7 +128,7 @@ public class DebugResponseHelperImpl implements DebugResponseHelper {
 
     // exceptions
     if (debugInfo.getException() != null) {
-      parts.add(new DebugTabException(debugInfo.getException()));
+      parts.add(new DebugTabStacktrace(debugInfo.getException()));
     }
 
     return parts;
@@ -165,8 +166,6 @@ public class DebugResponseHelperImpl implements DebugResponseHelper {
       outputStream.close();
 
       return csb.getInputStream();
-    } catch (IOException e) {
-      throw e;
     } finally {
       if (outputStream != null) {
         try {
@@ -284,12 +283,11 @@ public class DebugResponseHelperImpl implements DebugResponseHelper {
     writer.append("<table>\n<thead>\n")
         .append("<tr><th class=\"name\">Name</th><th class=\"value\">Value</th></tr>\n")
         .append("</thead>\n<tbody>\n");
-    for (final String name : entries.keySet()) {
-      final String value = entries.get(name);
-      writer.append("<tr><td class=\"name\">").append(name).append("</td>")
+    for (final Entry<String, String> entry : entries.entrySet()) {
+      writer.append("<tr><td class=\"name\">").append(entry.getKey()).append("</td>")
           .append("<td class=\"value\">");
-      if (value != null) {
-        writer.append(escapeHtml(value));
+      if (entry.getValue() != null) {
+        writer.append(escapeHtml(entry.getValue()));
       } else {
         writer.append("null");
       }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTab.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTab.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTab.java
index 8847e33..76384b0 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTab.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTab.java
@@ -33,18 +33,18 @@ public interface DebugTab {
    * Gets the name of this debug information part, useful as title.
    * @return the name
    */
-  public String getName();
+  String getName();
 
   /**
    * Appends the content of this debug information part
    * to the given JSON stream writer.
    * @param jsonGenerator a JSON generator
    */
-  public void appendJson(JsonGenerator jsonGenerator) throws IOException;
+  void appendJson(JsonGenerator jsonGenerator) throws IOException;
 
   /**
    * Appends the content of this debug information part to the given writer.
    * @param writer a {@link Writer}
    */
-  public void appendHtml(Writer writer) throws IOException;
+  void appendHtml(Writer writer) throws IOException;
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabBody.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabBody.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabBody.java
index 317f376..ab489b0 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabBody.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabBody.java
@@ -87,7 +87,7 @@ public class DebugTabBody implements DebugTab {
       String contentString;
       switch (responseContent) {
       case IMAGE:
-        contentString = Base64.encodeBase64String(IOUtils.toString(response.getContent()).getBytes());
+        contentString = Base64.encodeBase64String(IOUtils.toString(response.getContent()).getBytes("UTF-8"));
         break;
       case JSON:
       case XML:

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabException.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabException.java
deleted file mode 100644
index 6bc69e4..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabException.java
+++ /dev/null
@@ -1,136 +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.olingo.server.core.debug;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.apache.olingo.server.api.ODataLibraryException;
-import org.apache.olingo.server.api.ODataLibraryException.ODataErrorMessage;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-
-/**
- * Exception debug information.
- */
-public class DebugTabException implements DebugTab {
-
-  private final Exception exception;
-
-  public DebugTabException(final Exception exception) {
-    this.exception = exception;
-  }
-
-  @Override
-  public String getName() {
-    return "Stacktrace";
-  }
-
-  @Override
-  public void appendJson(final JsonGenerator gen) throws IOException {
-    gen.writeStartObject();
-    gen.writeFieldName("exceptions");
-    gen.writeStartArray();
-    Throwable throwable = exception;
-    while (throwable != null) {
-      gen.writeStartObject();
-      gen.writeStringField("class", throwable.getClass().getCanonicalName());
-      gen.writeStringField("message", getMessageText(throwable));
-      gen.writeFieldName("invocation");
-      appendJsonStackTraceElement(gen, throwable.getStackTrace()[0]);
-      gen.writeEndObject();
-
-      // Get next exception in the cause list
-      throwable = throwable.getCause();
-    }
-    gen.writeEndArray();
-
-    gen.writeFieldName("stacktrace");
-    gen.writeStartArray();
-    for (final StackTraceElement stackTraceElement : exception.getStackTrace()) {
-      appendJsonStackTraceElement(gen, stackTraceElement);
-    }
-    gen.writeEndArray();
-
-    gen.writeEndObject();
-  }
-
-  private String getMessageText(final Throwable throwable) {
-    String message;
-    if (throwable instanceof ODataLibraryException) {
-      ODataLibraryException ex = (ODataLibraryException) throwable;
-      // We use the default locale
-      ODataErrorMessage translatedMessage = ex.getTranslatedMessage(null);
-      // We provide the best message we can
-      message = translatedMessage.getMessage() == null ? ex.getMessage() : translatedMessage.getMessage();
-    } else {
-      message = throwable.getMessage();
-    }
-    return message;
-  }
-
-  private void appendJsonStackTraceElement(final JsonGenerator gen, final StackTraceElement element)
-      throws IOException {
-    gen.writeStartObject();
-    gen.writeStringField("class", element.getClassName());
-    gen.writeStringField("method", element.getMethodName());
-    gen.writeStringField("line", Integer.toString(element.getLineNumber()));
-    gen.writeEndObject();
-  }
-
-  @Override
-  public void appendHtml(final Writer writer) throws IOException {
-    appendException(exception, writer);
-    writer.append("<h2>Stacktrace</h2>\n");
-    int count = 0;
-    for (final StackTraceElement stackTraceElement : exception.getStackTrace()) {
-      appendStackTraceElement(stackTraceElement, ++count == 1, count == exception.getStackTrace().length, writer);
-    }
-  }
-
-  private void appendException(final Throwable throwable, final Writer writer) throws IOException {
-    if (throwable.getCause() != null) {
-      appendException(throwable.getCause(), writer);
-    }
-    final StackTraceElement details = throwable.getStackTrace()[0];
-    writer.append("<h2>").append(throwable.getClass().getCanonicalName()).append("</h2>\n")
-        .append("<p>")
-        .append(DebugResponseHelperImpl.escapeHtml(getMessageText(throwable)))
-        .append("</p>\n");
-    appendStackTraceElement(details, true, true, writer);
-  }
-
-  private void appendStackTraceElement(final StackTraceElement stackTraceElement,
-      final boolean isFirst, final boolean isLast, final Writer writer) throws IOException {
-    if (isFirst) {
-      writer.append("<table>\n<thead>\n")
-          .append("<tr>\n<th class=\"name\">Class</th>\n")
-          .append("<th class=\"name\">Method</th>\n")
-          .append("<th class=\"value\">Line number in class</th>\n</tr>\n")
-          .append("</thead>\n<tbody>\n");
-    }
-    writer.append("<tr>\n<td class=\"name\">").append(stackTraceElement.getClassName()).append("</td>\n")
-        .append("<td class=\"name\">").append(stackTraceElement.getMethodName()).append("</td>\n")
-        .append("<td class=\"value\">").append(Integer.toString(stackTraceElement.getLineNumber()))
-        .append("</td>\n</tr>\n");
-    if (isLast) {
-      writer.append("</tbody>\n</table>\n");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRequest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRequest.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRequest.java
index be38f68..4f9bc5c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRequest.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRequest.java
@@ -33,6 +33,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
  */
 public class DebugTabRequest implements DebugTab {
 
+  private static final String UNKOWN_MSG = "unkown";
   private final String method;
   private final String uri;
   private final String protocol;
@@ -40,14 +41,14 @@ public class DebugTabRequest implements DebugTab {
 
   public DebugTabRequest(ODataRequest request) {
     if (request != null) {
-      method = request.getMethod() == null ? "unkown" : request.getMethod().toString();
-      uri = request.getRawRequestUri() == null ? "unkown" : request.getRawRequestUri();
-      protocol = request.getProtocol() == null ? "unkown" : request.getProtocol();
+      method = request.getMethod() == null ? UNKOWN_MSG : request.getMethod().toString();
+      uri = request.getRawRequestUri() == null ? UNKOWN_MSG : request.getRawRequestUri();
+      protocol = request.getProtocol() == null ? UNKOWN_MSG : request.getProtocol();
       headers = request.getAllHeaders();
     } else {
-      method = "unkown";
-      uri = "unkown";
-      protocol = "unkown";
+      method = UNKOWN_MSG;
+      uri = UNKOWN_MSG;
+      protocol = UNKOWN_MSG;
       headers = Collections.emptyMap();
     }
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRuntime.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRuntime.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRuntime.java
index 312b4cd..c765790 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRuntime.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRuntime.java
@@ -119,11 +119,11 @@ public class DebugTabRuntime implements DebugTab {
 
   private class RuntimeNode {
 
-    protected String className;
-    protected String methodName;
-    protected long timeStarted;
-    protected long timeStopped;
-    protected List<RuntimeNode> children = new ArrayList<RuntimeNode>();
+    private String className;
+    private String methodName;
+    private long timeStarted;
+    private long timeStopped;
+    private List<RuntimeNode> children = new ArrayList<RuntimeNode>();
 
     protected RuntimeNode() {
       timeStarted = 0;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabStacktrace.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..0d79e85
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabStacktrace.java
@@ -0,0 +1,136 @@
+/*
+ * 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.olingo.server.core.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.olingo.server.api.ODataLibraryException;
+import org.apache.olingo.server.api.ODataLibraryException.ODataErrorMessage;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+/**
+ * Exception debug information.
+ */
+public class DebugTabStacktrace implements DebugTab {
+
+  private final Exception exception;
+
+  public DebugTabStacktrace(final Exception exception) {
+    this.exception = exception;
+  }
+
+  @Override
+  public String getName() {
+    return "Stacktrace";
+  }
+
+  @Override
+  public void appendJson(final JsonGenerator gen) throws IOException {
+    gen.writeStartObject();
+    gen.writeFieldName("exceptions");
+    gen.writeStartArray();
+    Throwable throwable = exception;
+    while (throwable != null) {
+      gen.writeStartObject();
+      gen.writeStringField("class", throwable.getClass().getCanonicalName());
+      gen.writeStringField("message", getMessageText(throwable));
+      gen.writeFieldName("invocation");
+      appendJsonStackTraceElement(gen, throwable.getStackTrace()[0]);
+      gen.writeEndObject();
+
+      // Get next exception in the cause list
+      throwable = throwable.getCause();
+    }
+    gen.writeEndArray();
+
+    gen.writeFieldName("stacktrace");
+    gen.writeStartArray();
+    for (final StackTraceElement stackTraceElement : exception.getStackTrace()) {
+      appendJsonStackTraceElement(gen, stackTraceElement);
+    }
+    gen.writeEndArray();
+
+    gen.writeEndObject();
+  }
+
+  private String getMessageText(final Throwable throwable) {
+    String message;
+    if (throwable instanceof ODataLibraryException) {
+      ODataLibraryException ex = (ODataLibraryException) throwable;
+      // We use the default locale
+      ODataErrorMessage translatedMessage = ex.getTranslatedMessage(null);
+      // We provide the best message we can
+      message = translatedMessage.getMessage() == null ? ex.getMessage() : translatedMessage.getMessage();
+    } else {
+      message = throwable.getMessage();
+    }
+    return message;
+  }
+
+  private void appendJsonStackTraceElement(final JsonGenerator gen, final StackTraceElement element)
+      throws IOException {
+    gen.writeStartObject();
+    gen.writeStringField("class", element.getClassName());
+    gen.writeStringField("method", element.getMethodName());
+    gen.writeStringField("line", Integer.toString(element.getLineNumber()));
+    gen.writeEndObject();
+  }
+
+  @Override
+  public void appendHtml(final Writer writer) throws IOException {
+    appendException(exception, writer);
+    writer.append("<h2>Stacktrace</h2>\n");
+    int count = 0;
+    for (final StackTraceElement stackTraceElement : exception.getStackTrace()) {
+      appendStackTraceElement(stackTraceElement, ++count == 1, count == exception.getStackTrace().length, writer);
+    }
+  }
+
+  private void appendException(final Throwable throwable, final Writer writer) throws IOException {
+    if (throwable.getCause() != null) {
+      appendException(throwable.getCause(), writer);
+    }
+    final StackTraceElement details = throwable.getStackTrace()[0];
+    writer.append("<h2>").append(throwable.getClass().getCanonicalName()).append("</h2>\n")
+        .append("<p>")
+        .append(DebugResponseHelperImpl.escapeHtml(getMessageText(throwable)))
+        .append("</p>\n");
+    appendStackTraceElement(details, true, true, writer);
+  }
+
+  private void appendStackTraceElement(final StackTraceElement stackTraceElement,
+      final boolean isFirst, final boolean isLast, final Writer writer) throws IOException {
+    if (isFirst) {
+      writer.append("<table>\n<thead>\n")
+          .append("<tr>\n<th class=\"name\">Class</th>\n")
+          .append("<th class=\"name\">Method</th>\n")
+          .append("<th class=\"value\">Line number in class</th>\n</tr>\n")
+          .append("</thead>\n<tbody>\n");
+    }
+    writer.append("<tr>\n<td class=\"name\">").append(stackTraceElement.getClassName()).append("</td>\n")
+        .append("<td class=\"name\">").append(stackTraceElement.getMethodName()).append("</td>\n")
+        .append("<td class=\"value\">").append(Integer.toString(stackTraceElement.getLineNumber()))
+        .append("</td>\n</tr>\n");
+    if (isLast) {
+      writer.append("</tbody>\n</table>\n");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java
index 773ea48..5e130e9 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java
@@ -43,19 +43,49 @@ import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind
  */
 public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
 
+  private static final String ANY_NAME = "ANY";
+  private static final String ALL_NAME = "ALL";
+  private static final String STRING_NAME = "String";
+  private static final String UNKNOWN_NAME = "unknown";
+  private static final String BOOLEAN_NAME = "Boolean";
+  private static final String NUMBER_NAME = "Number";
+  private static final String ENUM_NAME = "enum";
+  private static final String VALUES_NAME = "values";
+  private static final String NAME_NAME = "name";
+  private static final String LAMBDA_REFERENCE_NAME = "lambdaReference";
+  private static final String ALIAS_NAME = "alias";
+  private static final String RESOURCE_SEGMENTS_NAME = "resourceSegments";
+  private static final String MEMBER_NAME = "member";
+  private static final String VALUE_NAME = "value";
+  private static final String LITERAL_NAME = "literal";
+  private static final String EXPRESSION_NAME = "expression";
+  private static final String LAMBDA_VARIABLE_NAME = "lambdaVariable";
+  private static final String LAMBDA_FUNCTION_NAME = "lambdaFunction";
+  private static final String UNARY_NAME = "unary";
+  private static final String BINARY_NAME = "binary";
+  private static final String LEFT_NODE_NAME = "left";
+  private static final String RIGHT_NODE_NAME = "right";
+  private static final String IO_EXCEPTION_OCCOURED_MESSAGE = "IOException occoured";
+  private static final String PARAMETERS_NAME = "parameters";
+  private static final String METHOD_NAME = "method";
+  private static final String OPERAND_NAME = "operand";
+  private static final String TYPE_NAME = "type";
+  private static final String OPERATOR_NAME = "operator";
+  private static final String NODE_TYPE_NAME = "nodeType";
+
   @Override
   public String visitBinaryOperator(BinaryOperatorKind operator, String left, String right)
       throws ExpressionVisitException, ODataApplicationException {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject().namedStringValue("nodeType", "binary").separator().namedStringValue("operator",
-          operator.toString()).separator().namedStringValueRaw("type", getType(operator)).separator().name("left")
-          .unquotedValue(left).separator().name("right").unquotedValue(right).endObject();
+      jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, BINARY_NAME).separator().namedStringValue(
+          OPERATOR_NAME, operator.toString()).separator().namedStringValueRaw(TYPE_NAME, getType(operator)).separator()
+          .name(LEFT_NODE_NAME).unquotedValue(left).separator().name(RIGHT_NODE_NAME).unquotedValue(right).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured", e);
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE, e);
     }
   }
 
@@ -65,13 +95,13 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject().namedStringValue("nodeType", "unary").separator()
-          .namedStringValueRaw("operator", operator.toString()).separator().namedStringValueRaw("type",
-              getType(operator)).separator().name("operand").unquotedValue(operand).endObject();
+      jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, UNARY_NAME).separator()
+          .namedStringValueRaw(OPERATOR_NAME, operator.toString()).separator().namedStringValueRaw(TYPE_NAME,
+              getType(operator)).separator().name(OPERAND_NAME).unquotedValue(operand).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured", e);
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE, e);
     }
   }
 
@@ -81,9 +111,9 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", "method").separator()
-          .namedStringValueRaw("operator", methodCall.toString()).separator().namedStringValueRaw("type",
-              getType(methodCall)).separator().name("parameters").beginArray();
+      jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, METHOD_NAME).separator()
+          .namedStringValueRaw(OPERATOR_NAME, methodCall.toString()).separator().namedStringValueRaw(TYPE_NAME,
+              getType(methodCall)).separator().name(PARAMETERS_NAME).beginArray();
       boolean first = true;
       for (String parameter : parameters) {
         if (first) {
@@ -97,7 +127,7 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured", e);
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE, e);
     }
   }
 
@@ -107,8 +137,8 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject().namedStringValue("nodeType", "lambdaFunction").separator()
-          .namedStringValue("lambdaVariable", lambdaVariable).separator().name("expression");
+      jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, LAMBDA_FUNCTION_NAME).separator()
+          .namedStringValue(LAMBDA_VARIABLE_NAME, lambdaVariable).separator().name(EXPRESSION_NAME);
 
       // Write expression string object
       String expressionJsonTree = expression.accept(this);
@@ -116,7 +146,7 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured", e);
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE, e);
     }
   }
 
@@ -125,12 +155,13 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", "literal").separator().namedStringValueRaw("type",
-          getTypeString(literal.getType())).separator().namedStringValue("value", literal.getText()).endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, LITERAL_NAME).separator().namedStringValueRaw(
+          TYPE_NAME, getTypeString(literal.getType())).separator().namedStringValue(VALUE_NAME, literal.getText())
+          .endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured");
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE);
     }
   }
 
@@ -140,11 +171,11 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
       List<UriResource> uriResourceParts = member.getUriResourceParts();
-      jsonStreamWriter.beginObject().namedStringValue("nodeType", "member").separator()
-          .namedStringValueRaw("type", getType(uriResourceParts)).separator();
+      jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, MEMBER_NAME).separator()
+          .namedStringValueRaw(TYPE_NAME, getType(uriResourceParts)).separator();
 
       // write all member properties in an array
-      jsonStreamWriter.name("resourceSegments").beginArray();
+      jsonStreamWriter.name(RESOURCE_SEGMENTS_NAME).beginArray();
       if (uriResourceParts != null) {
         boolean first = true;
         for (UriResource segment : uriResourceParts) {
@@ -162,7 +193,7 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured", e);
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE, e);
     }
   }
 
@@ -171,12 +202,12 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", "alias").separator()
-          .namedStringValue("alias", aliasName).endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, ALIAS_NAME).separator()
+          .namedStringValue(ALIAS_NAME, aliasName).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured", e);
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE, e);
     }
   }
 
@@ -185,12 +216,12 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", "type").separator()
-          .namedStringValueRaw("type", getTypeString(type)).endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, TYPE_NAME).separator()
+          .namedStringValueRaw(TYPE_NAME, getTypeString(type)).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured", e);
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE, e);
     }
   }
 
@@ -199,12 +230,12 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", "lambdaReference").separator()
-          .namedStringValueRaw("name", variableName).endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, LAMBDA_REFERENCE_NAME).separator()
+          .namedStringValueRaw(NAME_NAME, variableName).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured", e);
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE, e);
     }
   }
 
@@ -214,9 +245,9 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", "enum").separator()
-          .namedStringValueRaw("type", getTypeString(type)).separator();
-      jsonStreamWriter.name("values").beginArray();
+      jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, ENUM_NAME).separator()
+          .namedStringValueRaw(TYPE_NAME, getTypeString(type)).separator();
+      jsonStreamWriter.name(VALUES_NAME).beginArray();
       if (enumValues != null) {
         boolean first = true;
         for (String value : enumValues) {
@@ -234,18 +265,18 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
-      throw new ExpressionVisitException("IOException occoured", e);
+      throw new ExpressionVisitException(IO_EXCEPTION_OCCOURED_MESSAGE, e);
     }
   }
 
   private String getType(UnaryOperatorKind operator) {
     switch (operator) {
     case MINUS:
-      return "Number";
+      return NUMBER_NAME;
     case NOT:
-      return "Boolean";
+      return BOOLEAN_NAME;
     default:
-      return "unknown";
+      return UNKNOWN_NAME;
     }
   }
 
@@ -255,7 +286,7 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     case CONTAINS:
     case ENDSWITH:
     case ISOF:
-      return "Boolean";
+      return BOOLEAN_NAME;
     case INDEXOF:
     case LENGTH:
     case ROUND:
@@ -267,7 +298,7 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     case MONTH:
     case SECOND:
     case FRACTIONALSECONDS:
-      return "Number";
+      return NUMBER_NAME;
     case CAST:
     case CONCAT:
     case DATE:
@@ -285,9 +316,9 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     case TOUPPER:
     case TRIM:
     case YEAR:
-      return "String";
+      return STRING_NAME;
     default:
-      return "unkown";
+      return UNKNOWN_NAME;
     }
   }
 
@@ -295,22 +326,23 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
       ExpressionVisitException, ODataApplicationException {
     if (segment instanceof UriResourceLambdaAll) {
       UriResourceLambdaAll all = (UriResourceLambdaAll) segment;
-      String lambdaJsonObjectString = visitLambdaExpression("ALL", all.getLambdaVariable(), all.getExpression());
+      String lambdaJsonObjectString = visitLambdaExpression(ALL_NAME, all.getLambdaVariable(), all.getExpression());
       jsonStreamWriter.unquotedValue(lambdaJsonObjectString);
       return;
     } else if (segment instanceof UriResourceLambdaAny) {
       UriResourceLambdaAny any = (UriResourceLambdaAny) segment;
-      String lambdaJsonObjectString = visitLambdaExpression("ANY", any.getLambdaVariable(), any.getExpression());
+      String lambdaJsonObjectString = visitLambdaExpression(ANY_NAME, any.getLambdaVariable(), any.getExpression());
       jsonStreamWriter.unquotedValue(lambdaJsonObjectString);
       return;
     } else if (segment instanceof UriResourcePartTyped) {
       String typeName =
           ((UriResourcePartTyped) segment).getType().getFullQualifiedName().getFullQualifiedNameAsString();
-      jsonStreamWriter.beginObject().namedStringValue("nodeType", segment.getKind().toString()).separator()
-          .namedStringValue("name", segment.toString()).separator().namedStringValueRaw("type", typeName).endObject();
+      jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, segment.getKind().toString()).separator()
+          .namedStringValue(NAME_NAME, segment.toString()).separator().namedStringValueRaw(TYPE_NAME, typeName)
+          .endObject();
     } else {
-      jsonStreamWriter.beginObject().namedStringValue("nodeType", segment.getKind().toString()).separator()
-          .namedStringValue("name", segment.toString()).separator().namedStringValueRaw("type", null).endObject();
+      jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, segment.getKind().toString()).separator()
+          .namedStringValue(NAME_NAME, segment.toString()).separator().namedStringValueRaw(TYPE_NAME, null).endObject();
     }
   }
 
@@ -321,7 +353,7 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     case MOD:
     case ADD:
     case SUB:
-      return "Number";
+      return NUMBER_NAME;
 
     case HAS:
     case GT:
@@ -332,10 +364,10 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     case NE:
     case AND:
     case OR:
-      return "Boolean";
+      return BOOLEAN_NAME;
 
     default:
-      return "unkown";
+      return UNKNOWN_NAME;
     }
   }
 
@@ -355,7 +387,7 @@ public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
     if (lastSegment instanceof UriResourcePartTyped) {
       type = ((UriResourcePartTyped) lastSegment).getType();
     }
-    return type == null ? "unknown" : type.getFullQualifiedName().getFullQualifiedNameAsString();
+    return type == null ? UNKNOWN_NAME : type.getFullQualifiedName().getFullQualifiedNameAsString();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java
index 9ee642d..13986c4 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java
@@ -19,7 +19,7 @@
 package org.apache.olingo.server.core.deserializer.batch;
 
 public interface BatchPart {
-  public Header getHeaders();
+  Header getHeaders();
 
-  public boolean isStrict();
+  boolean isStrict();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
index 5757643..1543c43 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
@@ -26,6 +26,10 @@ import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerExceptio
 import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException.MessageKeys;
 
 public class BatchTransformatorCommon {
+  
+  private BatchTransformatorCommon() {
+    //Private Utility Constructor
+  }
 
   public static void validateContentType(final Header headers, final ContentType expected)
       throws BatchDeserializerException {
@@ -78,7 +82,7 @@ public class BatchTransformatorCommon {
 
         return contentLength;
       } catch (NumberFormatException e) {
-        throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER,
+        throw new BatchDeserializerException("Invalid header", e, MessageKeys.INVALID_HEADER,
             Integer.toString(contentLengthField.getLineNumber()));
       }
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
index abcb958..759cf66 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
@@ -72,6 +72,9 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 
 public class ODataJsonDeserializer implements ODataDeserializer {
 
+  private static final String AN_IO_EXCEPTION_OCCURRED_MSG = "An IOException occurred";
+  private static final String DUPLICATE_JSON_PROPERTY_DETECTED_MSG = "Duplicate json property detected";
+  private static final String AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG = "An JsonParseException occurred";
   private static final String ODATA_ANNOTATION_MARKER = "@";
   private static final String ODATA_CONTROL_INFORMATION_PREFIX = "@odata.";
   private static final EdmPrimitiveType EDM_INT64 = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64);
@@ -91,13 +94,13 @@ public class ODataJsonDeserializer implements ODataDeserializer {
       return DeserializerResultImpl.with().entityCollection(consumeEntitySetNode(edmEntityType, tree, null))
           .build();
     } catch (JsonParseException e) {
-      throw new DeserializerException("An JsonParseException occurred", e,
+      throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
           DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
     } catch (JsonMappingException e) {
-      throw new DeserializerException("Duplicate json property detected", e,
+      throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
           DeserializerException.MessageKeys.DUPLICATE_JSON_PROPERTY);
     } catch (IOException e) {
-      throw new DeserializerException("An IOException occurred", e, DeserializerException.MessageKeys.IO_EXCEPTION);
+      throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e, DeserializerException.MessageKeys.IO_EXCEPTION);
     }
   }
 
@@ -166,13 +169,13 @@ public class ODataJsonDeserializer implements ODataDeserializer {
           .build();
 
     } catch (JsonParseException e) {
-      throw new DeserializerException("An JsonParseException occurred", e,
+      throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
           DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
     } catch (JsonMappingException e) {
-      throw new DeserializerException("Duplicate property detected", e,
+      throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
           DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
     } catch (IOException e) {
-      throw new DeserializerException("An IOException occurred", e, DeserializerException.MessageKeys.IO_EXCEPTION);
+      throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e, DeserializerException.MessageKeys.IO_EXCEPTION);
     }
 
   }
@@ -225,13 +228,13 @@ public class ODataJsonDeserializer implements ODataDeserializer {
       return DeserializerResultImpl.with().build();
 
     } catch (final JsonParseException e) {
-      throw new DeserializerException("An JsonParseException occurred", e,
+      throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
           DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
     } catch (final JsonMappingException e) {
-      throw new DeserializerException("Duplicate property detected", e,
+      throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
           DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
     } catch (final IOException e) {
-      throw new DeserializerException("An IOException occurred", e,
+      throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e,
           DeserializerException.MessageKeys.IO_EXCEPTION);
     }
   }
@@ -695,11 +698,11 @@ public class ODataJsonDeserializer implements ODataDeserializer {
       Class<?> javaClass = getJavaClassForPrimitiveType(mapping, edmPrimitiveType);
       String jsonNodeAsText = jsonNode.asText();
 
-      if (isIEEE754Compatible && (edmPrimitiveType.equals(EDM_INT64) || edmPrimitiveType.equals(EDM_DECIMAL))) {
-        if (jsonNodeAsText.length() == 0) {
-          throw new DeserializerException("IEEE754Compatible values must not be of length 0",
-              MessageKeys.INVALID_NULL_PROPERTY, name);
-        }
+      if (isIEEE754Compatible
+          && (edmPrimitiveType.equals(EDM_INT64) || edmPrimitiveType.equals(EDM_DECIMAL))
+              && jsonNodeAsText.length() == 0) {
+        throw new DeserializerException("IEEE754Compatible values must not be of length 0",
+            MessageKeys.INVALID_NULL_PROPERTY, name);
       }
 
       return edmPrimitiveType.valueOfString(jsonNodeAsText, isNullable, maxLength, precision, scale, isUnicode,
@@ -865,13 +868,13 @@ public class ODataJsonDeserializer implements ODataDeserializer {
       }
       return DeserializerResultImpl.with().property(property).build();
     } catch (JsonParseException e) {
-      throw new DeserializerException("An JsonParseException occurred", e,
+      throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
           DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
     } catch (JsonMappingException e) {
-      throw new DeserializerException("Duplicate property detected", e,
+      throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
           DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
     } catch (IOException e) {
-      throw new DeserializerException("An IOException occurred", e, DeserializerException.MessageKeys.IO_EXCEPTION);
+      throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e, DeserializerException.MessageKeys.IO_EXCEPTION);
     }
   }
 
@@ -908,13 +911,13 @@ public class ODataJsonDeserializer implements ODataDeserializer {
       }
       return DeserializerResultImpl.with().entityReferences(parsedValues).build();
     } catch (JsonParseException e) {
-      throw new DeserializerException("An JsonParseException occurred", e,
+      throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
           DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
     } catch (JsonMappingException e) {
-      throw new DeserializerException("Duplicate property detected", e,
+      throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
           DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
     } catch (IOException e) {
-      throw new DeserializerException("An IOException occurred", e,
+      throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e,
           DeserializerException.MessageKeys.IO_EXCEPTION);
     } catch (URISyntaxException e) {
       throw new DeserializerException("failed to read @odata.id", e,

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
index c130ebb..efbad95 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
@@ -24,12 +24,10 @@ import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
 import javax.xml.stream.events.Attribute;
 import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
@@ -66,30 +64,30 @@ import com.fasterxml.aalto.stax.InputFactoryImpl;
 
 public class ODataXmlDeserializer implements ODataDeserializer {
 
-  protected static final XMLInputFactory FACTORY = new InputFactoryImpl();
+  private static final XMLInputFactory FACTORY = new InputFactoryImpl();
   private static final String ATOM = "a";
   private static final String NS_ATOM = "http://www.w3.org/2005/Atom";  
-  protected QName REF_ELEMENT = new QName("http://docs.oasis-open.org/odata/ns/metadata", "ref");
-  protected QName FEED_ELEMENT = new QName("http://www.w3.org/2005/Atom", "feed");
-  protected QName ID_ATTR = new QName(NS_ATOM, ATOM);
-
-  protected final QName propertiesQName = new QName(Constants.NS_METADATA, Constants.PROPERTIES);
-  protected final QName propertyValueQName = new QName(Constants.NS_METADATA, Constants.VALUE);
-  protected final QName contextQName = new QName(Constants.NS_METADATA, Constants.CONTEXT);
-  protected final QName nullQName = new QName(Constants.NS_METADATA, Constants.ATTR_NULL);
-  protected final QName inlineQName = new QName(Constants.NS_METADATA, Constants.ATOM_ELEM_INLINE);
-  protected final QName entryRefQName = new QName(Constants.NS_METADATA, Constants.ATOM_ELEM_ENTRY_REF);
-  protected final QName etagQName = new QName(Constants.NS_METADATA, Constants.ATOM_ATTR_ETAG); 
-  protected final QName countQName = new QName(Constants.NS_METADATA, Constants.ATOM_ELEM_COUNT);
+  private static final QName REF_ELEMENT = new QName("http://docs.oasis-open.org/odata/ns/metadata", "ref");
+//  private static final QName FEED_ELEMENT = new QName("http://www.w3.org/2005/Atom", "feed");
+  private static final QName ID_ATTR = new QName(NS_ATOM, ATOM);
+
+  private final QName propertiesQName = new QName(Constants.NS_METADATA, Constants.PROPERTIES);
+  private final QName propertyValueQName = new QName(Constants.NS_METADATA, Constants.VALUE);
+  private final QName contextQName = new QName(Constants.NS_METADATA, Constants.CONTEXT);
+  private final QName nullQName = new QName(Constants.NS_METADATA, Constants.ATTR_NULL);
+  private final QName inlineQName = new QName(Constants.NS_METADATA, Constants.ATOM_ELEM_INLINE);
+  private final QName entryRefQName = new QName(Constants.NS_METADATA, Constants.ATOM_ELEM_ENTRY_REF);
+  private final QName etagQName = new QName(Constants.NS_METADATA, Constants.ATOM_ATTR_ETAG); 
+  private final QName countQName = new QName(Constants.NS_METADATA, Constants.ATOM_ELEM_COUNT);
   
-  protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
-    writer.writeNamespace(StringUtils.EMPTY, Constants.NS_ATOM);
-    writer.writeNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
-    writer.writeNamespace(Constants.PREFIX_METADATA, Constants.NS_METADATA);
-    writer.writeNamespace(Constants.PREFIX_DATASERVICES, Constants.NS_DATASERVICES);
-    writer.writeNamespace(Constants.PREFIX_GML, Constants.NS_GML);
-    writer.writeNamespace(Constants.PREFIX_GEORSS, Constants.NS_GEORSS);
-  }
+//  private void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
+//    writer.writeNamespace(StringUtils.EMPTY, Constants.NS_ATOM);
+//    writer.writeNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
+//    writer.writeNamespace(Constants.PREFIX_METADATA, Constants.NS_METADATA);
+//    writer.writeNamespace(Constants.PREFIX_DATASERVICES, Constants.NS_DATASERVICES);
+//    writer.writeNamespace(Constants.PREFIX_GML, Constants.NS_GML);
+//    writer.writeNamespace(Constants.PREFIX_GEORSS, Constants.NS_GEORSS);
+//  }
   
   protected XMLEventReader getReader(final InputStream input) throws XMLStreamException {
     return FACTORY.createXMLEventReader(input);
@@ -373,10 +371,8 @@ public class ODataXmlDeserializer implements ODataDeserializer {
     while (reader.hasNext() && !foundEndElement) {
       final XMLEvent event = reader.nextEvent();
       
-      if (event.isStartElement()) {
-        if (REF_ELEMENT.equals(event.asStartElement().getName())) {
+      if (event.isStartElement() && REF_ELEMENT.equals(event.asStartElement().getName())) {
           references.add(entityRef(reader, event.asStartElement()));
-        }
       }
       
       if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
@@ -689,7 +685,7 @@ public class ODataXmlDeserializer implements ODataDeserializer {
       }
       return DeserializerResultImpl.with().entityReferences(references).build();
     } catch (XMLStreamException e) {
-      throw new DeserializerException("An IOException occurred", e.getCause(),
+      throw new DeserializerException("An IOException occurred", e,
           DeserializerException.MessageKeys.IO_EXCEPTION);
     }
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/ETagParser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/ETagParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/ETagParser.java
index b8534dd..805a29c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/ETagParser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/ETagParser.java
@@ -43,6 +43,10 @@ import java.util.regex.Pattern;
 public class ETagParser {
 
   private static final Pattern ETAG = Pattern.compile("\\s*(,\\s*)+|((?:W/)?\"[!#-~\\x80-\\xFF]*\")");
+  
+  private ETagParser (){
+    //Private constructor for utility classes
+  }
 
   protected static Collection<String> parse(final Collection<String> values) {
     if (values == null) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferParser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferParser.java
index f963703..eee7959 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferParser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferParser.java
@@ -58,6 +58,10 @@ public class PreferParser {
   private static final Pattern PREFERENCE = Pattern.compile("\\s*(,\\s*)+|"
       + "(?:" + namedValue + "((?:\\s*;\\s*(?:" + namedValue + ")?)*))");
   private static final Pattern PARAMETER = Pattern.compile("\\s*(;\\s*)+|(?:" + namedValue + ")");
+  
+  private PreferParser (){
+    //Private constructor for utility classes
+  }
 
   protected static Map<String, Preference> parse(final Collection<String> values) {
     if (values == null || values.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AbstractODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AbstractODataSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AbstractODataSerializer.java
index ee472c6..c279586 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AbstractODataSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AbstractODataSerializer.java
@@ -25,6 +25,8 @@ import org.apache.olingo.server.api.serializer.ODataSerializer;
 import org.apache.olingo.server.api.serializer.SerializerException;
 
 public abstract class AbstractODataSerializer implements ODataSerializer {
+  
+  protected static final String IO_EXCEPTION_TEXT = "An I/O exception occurred.";
 
   protected void closeCircleStreamBufferOutput(OutputStream outputStream, SerializerException cachedException)
       throws SerializerException {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
index 8cd47068..95a33f5 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
@@ -258,7 +258,7 @@ public class BatchResponseSerializer {
         }
         return output.toByteArray();
       } catch (IOException e) {
-        throw new ODataRuntimeException("Error on reading request content");
+        throw new ODataRuntimeException("Error on reading request content", e);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java
index 0a401b2..3066839 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java
@@ -41,7 +41,12 @@ public class FixedFormatSerializerImpl implements FixedFormatSerializer {
 
   @Override
   public InputStream count(final Integer count) throws SerializerException {
-    return new ByteArrayInputStream(count.toString().getBytes());
+    try {
+      return new ByteArrayInputStream(count.toString().getBytes("UTF-8"));
+    } catch (UnsupportedEncodingException e) {
+      throw new SerializerException("UTF-8 is nott supprted as an encoding", e,
+          SerializerException.MessageKeys.UNSUPPORTED_ENCODING, "UTF-8");
+    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
index 57fc471..f9c0c8f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
@@ -84,7 +84,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
   public SerializerResult serviceDocument(final ServiceMetadata metadata, final String serviceRoot)
       throws SerializerException {
     OutputStream outputStream = null;
-    SerializerException cachedException = null; 
+    SerializerException cachedException = null;
 
     try {
       CircleStreamBuffer buffer = new CircleStreamBuffer();
@@ -97,7 +97,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -125,7 +125,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -166,7 +166,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -194,7 +194,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -574,7 +574,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } catch (final EdmPrimitiveTypeException e) {
       cachedException = new SerializerException("Wrong value for property!", e,
@@ -617,7 +617,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -651,7 +651,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -680,7 +680,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -710,7 +710,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -754,7 +754,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
       return SerializerResultImpl.with().content(buffer.getInputStream()).build();
     } catch (final IOException e) {
       cachedException =
-          new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+          new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
       throw cachedException;
     } finally {
       closeCircleStreamBufferOutput(outputStream, cachedException);
@@ -796,7 +796,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
 
   private boolean isODataIEEE754Compatible(final ContentType contentType) {
     return contentType.getParameters().containsKey(ContentType.PARAMETER_IEEE754_COMPATIBLE)
-        && Boolean.TRUE.toString().toLowerCase().equals(
+        && Boolean.TRUE.toString().equalsIgnoreCase(
             contentType.getParameter(ContentType.PARAMETER_IEEE754_COMPATIBLE).toLowerCase());
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContentTypeHelper.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContentTypeHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContentTypeHelper.java
index 1e80666..8710158 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContentTypeHelper.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContentTypeHelper.java
@@ -21,6 +21,11 @@ package org.apache.olingo.server.core.serializer.utils;
 import org.apache.olingo.commons.api.format.ContentType;
 
 public class ContentTypeHelper {
+  
+  private ContentTypeHelper (){
+    //Private constructor for utility classes
+  }
+  
   public static boolean isODataMetadataNone(final ContentType contentType) {
     return contentType.isCompatible(ContentType.APPLICATION_JSON) 
        && ContentType.VALUE_ODATA_METADATA_NONE.equals(contentType.getParameter(ContentType.PARAMETER_ODATA_METADATA));

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/33478d8c/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
index 2957bce..045783c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
@@ -112,11 +112,11 @@ public class MetadataDocumentXmlSerializer {
   private static final String DATA_SERVICES = "DataServices";
   private static final String ABSTRACT = "Abstract";
 
-  private final static String EDMX = "Edmx";
-  private final static String PREFIX_EDMX = "edmx";
-  private final static String NS_EDMX = "http://docs.oasis-open.org/odata/ns/edmx";
+  private static final String EDMX = "Edmx";
+  private static final String PREFIX_EDMX = "edmx";
+  private static final String NS_EDMX = "http://docs.oasis-open.org/odata/ns/edmx";
 
-  private final static String NS_EDM = "http://docs.oasis-open.org/odata/ns/edm";
+  private static final String NS_EDM = "http://docs.oasis-open.org/odata/ns/edm";
   private static final String XML_ENTITY_SET_PATH = "EntitySetPath";
   private static final String XML_CONTAINS_TARGET = "ContainsTarget";
 
@@ -401,7 +401,7 @@ public class MetadataDocumentXmlSerializer {
 
   private void appendReturnTypeFacets(final XMLStreamWriter writer, final EdmReturnType returnType)
       throws XMLStreamException {
-    if (returnType.isNullable() == false) {
+    if (!returnType.isNullable()) {
       writer.writeAttribute(XML_NULLABLE, "" + returnType.isNullable());
     }
     if (returnType.getMaxLength() != null) {
@@ -417,7 +417,7 @@ public class MetadataDocumentXmlSerializer {
 
   private void appendParameterFacets(final XMLStreamWriter writer, final EdmParameter parameter)
       throws XMLStreamException {
-    if (parameter.isNullable() == false) {
+    if (!parameter.isNullable()) {
       writer.writeAttribute(XML_NULLABLE, "" + parameter.isNullable());
     }
     if (parameter.getMaxLength() != null) {
@@ -494,7 +494,7 @@ public class MetadataDocumentXmlSerializer {
       writer.writeAttribute(XML_NAME, navigationPropertyName);
       writer.writeAttribute(XML_TYPE, getAliasedFullQualifiedName(navigationProperty.getType(), navigationProperty
           .isCollection()));
-      if (navigationProperty.isNullable() == false) {
+      if (!navigationProperty.isNullable()) {
         writer.writeAttribute(XML_NULLABLE, "" + navigationProperty.isNullable());
       }
 
@@ -537,11 +537,11 @@ public class MetadataDocumentXmlSerializer {
       writer.writeAttribute(XML_TYPE, fqnString);
 
       // Facets
-      if (property.isNullable() == false) {
+      if (!property.isNullable()) {
         writer.writeAttribute(XML_NULLABLE, "" + property.isNullable());
       }
 
-      if (property.isUnicode() == false) {
+      if (!property.isUnicode()) {
         writer.writeAttribute(XML_UNICODE, "" + property.isUnicode());
       }