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 2013/09/20 15:33:58 UTC

[36/59] [abbrv] Cleanup of core

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHandlerImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHandlerImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHandlerImpl.java
index 8869a33..d2d4cee 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHandlerImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHandlerImpl.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 
@@ -66,8 +66,10 @@ public class BatchHandlerImpl implements BatchHandler {
       }
       ODataRequest request = batchPart.getRequests().get(0);
       ODataRequestHandler handler = createHandler(request);
-      String mimeHeaderContentId = request.getRequestHeaderValue(BatchHelper.MIME_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH));
-      String requestHeaderContentId = request.getRequestHeaderValue(BatchHelper.REQUEST_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH));
+      String mimeHeaderContentId =
+          request.getRequestHeaderValue(BatchHelper.MIME_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH));
+      String requestHeaderContentId =
+          request.getRequestHeaderValue(BatchHelper.REQUEST_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH));
       ODataResponse response = setContentIdHeader(handler.handle(request), mimeHeaderContentId, requestHeaderContentId);
       List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
       responses.add(response);
@@ -78,8 +80,10 @@ public class BatchHandlerImpl implements BatchHandler {
   @Override
   public ODataResponse handleRequest(final ODataRequest suppliedRequest) throws ODataException {
     ODataRequest request;
-    String mimeHeaderContentId = suppliedRequest.getRequestHeaderValue(BatchHelper.MIME_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH));
-    String requestHeaderContentId = suppliedRequest.getRequestHeaderValue(BatchHelper.REQUEST_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH));
+    String mimeHeaderContentId =
+        suppliedRequest.getRequestHeaderValue(BatchHelper.MIME_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH));
+    String requestHeaderContentId =
+        suppliedRequest.getRequestHeaderValue(BatchHelper.REQUEST_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH));
 
     List<PathSegment> odataSegments = suppliedRequest.getPathInfo().getODataSegments();
     if (!odataSegments.isEmpty() && odataSegments.get(0).getPath().matches("\\$.*")) {
@@ -109,7 +113,8 @@ public class BatchHandlerImpl implements BatchHandler {
     contentIdMap.put("$" + contentId, relLocation);
   }
 
-  private ODataRequest modifyRequest(final ODataRequest request, final List<PathSegment> odataSegments) throws ODataException {
+  private ODataRequest modifyRequest(final ODataRequest request, final List<PathSegment> odataSegments)
+      throws ODataException {
     String contentId = contentIdMap.get(odataSegments.get(0).getPath());
     PathInfoImpl pathInfo = new PathInfoImpl();
     try {
@@ -139,15 +144,20 @@ public class BatchHandlerImpl implements BatchHandler {
     return modifiedRequest;
   }
 
-  private ODataResponse setContentIdHeader(final ODataResponse response, final String mimeHeaderContentId, final String requestHeaderContentId) {
+  private ODataResponse setContentIdHeader(final ODataResponse response, final String mimeHeaderContentId,
+      final String requestHeaderContentId) {
     ODataResponse modifiedResponse;
     if (requestHeaderContentId != null && mimeHeaderContentId != null) {
-      modifiedResponse = ODataResponse.fromResponse(response).header(BatchHelper.REQUEST_HEADER_CONTENT_ID, requestHeaderContentId)
-          .header(BatchHelper.MIME_HEADER_CONTENT_ID, mimeHeaderContentId).build();
+      modifiedResponse =
+          ODataResponse.fromResponse(response).header(BatchHelper.REQUEST_HEADER_CONTENT_ID, requestHeaderContentId)
+              .header(BatchHelper.MIME_HEADER_CONTENT_ID, mimeHeaderContentId).build();
     } else if (requestHeaderContentId != null) {
-      modifiedResponse = ODataResponse.fromResponse(response).header(BatchHelper.REQUEST_HEADER_CONTENT_ID, requestHeaderContentId).build();
+      modifiedResponse =
+          ODataResponse.fromResponse(response).header(BatchHelper.REQUEST_HEADER_CONTENT_ID, requestHeaderContentId)
+              .build();
     } else if (mimeHeaderContentId != null) {
-      modifiedResponse = ODataResponse.fromResponse(response).header(BatchHelper.MIME_HEADER_CONTENT_ID, mimeHeaderContentId).build();
+      modifiedResponse =
+          ODataResponse.fromResponse(response).header(BatchHelper.MIME_HEADER_CONTENT_ID, mimeHeaderContentId).build();
     } else {
       return response;
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
index 38d02ae..3a64288 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchQueryPartImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchQueryPartImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchQueryPartImpl.java
index e22a3b3..4833f9f 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchQueryPartImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchQueryPartImpl.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestParser.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestParser.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestParser.java
index e223a6e..2404ad8 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestParser.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestParser.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 
@@ -61,15 +61,23 @@ public class BatchRequestParser {
   private static final String ANY_CHARACTERS = ".*";
 
   private static final Pattern REG_EX_BLANK_LINE = Pattern.compile("(|" + REG_EX_ZERO_OR_MORE_WHITESPACES + ")");
-  private static final Pattern REG_EX_HEADER = Pattern.compile("([a-zA-Z\\-]+):" + REG_EX_OPTIONAL_WHITESPACE + "(.*)" + REG_EX_ZERO_OR_MORE_WHITESPACES);
+  private static final Pattern REG_EX_HEADER = Pattern.compile("([a-zA-Z\\-]+):" + REG_EX_OPTIONAL_WHITESPACE + "(.*)"
+      + REG_EX_ZERO_OR_MORE_WHITESPACES);
   private static final Pattern REG_EX_VERSION = Pattern.compile("(?:HTTP/[0-9]\\.[0-9])");
-  private static final Pattern REG_EX_ANY_BOUNDARY_STRING = Pattern.compile("--" + ANY_CHARACTERS + REG_EX_ZERO_OR_MORE_WHITESPACES);
-  private static final Pattern REG_EX_REQUEST_LINE = Pattern.compile("(GET|POST|PUT|DELETE|MERGE|PATCH)\\s(.*)\\s?" + REG_EX_VERSION + REG_EX_ZERO_OR_MORE_WHITESPACES);
-  private static final Pattern REG_EX_BOUNDARY_PARAMETER = Pattern.compile(REG_EX_OPTIONAL_WHITESPACE + "boundary=(\".*\"|.*)" + REG_EX_ZERO_OR_MORE_WHITESPACES);
-  private static final Pattern REG_EX_CONTENT_TYPE = Pattern.compile(REG_EX_OPTIONAL_WHITESPACE + HttpContentType.MULTIPART_MIXED);
+  private static final Pattern REG_EX_ANY_BOUNDARY_STRING = Pattern.compile("--" + ANY_CHARACTERS
+      + REG_EX_ZERO_OR_MORE_WHITESPACES);
+  private static final Pattern REG_EX_REQUEST_LINE = Pattern.compile("(GET|POST|PUT|DELETE|MERGE|PATCH)\\s(.*)\\s?"
+      + REG_EX_VERSION + REG_EX_ZERO_OR_MORE_WHITESPACES);
+  private static final Pattern REG_EX_BOUNDARY_PARAMETER = Pattern.compile(REG_EX_OPTIONAL_WHITESPACE
+      + "boundary=(\".*\"|.*)" + REG_EX_ZERO_OR_MORE_WHITESPACES);
+  private static final Pattern REG_EX_CONTENT_TYPE = Pattern.compile(REG_EX_OPTIONAL_WHITESPACE
+      + HttpContentType.MULTIPART_MIXED);
   private static final Pattern REG_EX_QUERY_PARAMETER = Pattern.compile("((?:\\$|)[^=]+)=([^=]+)");
 
-  private static final String REG_EX_BOUNDARY = "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\""; // See RFC 2046
+  private static final String REG_EX_BOUNDARY =
+      "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\" +
+          "(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\""; // See RFC 2046
+
   private String baseUri;
   private PathInfo batchRequestPathInfo;
   private String contentTypeMime;
@@ -137,7 +145,7 @@ public class BatchRequestParser {
     return requests;
   }
 
-  //The method parses additional information prior to the first boundary delimiter line
+  // The method parses additional information prior to the first boundary delimiter line
   private void parsePreamble(final Scanner scanner) {
     while (scanner.hasNext() && !scanner.hasNext(REG_EX_ANY_BOUNDARY_STRING)) {
       scanner.next();
@@ -145,7 +153,8 @@ public class BatchRequestParser {
     }
   }
 
-  private BatchRequestPart parseMultipart(final Scanner scanner, final String boundary, final boolean isChangeSet) throws BatchException {
+  private BatchRequestPart parseMultipart(final Scanner scanner, final String boundary, final boolean isChangeSet)
+      throws BatchException {
     Map<String, String> mimeHeaders = new HashMap<String, String>();
     BatchRequestPart multipart = null;
     List<ODataRequest> requests = new ArrayList<ODataRequest>();
@@ -182,7 +191,8 @@ public class BatchRequestParser {
           }
           List<ODataRequest> changeSetRequests = new LinkedList<ODataRequest>();
           parseNewLine(scanner);// mandatory
-          Pattern changeSetCloseDelimiter = Pattern.compile("--" + changeSetBoundary + "--" + REG_EX_ZERO_OR_MORE_WHITESPACES);
+          Pattern changeSetCloseDelimiter =
+              Pattern.compile("--" + changeSetBoundary + "--" + REG_EX_ZERO_OR_MORE_WHITESPACES);
           while (!scanner.hasNext(changeSetCloseDelimiter)) {
             BatchRequestPart part = parseMultipart(scanner, changeSetBoundary, true);
             changeSetRequests.addAll(part.getRequests());
@@ -191,7 +201,8 @@ public class BatchRequestParser {
           currentLineNumber++;
           multipart = new BatchRequestPartImpl(true, changeSetRequests);
         } else {
-          throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent(HttpContentType.MULTIPART_MIXED + " or " + HttpContentType.APPLICATION_HTTP));
+          throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent(HttpContentType.MULTIPART_MIXED
+              + " or " + HttpContentType.APPLICATION_HTTP));
         }
       }
     } else if (scanner.hasNext(boundary + REG_EX_ZERO_OR_MORE_WHITESPACES)) {
@@ -199,7 +210,8 @@ public class BatchRequestParser {
       throw new BatchException(BatchException.INVALID_BOUNDARY_DELIMITER.addContent(currentLineNumber));
     } else if (scanner.hasNext(REG_EX_ANY_BOUNDARY_STRING)) {
       currentLineNumber++;
-      throw new BatchException(BatchException.NO_MATCH_WITH_BOUNDARY_STRING.addContent(boundary).addContent(currentLineNumber));
+      throw new BatchException(BatchException.NO_MATCH_WITH_BOUNDARY_STRING.addContent(boundary).addContent(
+          currentLineNumber));
     } else {
       currentLineNumber++;
       throw new BatchException(BatchException.MISSING_BOUNDARY_DELIMITER.addContent(currentLineNumber));
@@ -220,7 +232,8 @@ public class BatchRequestParser {
         uri = result.group(2).trim();
       } else {
         currentLineNumber++;
-        throw new BatchException(BatchException.INVALID_REQUEST_LINE.addContent(scanner.next()).addContent(currentLineNumber));
+        throw new BatchException(BatchException.INVALID_REQUEST_LINE.addContent(scanner.next()).addContent(
+            currentLineNumber));
       }
       PathInfo pathInfo = parseRequestUri(uri);
       Map<String, String> queryParameters = parseQueryParameters(uri);
@@ -264,7 +277,8 @@ public class BatchRequestParser {
       return requestBuilder.build();
     } else {
       currentLineNumber++;
-      throw new BatchException(BatchException.INVALID_REQUEST_LINE.addContent(scanner.next()).addContent(currentLineNumber));
+      throw new BatchException(BatchException.INVALID_REQUEST_LINE.addContent(scanner.next()).addContent(
+          currentLineNumber));
     }
 
   }
@@ -301,7 +315,8 @@ public class BatchRequestParser {
         }
       } else {
         currentLineNumber++;
-        throw new BatchException(BatchException.INVALID_HEADER.addContent(scanner.next()).addContent(currentLineNumber));
+        throw new BatchException(BatchException.INVALID_HEADER.addContent(scanner.next())
+            .addContent(currentLineNumber));
       }
     }
     return headers;
@@ -497,7 +512,8 @@ public class BatchRequestParser {
     } else {
       currentLineNumber++;
       if (scanner.hasNext()) {
-        throw new BatchException(BatchException.MISSING_BLANK_LINE.addContent(scanner.next()).addContent(currentLineNumber));
+        throw new BatchException(BatchException.MISSING_BLANK_LINE.addContent(scanner.next()).addContent(
+            currentLineNumber));
       } else {
         throw new BatchException(BatchException.TRUNCATED_BODY.addContent(currentLineNumber));
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestPartImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestPartImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestPartImpl.java
index 80e5cd8..bbf0c03 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestPartImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestPartImpl.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java
index 3eda8e1..4622d37 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 
@@ -31,7 +31,10 @@ import org.apache.olingo.odata2.api.commons.HttpContentType;
 import org.apache.olingo.odata2.api.commons.HttpHeaders;
 
 public class BatchRequestWriter {
-  private static final String REG_EX_BOUNDARY = "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\""; // See RFC 2046
+  private static final String REG_EX_BOUNDARY =
+      "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\" +
+          "(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\""; // See RFC 2046
+
   private static final String COLON = ":";
   private static final String SP = " ";
   private static final String LF = "\r\n";
@@ -50,8 +53,8 @@ public class BatchRequestWriter {
         appendChangeSet((BatchChangeSet) batchPart);
       } else if (batchPart instanceof BatchQueryPart) {
         BatchQueryPart request = (BatchQueryPart) batchPart;
-        appendRequestBodyPart(request.getMethod(), request.getUri(), null, request.getHeaders(), request.getContentId());
-
+        appendRequestBodyPart(request.getMethod(), request.getUri(), null, request.getHeaders(),
+            request.getContentId());
       }
     }
     writer.append("--").append(boundary).append("--").append(LF).append(LF);
@@ -65,17 +68,21 @@ public class BatchRequestWriter {
     while (boundary.equals(batchBoundary) || !boundary.matches(REG_EX_BOUNDARY)) {
       boundary = BatchHelper.generateBoundary("changeset");
     }
-    writer.append(HttpHeaders.CONTENT_TYPE).append(COLON).append(SP).append(HttpContentType.MULTIPART_MIXED + "; boundary=" + boundary).append(LF).append(LF);
+    writer.append(HttpHeaders.CONTENT_TYPE).append(COLON).append(SP).append(
+        HttpContentType.MULTIPART_MIXED + "; boundary=" + boundary).append(LF).append(LF);
     for (BatchChangeSetPart request : batchChangeSet.getChangeSetParts()) {
       writer.append("--").append(boundary).append(LF);
-      appendRequestBodyPart(request.getMethod(), request.getUri(), request.getBody(), request.getHeaders(), request.getContentId());
+      appendRequestBodyPart(request.getMethod(), request.getUri(), request.getBody(), request.getHeaders(), request
+          .getContentId());
     }
     writer.append("--").append(boundary).append("--").append(LF).append(LF);
   }
 
-  private void appendRequestBodyPart(final String method, final String uri, final String body, final Map<String, String> headers, final String contentId) {
+  private void appendRequestBodyPart(final String method, final String uri, final String body,
+      final Map<String, String> headers, final String contentId) {
     boolean isContentLengthPresent = false;
-    writer.append(HttpHeaders.CONTENT_TYPE).append(COLON).append(SP).append(HttpContentType.APPLICATION_HTTP).append(LF);
+    writer.append(HttpHeaders.CONTENT_TYPE).append(COLON).append(SP).append(HttpContentType.APPLICATION_HTTP)
+        .append(LF);
     writer.append(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING).append(COLON).append(SP).append("binary").append(LF);
     if (contentId != null) {
       writer.append(BatchHelper.HTTP_CONTENT_ID).append(COLON).append(SP).append(contentId).append(LF);
@@ -89,7 +96,8 @@ public class BatchRequestWriter {
     writer.append(LF);
 
     if (!isContentLengthPresent && body != null && !body.isEmpty()) {
-      writer.append(HttpHeaders.CONTENT_LENGTH).append(COLON).append(SP).append(BatchHelper.getBytes(body).length).append(LF);
+      writer.append(HttpHeaders.CONTENT_LENGTH).append(COLON).append(SP).append(BatchHelper.getBytes(body).length)
+          .append(LF);
 
     }
     appendHeader(headers);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseParser.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseParser.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseParser.java
index 15ce60c..84b90b0 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseParser.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseParser.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 
@@ -44,14 +44,21 @@ public class BatchResponseParser {
   private static final String ANY_CHARACTERS = ".*";
 
   private static final Pattern REG_EX_BLANK_LINE = Pattern.compile("(|" + REG_EX_ZERO_OR_MORE_WHITESPACES + ")");
-  private static final Pattern REG_EX_HEADER = Pattern.compile("([a-zA-Z\\-]+):" + REG_EX_OPTIONAL_WHITESPACE + "(.*)" + REG_EX_ZERO_OR_MORE_WHITESPACES);
+  private static final Pattern REG_EX_HEADER = Pattern.compile("([a-zA-Z\\-]+):" + REG_EX_OPTIONAL_WHITESPACE + "(.*)"
+      + REG_EX_ZERO_OR_MORE_WHITESPACES);
   private static final Pattern REG_EX_VERSION = Pattern.compile("(?:HTTP/[0-9]\\.[0-9])");
-  private static final Pattern REG_EX_ANY_BOUNDARY_STRING = Pattern.compile("--" + ANY_CHARACTERS + REG_EX_ZERO_OR_MORE_WHITESPACES);
-  private static final Pattern REG_EX_STATUS_LINE = Pattern.compile(REG_EX_VERSION + "\\s" + "([0-9]{3})\\s([\\S ]+)" + REG_EX_ZERO_OR_MORE_WHITESPACES);
-  private static final Pattern REG_EX_BOUNDARY_PARAMETER = Pattern.compile(REG_EX_OPTIONAL_WHITESPACE + "boundary=(\".*\"|.*)" + REG_EX_ZERO_OR_MORE_WHITESPACES);
-  private static final Pattern REG_EX_CONTENT_TYPE = Pattern.compile(REG_EX_OPTIONAL_WHITESPACE + HttpContentType.MULTIPART_MIXED);
+  private static final Pattern REG_EX_ANY_BOUNDARY_STRING = Pattern.compile("--" + ANY_CHARACTERS
+      + REG_EX_ZERO_OR_MORE_WHITESPACES);
+  private static final Pattern REG_EX_STATUS_LINE = Pattern.compile(REG_EX_VERSION + "\\s" + "([0-9]{3})\\s([\\S ]+)"
+      + REG_EX_ZERO_OR_MORE_WHITESPACES);
+  private static final Pattern REG_EX_BOUNDARY_PARAMETER = Pattern.compile(REG_EX_OPTIONAL_WHITESPACE
+      + "boundary=(\".*\"|.*)" + REG_EX_ZERO_OR_MORE_WHITESPACES);
+  private static final Pattern REG_EX_CONTENT_TYPE = Pattern.compile(REG_EX_OPTIONAL_WHITESPACE
+      + HttpContentType.MULTIPART_MIXED);
 
-  private static final String REG_EX_BOUNDARY = "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+ \\(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\""; // See RFC 2046
+  private static final String REG_EX_BOUNDARY =
+      "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+ \\(\\)" +
+          ",/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\""; // See RFC 2046
 
   private String contentTypeMime;
   private String boundary;
@@ -100,7 +107,7 @@ public class BatchResponseParser {
 
   }
 
-  //The method parses additional information prior to the first boundary delimiter line
+  // The method parses additional information prior to the first boundary delimiter line
   private void parsePreamble(final Scanner scanner) {
     while (scanner.hasNext() && !scanner.hasNext(REG_EX_ANY_BOUNDARY_STRING)) {
       scanner.next();
@@ -108,7 +115,8 @@ public class BatchResponseParser {
     }
   }
 
-  private List<BatchSingleResponse> parseMultipart(final Scanner scanner, final String boundary, final boolean isChangeSet) throws BatchException {
+  private List<BatchSingleResponse> parseMultipart(final Scanner scanner, final String boundary,
+      final boolean isChangeSet) throws BatchException {
     Map<String, String> mimeHeaders = new HashMap<String, String>();
     List<BatchSingleResponse> responses = new ArrayList<BatchSingleResponse>();
     if (scanner.hasNext("--" + boundary + REG_EX_ZERO_OR_MORE_WHITESPACES)) {
@@ -142,7 +150,8 @@ public class BatchResponseParser {
             throw new BatchException(BatchException.INVALID_CHANGESET_BOUNDARY.addContent(currentLineNumber));
           }
           parseNewLine(scanner);// mandatory
-          Pattern changeSetCloseDelimiter = Pattern.compile("--" + changeSetBoundary + "--" + REG_EX_ZERO_OR_MORE_WHITESPACES);
+          Pattern changeSetCloseDelimiter =
+              Pattern.compile("--" + changeSetBoundary + "--" + REG_EX_ZERO_OR_MORE_WHITESPACES);
           while (!scanner.hasNext(changeSetCloseDelimiter)) {
             responses.addAll(parseMultipart(scanner, changeSetBoundary, true));
           }
@@ -150,7 +159,8 @@ public class BatchResponseParser {
           currentLineNumber++;
           parseNewLine(scanner);
         } else {
-          throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent(HttpContentType.MULTIPART_MIXED + " or " + HttpContentType.APPLICATION_HTTP));
+          throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent(HttpContentType.MULTIPART_MIXED
+              + " or " + HttpContentType.APPLICATION_HTTP));
         }
       }
     } else if (scanner.hasNext(boundary + REG_EX_ZERO_OR_MORE_WHITESPACES)) {
@@ -158,7 +168,8 @@ public class BatchResponseParser {
       throw new BatchException(BatchException.INVALID_BOUNDARY_DELIMITER.addContent(currentLineNumber));
     } else if (scanner.hasNext(REG_EX_ANY_BOUNDARY_STRING)) {
       currentLineNumber++;
-      throw new BatchException(BatchException.NO_MATCH_WITH_BOUNDARY_STRING.addContent(boundary).addContent(currentLineNumber));
+      throw new BatchException(BatchException.NO_MATCH_WITH_BOUNDARY_STRING.addContent(boundary).addContent(
+          currentLineNumber));
     } else {
       currentLineNumber++;
       throw new BatchException(BatchException.MISSING_BOUNDARY_DELIMITER.addContent(currentLineNumber));
@@ -167,7 +178,8 @@ public class BatchResponseParser {
 
   }
 
-  private BatchSingleResponseImpl parseResponse(final Scanner scanner, final boolean isChangeSet) throws BatchException {
+  private BatchSingleResponseImpl parseResponse(final Scanner scanner, final boolean isChangeSet)
+      throws BatchException {
     BatchSingleResponseImpl response = new BatchSingleResponseImpl();
     if (scanner.hasNext(REG_EX_STATUS_LINE)) {
       scanner.next(REG_EX_STATUS_LINE);
@@ -180,13 +192,16 @@ public class BatchResponseParser {
         statusInfo = result.group(2);
       } else {
         currentLineNumber++;
-        throw new BatchException(BatchException.INVALID_STATUS_LINE.addContent(scanner.next()).addContent(currentLineNumber));
+        throw new BatchException(BatchException.INVALID_STATUS_LINE.addContent(scanner.next()).addContent(
+            currentLineNumber));
       }
 
       Map<String, String> headers = parseResponseHeaders(scanner);
       parseNewLine(scanner);
       String contentLengthHeader = getHeaderValue(headers, HttpHeaders.CONTENT_LENGTH);
-      String body = (contentLengthHeader != null) ? parseBody(scanner, Integer.parseInt(contentLengthHeader)) : parseBody(scanner);
+      String body =
+          (contentLengthHeader != null) ? parseBody(scanner, Integer.parseInt(contentLengthHeader))
+              : parseBody(scanner);
       response.setStatusCode(statusCode);
       response.setStatusInfo(statusInfo);
       response.setHeaders(headers);
@@ -194,7 +209,8 @@ public class BatchResponseParser {
       response.setBody(body);
     } else {
       currentLineNumber++;
-      throw new BatchException(BatchException.INVALID_STATUS_LINE.addContent(scanner.next()).addContent(currentLineNumber));
+      throw new BatchException(BatchException.INVALID_STATUS_LINE.addContent(scanner.next()).addContent(
+          currentLineNumber));
     }
     return response;
   }
@@ -244,7 +260,8 @@ public class BatchResponseParser {
         }
       } else {
         currentLineNumber++;
-        throw new BatchException(BatchException.INVALID_HEADER.addContent(scanner.next()).addContent(currentLineNumber));
+        throw new BatchException(BatchException.INVALID_HEADER.addContent(scanner.next())
+            .addContent(currentLineNumber));
       }
     }
     return headers;
@@ -332,7 +349,8 @@ public class BatchResponseParser {
     } else {
       currentLineNumber++;
       if (scanner.hasNext()) {
-        throw new BatchException(BatchException.MISSING_BLANK_LINE.addContent(scanner.next()).addContent(currentLineNumber));
+        throw new BatchException(BatchException.MISSING_BLANK_LINE.addContent(scanner.next()).addContent(
+            currentLineNumber));
       } else {
         throw new BatchException(BatchException.TRUNCATED_BODY.addContent(currentLineNumber));
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponsePartImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponsePartImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponsePartImpl.java
index 486bbdf..3d6e6db 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponsePartImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponsePartImpl.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseWriter.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseWriter.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseWriter.java
index ae0c07b..be189d3 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseWriter.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchResponseWriter.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 
@@ -57,7 +57,8 @@ public class BatchResponseWriter {
     writer.append("--").append(boundary).append("--").append(LF).append(LF);
   }
 
-  private void appendResponsePart(final List<BatchResponsePart> batchResponseParts, final String boundary) throws BatchException {
+  private void appendResponsePart(final List<BatchResponsePart> batchResponseParts, final String boundary)
+      throws BatchException {
     for (BatchResponsePart batchResponsePart : batchResponseParts) {
       writer.append("--").append(boundary).append(LF);
       if (batchResponsePart.isChangeSet()) {
@@ -100,7 +101,8 @@ public class BatchResponseWriter {
 
   private void appendHeader(final ODataResponse response) {
     for (String name : response.getHeaderNames()) {
-      if (!BatchHelper.MIME_HEADER_CONTENT_ID.equalsIgnoreCase(name) && !BatchHelper.REQUEST_HEADER_CONTENT_ID.equalsIgnoreCase(name)) {
+      if (!BatchHelper.MIME_HEADER_CONTENT_ID.equalsIgnoreCase(name)
+          && !BatchHelper.REQUEST_HEADER_CONTENT_ID.equalsIgnoreCase(name)) {
         writer.append(name).append(COLON).append(SP).append(response.getHeader(name)).append(LF);
       } else if (BatchHelper.REQUEST_HEADER_CONTENT_ID.equalsIgnoreCase(name)) {
         writer.append(BatchHelper.HTTP_CONTENT_ID).append(COLON).append(SP)

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchSingleResponseImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchSingleResponseImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchSingleResponseImpl.java
index 337b550..85c09ca 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchSingleResponseImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchSingleResponseImpl.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.batch;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/ContentType.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/ContentType.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/ContentType.java
index 5a174e2..6a797ad 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/ContentType.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/ContentType.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.commons;
 
@@ -36,42 +36,43 @@ import java.util.regex.Pattern;
 /**
  * Internally used {@link ContentType} for OData library.
  * 
- * For more details on format and content of a {@link ContentType} see    
- * <code>Media Type</code> format as defined in <code>RFC 2616 chapter 3.7 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html)</code>.
+ * For more details on format and content of a {@link ContentType} see
+ * <code>Media Type</code> format as defined in <code>RFC 2616 chapter 3.7
+ * (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html)</code>.
  * <pre>
  * <code>
- *   media-type     = type "/" subtype *( ";" parameter )
- *   type           = token
- *   subtype        = token
+ * media-type = type "/" subtype *( ";" parameter )
+ * type = token
+ * subtype = token
  * </code>
  * </pre>
  * 
- * Especially for <code>Accept</code> Header as defined in 
+ * Especially for <code>Accept</code> Header as defined in
  * <code>RFC 2616 chapter 14.1 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)</code>:
  * <pre>
  * <code>
  * Accept = "Accept" ":"
- *          #( media-range [ accept-params ] )
- *  media-range = ( "* /*"
- *                | ( type "/" "*" )
- *                | ( type "/" subtype )
- *                ) *( ";" parameter )
- *  accept-params  = ";" "q" "=" qvalue *( accept-extension )
- *  accept-extension = ";" token [ "=" ( token | quoted-string ) ]
+ * #( media-range [ accept-params ] )
+ * media-range = ( "* /*"
+ * | ( type "/" "*" )
+ * | ( type "/" subtype )
+ * ) *( ";" parameter )
+ * accept-params = ";" "q" "=" qvalue *( accept-extension )
+ * accept-extension = ";" token [ "=" ( token | quoted-string ) ]
  * </code>
  * </pre>
  * 
- * Especially for <code>Content-Type</code> Header as defined in 
+ * Especially for <code>Content-Type</code> Header as defined in
  * <code>RFC 2616 chapter 14.7 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)</code>:
  * <pre>
  * <code>
- * Content-Type   = "Content-Type" ":" media-type
+ * Content-Type = "Content-Type" ":" media-type
  * </code>
  * </pre>
  * 
  * Once created a {@link ContentType} is <b>IMMUTABLE</b>.
  * 
- *  
+ * 
  */
 public class ContentType {
 
@@ -87,17 +88,16 @@ public class ContentType {
     KNOWN_MIME_TYPES.add("multipart");
     KNOWN_MIME_TYPES.add("text");
   }
-  
+
   private static final Comparator<String> Q_PARAMETER_COMPARATOR = new Comparator<String>() {
     @Override
-    public int compare(String o1, String o2) {
+    public int compare(final String o1, final String o2) {
       Float f1 = parseQParameterValue(o1);
       Float f2 = parseQParameterValue(o2);
       return f2.compareTo(f1);
     }
   };
 
-
   private static final char WHITESPACE_CHAR = ' ';
   private static final String PARAMETER_SEPARATOR = ";";
   private static final String PARAMETER_KEY_VALUE_SEPARATOR = "=";
@@ -116,21 +116,32 @@ public class ContentType {
   public static final ContentType WILDCARD = new ContentType(MEDIA_TYPE_WILDCARD, MEDIA_TYPE_WILDCARD);
 
   public static final ContentType APPLICATION_XML = new ContentType("application", "xml", ODataFormat.XML);
-  public static final ContentType APPLICATION_XML_CS_UTF_8 = ContentType.create(APPLICATION_XML, PARAMETER_CHARSET, CHARSET_UTF_8);
+  public static final ContentType APPLICATION_XML_CS_UTF_8 = ContentType.create(APPLICATION_XML, PARAMETER_CHARSET,
+      CHARSET_UTF_8);
   public static final ContentType APPLICATION_ATOM_XML = new ContentType("application", "atom+xml", ODataFormat.ATOM);
-  public static final ContentType APPLICATION_ATOM_XML_CS_UTF_8 = ContentType.create(APPLICATION_ATOM_XML, PARAMETER_CHARSET, CHARSET_UTF_8);
-  public static final ContentType APPLICATION_ATOM_XML_ENTRY = new ContentType("application", "atom+xml", ODataFormat.ATOM, parameterMap(PARAMETER_TYPE, "entry"));
-  public static final ContentType APPLICATION_ATOM_XML_ENTRY_CS_UTF_8 = ContentType.create(APPLICATION_ATOM_XML_ENTRY, PARAMETER_CHARSET, CHARSET_UTF_8);
-  public static final ContentType APPLICATION_ATOM_XML_FEED = new ContentType("application", "atom+xml", ODataFormat.ATOM, parameterMap(PARAMETER_TYPE, "feed"));
-  public static final ContentType APPLICATION_ATOM_XML_FEED_CS_UTF_8 = ContentType.create(APPLICATION_ATOM_XML_FEED, PARAMETER_CHARSET, CHARSET_UTF_8);
-  public static final ContentType APPLICATION_ATOM_SVC = new ContentType("application", "atomsvc+xml", ODataFormat.ATOM);
-  public static final ContentType APPLICATION_ATOM_SVC_CS_UTF_8 = ContentType.create(APPLICATION_ATOM_SVC, PARAMETER_CHARSET, CHARSET_UTF_8);
+  public static final ContentType APPLICATION_ATOM_XML_CS_UTF_8 = ContentType.create(APPLICATION_ATOM_XML,
+      PARAMETER_CHARSET, CHARSET_UTF_8);
+  public static final ContentType APPLICATION_ATOM_XML_ENTRY = new ContentType("application", "atom+xml",
+      ODataFormat.ATOM, parameterMap(PARAMETER_TYPE, "entry"));
+  public static final ContentType APPLICATION_ATOM_XML_ENTRY_CS_UTF_8 = ContentType.create(APPLICATION_ATOM_XML_ENTRY,
+      PARAMETER_CHARSET, CHARSET_UTF_8);
+  public static final ContentType APPLICATION_ATOM_XML_FEED = new ContentType("application", "atom+xml",
+      ODataFormat.ATOM, parameterMap(PARAMETER_TYPE, "feed"));
+  public static final ContentType APPLICATION_ATOM_XML_FEED_CS_UTF_8 = ContentType.create(APPLICATION_ATOM_XML_FEED,
+      PARAMETER_CHARSET, CHARSET_UTF_8);
+  public static final ContentType APPLICATION_ATOM_SVC =
+      new ContentType("application", "atomsvc+xml", ODataFormat.ATOM);
+  public static final ContentType APPLICATION_ATOM_SVC_CS_UTF_8 = ContentType.create(APPLICATION_ATOM_SVC,
+      PARAMETER_CHARSET, CHARSET_UTF_8);
   public static final ContentType APPLICATION_JSON = new ContentType("application", "json", ODataFormat.JSON);
-  public static final ContentType APPLICATION_JSON_ODATA_VERBOSE = ContentType.create(APPLICATION_JSON, PARAMETER_ODATA, VERBOSE);
-  public static final ContentType APPLICATION_JSON_CS_UTF_8 = ContentType.create(APPLICATION_JSON, PARAMETER_CHARSET, CHARSET_UTF_8);
+  public static final ContentType APPLICATION_JSON_ODATA_VERBOSE = ContentType.create(APPLICATION_JSON,
+      PARAMETER_ODATA, VERBOSE);
+  public static final ContentType APPLICATION_JSON_CS_UTF_8 = ContentType.create(APPLICATION_JSON, PARAMETER_CHARSET,
+      CHARSET_UTF_8);
   public static final ContentType APPLICATION_OCTET_STREAM = new ContentType("application", "octet-stream");
   public static final ContentType TEXT_PLAIN = new ContentType("text", "plain");
-  public static final ContentType TEXT_PLAIN_CS_UTF_8 = ContentType.create(TEXT_PLAIN, PARAMETER_CHARSET, CHARSET_UTF_8);
+  public static final ContentType TEXT_PLAIN_CS_UTF_8 = ContentType
+      .create(TEXT_PLAIN, PARAMETER_CHARSET, CHARSET_UTF_8);
   public static final ContentType MULTIPART_MIXED = new ContentType("multipart", "mixed");
 
   private final String type;
@@ -142,10 +153,10 @@ public class ContentType {
     if (type == null) {
       throw new IllegalArgumentException("Type parameter MUST NOT be null.");
     }
-    this.odataFormat = ODataFormat.CUSTOM;
+    odataFormat = ODataFormat.CUSTOM;
     this.type = validateType(type);
-    this.subtype = null;
-    this.parameters = Collections.emptyMap();
+    subtype = null;
+    parameters = Collections.emptyMap();
   }
 
   private ContentType(final String type, final String subtype) {
@@ -156,7 +167,8 @@ public class ContentType {
     this(type, subtype, odataFormat, null);
   }
 
-  private ContentType(final String type, final String subtype, final ODataFormat odataFormat, final Map<String, String> parameters) {
+  private ContentType(final String type, final String subtype, final ODataFormat odataFormat,
+      final Map<String, String> parameters) {
     if ((type == null || MEDIA_TYPE_WILDCARD.equals(type)) && !MEDIA_TYPE_WILDCARD.equals(subtype)) {
       throw new IllegalArgumentException("Illegal combination of WILDCARD type with NONE WILDCARD subtype.");
     }
@@ -192,8 +204,7 @@ public class ContentType {
   }
 
   /**
-   * Validates if given <code>format</code> is parseable and can be used as input for
-   * {@link #create(String)} method.
+   * Validates if given <code>format</code> is parseable and can be used as input for {@link #create(String)} method.
    * @param format to be validated string
    * @return <code>true</code> if format is parseable otherwise <code>false</code>
    */
@@ -206,8 +217,7 @@ public class ContentType {
   }
 
   /**
-   * Validates if given <code>format</code> is parseable and can be used as input for
-   * {@link #create(String)} method.
+   * Validates if given <code>format</code> is parseable and can be used as input for {@link #create(String)} method.
    * @param format to be validated string
    * @return <code>true</code> if format is parseable otherwise <code>false</code>
    */
@@ -247,8 +257,10 @@ public class ContentType {
    * @param parameterValue
    * @return a new <code>ContentType</code> object
    */
-  public static ContentType create(final ContentType contentType, final String parameterKey, final String parameterValue) {
-    ContentType ct = new ContentType(contentType.type, contentType.subtype, contentType.odataFormat, contentType.parameters);
+  public static ContentType
+      create(final ContentType contentType, final String parameterKey, final String parameterValue) {
+    ContentType ct =
+        new ContentType(contentType.type, contentType.subtype, contentType.odataFormat, contentType.parameters);
     ct.parameters.put(parameterKey, parameterValue);
     return ct;
   }
@@ -259,7 +271,7 @@ public class ContentType {
    * Supported format is <code>Media Type</code> format as defined in <code>RFC 2616 chapter 3.7</code>.
    * This format is used as
    * <code>HTTP Accept HEADER</code> format as defined in <code>RFC 2616 chapter 14.1</code>
-   * and 
+   * and
    * <code>HTTP Content-Type HEADER</code> format as defined in <code>RFC 2616 chapter 14.17</code>
    * 
    * @param format a string in format as defined in <code>RFC 2616 section 3.7</code>
@@ -281,9 +293,9 @@ public class ContentType {
     if (types.contains(TYPE_SUBTYPE_SEPARATOR)) {
       String[] tokens = types.split(TYPE_SUBTYPE_SEPARATOR);
       if (tokens.length == 2) {
-        if(tokens[0] == null || tokens[0].isEmpty()) {
+        if (tokens[0] == null || tokens[0].isEmpty()) {
           throw new IllegalArgumentException("No type found in format '" + format + "'.");
-        } else if(tokens[1] == null || tokens[1].isEmpty()) {
+        } else if (tokens[1] == null || tokens[1].isEmpty()) {
           throw new IllegalArgumentException("No subtype found in format '" + format + "'.");
         } else {
           return create(tokens[0], tokens[1], parametersMap);
@@ -291,10 +303,11 @@ public class ContentType {
       } else {
         throw new IllegalArgumentException("Too many '" + TYPE_SUBTYPE_SEPARATOR + "' in format '" + format + "'.");
       }
-    } else if(MEDIA_TYPE_WILDCARD.equals(types)) {
+    } else if (MEDIA_TYPE_WILDCARD.equals(types)) {
       return ContentType.WILDCARD;
     } else {
-      throw new IllegalArgumentException("No separator '" + TYPE_SUBTYPE_SEPARATOR + "' was found in format '" + format + "'.");
+      throw new IllegalArgumentException("No separator '" + TYPE_SUBTYPE_SEPARATOR + "' was found in format '" + format
+          + "'.");
     }
   }
 
@@ -306,10 +319,12 @@ public class ContentType {
    * 
    * The <code>Media Type</code> format can be used as
    * <code>HTTP Accept HEADER</code> format as defined in <code>RFC 2616 chapter 14.1</code>
-   * and 
+   * and
    * <code>HTTP Content-Type HEADER</code> format as defined in <code>RFC 2616 chapter 14.17</code>.
-   * The {@link ContentType} with {@link ODataFormat#CUSTOM} can only be used as <code>$format</code> system query option 
-   * (as defined http://www.odata.org/documentation/odata-v2-documentation/uri-conventions/#47_Format_System_Query_Option_format).
+   * The {@link ContentType} with {@link ODataFormat#CUSTOM} can only be used as <code>$format</code> system query
+   * option
+   * (as defined
+   * http://www.odata.org/documentation/odata-v2-documentation/uri-conventions/#47_Format_System_Query_Option_format).
    * 
    * @param format a string in format as defined in <code>RFC 2616 section 3.7</code>
    * @return a new <code>ContentType</code> object
@@ -317,22 +332,23 @@ public class ContentType {
    */
   public static ContentType createAsCustom(final String format) {
     ContentType parsedContentType = parse(format);
-    if(parsedContentType == null) {
+    if (parsedContentType == null) {
       return new ContentType(format);
     }
     return parsedContentType;
   }
-  
+
   /**
    * Create a list of {@link ContentType} based on given input strings (<code>contentTypes</code>).
    * 
    * Supported format is <code>Media Type</code> format as defined in <code>RFC 2616 chapter 3.7</code>.
    * This format is used as
    * <code>HTTP Accept HEADER</code> format as defined in <code>RFC 2616 chapter 14.1</code>
-   * and 
+   * and
    * <code>HTTP Content-Type HEADER</code> format as defined in <code>RFC 2616 chapter 14.17</code>.
    * <p>
-   * If one of the given strings can not be parsed an exception is thrown (hence no list is returned with the parseable strings).
+   * If one of the given strings can not be parsed an exception is thrown (hence no list is returned with the parseable
+   * strings).
    * </p>
    * 
    * @param contentTypeStrings a list of strings in format as defined in <code>RFC 2616 section 3.7</code>
@@ -355,13 +371,16 @@ public class ContentType {
    * 
    * The <code>Media Type</code> format can be used as
    * <code>HTTP Accept HEADER</code> format as defined in <code>RFC 2616 chapter 14.1</code>
-   * and 
+   * and
    * <code>HTTP Content-Type HEADER</code> format as defined in <code>RFC 2616 chapter 14.17</code>.
-   * The {@link ContentType} with {@link ODataFormat#CUSTOM} can only be used as <code>$format</code> system query option 
-   * (as defined http://www.odata.org/documentation/odata-v2-documentation/uri-conventions/#47_Format_System_Query_Option_format).
-   * 
-   * @param contentTypeStrings a list of strings in format as defined in <code>RFC 2616 section 3.7</code> or 
-   * as defined http://www.odata.org/documentation/odata-v2-documentation/uri-conventions/#47_Format_System_Query_Option_format
+   * The {@link ContentType} with {@link ODataFormat#CUSTOM} can only be used as <code>$format</code> system query
+   * option
+   * (as defined
+   * http://www.odata.org/documentation/odata-v2-documentation/uri-conventions/#47_Format_System_Query_Option_format).
+   * 
+   * @param contentTypeStrings a list of strings in format as defined in <code>RFC 2616 section 3.7</code> or
+   * as defined
+   * http://www.odata.org/documentation/odata-v2-documentation/uri-conventions/#47_Format_System_Query_Option_format
    * @return a list of new <code>ContentType</code> object
    * @throws IllegalArgumentException if one of the given input string is not parseable this exceptions is thrown
    */
@@ -374,8 +393,8 @@ public class ContentType {
   }
 
   /**
-   * Parses the given input string (<code>format</code>) and returns created
-   * {@link ContentType} if input was valid or return <code>NULL</code> if
+   * Parses the given input string (<code>format</code>) and returns created {@link ContentType} if input was valid or
+   * return <code>NULL</code> if
    * input was not parseable.
    * 
    * For the definition of the supported format see {@link #create(String)}.
@@ -393,17 +412,17 @@ public class ContentType {
 
   /**
    * Sort given list (which must contains content type formated string) for their {@value #PARAMETER_Q} value
-   * as defined in <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">RFC 2616 section 4.1</a> and 
+   * as defined in <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">RFC 2616 section 4.1</a> and
    * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.9">RFC 2616 Section 3.9</a>.
    * 
    * <b>Attention:</b> For invalid values a {@value #PARAMETER_Q} value from <code>-1</code> is used for sorting.
    * 
    * @param toSort list which is sorted and hence re-arranged
    */
-  public static void sortForQParameter(List<String> toSort) {
+  public static void sortForQParameter(final List<String> toSort) {
     Collections.sort(toSort, ContentType.Q_PARAMETER_COMPARATOR);
   }
-  
+
   /**
    * Map combination of type/subtype to corresponding {@link ODataFormat}.
    * 
@@ -428,10 +447,10 @@ public class ContentType {
   }
 
   /**
-   * Maps content of array into map. 
+   * Maps content of array into map.
    * Therefore it must be an combination of <code>key</code> followed by the <code>value</code> in the array.
    * 
-   * @param content content which is added to {@link Map}. 
+   * @param content content which is added to {@link Map}.
    * @return a new <code>ContentType</code> object
    */
   private static Map<String, String> parameterMap(final String... content) {
@@ -445,16 +464,16 @@ public class ContentType {
   }
 
   /**
-   * Valid input are <code>;</code> separated <code>key=value</code> pairs 
+   * Valid input are <code>;</code> separated <code>key=value</code> pairs
    * without spaces between key and value.
    * <b>Attention:</b> <code>q</code> parameter is validated but not added to result map
    * 
    * <p>
    * See RFC 2616:
-   * The type, subtype, and parameter attribute names are case-insensitive. 
-   * Parameter values might or might not be case-sensitive, depending on the 
-   * semantics of the parameter name. <b>Linear white space (LWS) MUST NOT be used 
-   * between the type and subtype, nor between an attribute and its value</b>. 
+   * The type, subtype, and parameter attribute names are case-insensitive.
+   * Parameter values might or might not be case-sensitive, depending on the
+   * semantics of the parameter name. <b>Linear white space (LWS) MUST NOT be used
+   * between the type and subtype, nor between an attribute and its value</b>.
    * </p>
    * 
    * @param parameters
@@ -469,12 +488,13 @@ public class ContentType {
         String key = keyValue[0].trim().toLowerCase(Locale.ENGLISH);
         String value = keyValue.length > 1 ? keyValue[1] : null;
         if (value != null && isLws(value.charAt(0))) {
-          throw new IllegalArgumentException("Value of parameter '" + key + "' starts with a LWS ('" + parameters + "').");
+          throw new IllegalArgumentException("Value of parameter '" + key + "' starts with a LWS ('" + parameters
+              + "').");
         }
-        if(PARAMETER_Q.equals(key.toLowerCase(Locale.US))) {
+        if (PARAMETER_Q.equals(key.toLowerCase(Locale.US))) {
           // q parameter is only validated but not added
-          if(!Q_PARAMETER_VALUE_PATTERN.matcher(value).matches()) {
-            throw new IllegalArgumentException("Value of 'q' parameter is not valid (q='" + value + "').");            
+          if (!Q_PARAMETER_VALUE_PATTERN.matcher(value).matches()) {
+            throw new IllegalArgumentException("Value of 'q' parameter is not valid (q='" + value + "').");
           }
         } else {
           parameterMap.put(key, value);
@@ -499,7 +519,7 @@ public class ContentType {
       for (String parameter : splittedParameters) {
         String[] keyValue = parameter.split(PARAMETER_KEY_VALUE_SEPARATOR);
         String key = keyValue[0].trim().toLowerCase(Locale.ENGLISH);
-        if(PARAMETER_Q.equalsIgnoreCase(key)) {
+        if (PARAMETER_Q.equalsIgnoreCase(key)) {
           String value = keyValue.length > 1 ? keyValue[1] : null;
           if (Q_PARAMETER_VALUE_PATTERN.matcher(value).matches()) {
             return Float.valueOf(value);
@@ -521,8 +541,9 @@ public class ContentType {
     return key != null && !PARAMETER_Q.equals(key.toLowerCase(Locale.US));
   }
 
-  /** 
-   * Validate if given character is a linear whitepace (includes <code>horizontal-tab, linefeed, carriage return and space</code>).
+  /**
+   * Validate if given character is a linear whitepace (includes <code>horizontal-tab, linefeed, carriage return and
+   * space</code>).
    * 
    * @param character to be checked
    * @return <code>true</code> if character is a LWS, otherwise <code>false</code>.
@@ -539,12 +560,12 @@ public class ContentType {
     }
   }
 
-
   /**
    * Ensure that charset parameter ({@link #PARAMETER_CHARSET}) is set on returned content type
-   * if this {@link ContentType} is a <code>odata text related</code> content type (@see {@link #isContentTypeODataTextRelated()}).
-   * If <code>this</code> {@link ContentType} has no charset parameter set a new {@link ContentType}
-   * with given <code>defaultCharset</code> is created.
+   * if this {@link ContentType} is a <code>odata text related</code> content type (@see
+   * {@link #isContentTypeODataTextRelated()}).
+   * If <code>this</code> {@link ContentType} has no charset parameter set a new {@link ContentType} with given
+   * <code>defaultCharset</code> is created.
    * Otherwise if charset parameter is already set nothing is done.
    * 
    * @param defaultCharset
@@ -592,10 +613,11 @@ public class ContentType {
   }
 
   /**
-   * {@link ContentType}s are equal 
+   * {@link ContentType}s are equal
    * <ul>
    * <li>if <code>type</code>, <code>subtype</code> and all <code>parameters</code> have the same value.</li>
-   * <li>if <code>type</code> and/or <code>subtype</code> is set to "*" (in such a case the <code>parameters</code> are ignored).</li>
+   * <li>if <code>type</code> and/or <code>subtype</code> is set to "*" (in such a case the <code>parameters</code> are
+   * ignored).</li>
    * </ul>
    * 
    * @return <code>true</code> if both instances are equal (see definition above), otherwise <code>false</code>.
@@ -638,12 +660,13 @@ public class ContentType {
   }
 
   /**
-   * {@link ContentType}s are <b>compatible</b> 
+   * {@link ContentType}s are <b>compatible</b>
    * <ul>
    * <li>if <code>type</code>, <code>subtype</code> have the same value.</li>
    * <li>if <code>type</code> and/or <code>subtype</code> is set to "*"</li>
    * </ul>
-   * The set <code>parameters</code> are <b>always</b> ignored (for compare with parameters see {@link #equals(Object)}).
+   * The set <code>parameters</code> are <b>always</b> ignored (for compare with parameters see {@link #equals(Object)}
+   * ).
    * 
    * @return <code>true</code> if both instances are equal (see definition above), otherwise <code>false</code>.
    */
@@ -657,11 +680,12 @@ public class ContentType {
 
   /**
    * Check equal without parameters.
-   * It is possible that no decision about <code>equal/none equal</code> can be determined a <code>NULL</code> is returned.
+   * It is possible that no decision about <code>equal/none equal</code> can be determined a <code>NULL</code> is
+   * returned.
    * 
    * @param obj to checked object
-   * @return <code>true</code> if both instances are equal (see definition above), otherwise <code>false</code> 
-   *          or <code>NULL</code> if no decision about <code>equal/none equal</code> could be determined.
+   * @return <code>true</code> if both instances are equal (see definition above), otherwise <code>false</code>
+   * or <code>NULL</code> if no decision about <code>equal/none equal</code> could be determined.
    */
   private Boolean isEqualWithoutParameters(final Object obj) {
     // basic checks
@@ -683,7 +707,7 @@ public class ContentType {
         return false;
       }
     } else if (!subtype.equals(other.subtype)) {
-      if(other.subtype == null) {
+      if (other.subtype == null) {
         return false;
       } else if (!subtype.equals(MEDIA_TYPE_WILDCARD) && !other.subtype.equals(MEDIA_TYPE_WILDCARD)) {
         return false;
@@ -714,7 +738,8 @@ public class ContentType {
    * 
    * @param first first string
    * @param second second string
-   * @return <code>true</code> if both strings are equal (by ignoring the case), otherwise <code>false</code> is returned
+   * @return <code>true</code> if both strings are equal (by ignoring the case), otherwise <code>false</code> is
+   * returned
    */
   private static boolean areEqual(final String first, final String second) {
     if (first == null) {
@@ -728,19 +753,20 @@ public class ContentType {
   }
 
   /**
-   * Get {@link ContentType} as string as defined in RFC 2616 (http://www.ietf.org/rfc/rfc2616.txt - chapter 14.17: Content-Type)
+   * Get {@link ContentType} as string as defined in RFC 2616 (http://www.ietf.org/rfc/rfc2616.txt - chapter 14.17:
+   * Content-Type)
    * 
    * @return string representation of <code>ContentType</code> object
    */
   public String toContentTypeString() {
     StringBuilder sb = new StringBuilder();
-    
-    if(odataFormat == ODataFormat.CUSTOM && subtype == null) {
+
+    if (odataFormat == ODataFormat.CUSTOM && subtype == null) {
       sb.append(type);
     } else {
       sb.append(type).append(TYPE_SUBTYPE_SEPARATOR).append(subtype);
     }
-    
+
     for (String key : parameters.keySet()) {
       if (isParameterAllowed(key)) {
         String value = parameters.get(key);
@@ -761,13 +787,15 @@ public class ContentType {
 
   /**
    * Find best match between this {@link ContentType} and the {@link ContentType} in the list.
-   * If a match (this {@link ContentType} is equal to a {@link ContentType} in list) is found either this or the {@link ContentType}
-   * from the list is returned based on which {@link ContentType} has less "**" characters set 
+   * If a match (this {@link ContentType} is equal to a {@link ContentType} in list) is found either this or the
+   * {@link ContentType} from the list is returned based on which {@link ContentType} has less "**" characters set
    * (checked with {@link #compareWildcardCounts(ContentType)}.
-   * If no match (none {@link ContentType} in list is equal to this {@link ContentType}) is found <code>NULL</code> is returned.
+   * If no match (none {@link ContentType} in list is equal to this {@link ContentType}) is found <code>NULL</code> is
+   * returned.
    * 
    * @param toMatchContentTypes list of {@link ContentType}s which are matches against this {@link ContentType}
-   * @return best matched content type in list or <code>NULL</code> if none content type match to this content type instance
+   * @return best matched content type in list or <code>NULL</code> if none content type match to this content type
+   * instance
    */
   public ContentType match(final List<ContentType> toMatchContentTypes) {
     for (ContentType supportedContentType : toMatchContentTypes) {
@@ -783,14 +811,17 @@ public class ContentType {
   }
 
   /**
-   * Find best match between this {@link ContentType} and the {@link ContentType} in the list ignoring all set parameters.
-   * If a match (this {@link ContentType} is equal to a {@link ContentType} in list) is found either this or the {@link ContentType}
-   * from the list is returned based on which {@link ContentType} has less "**" characters set 
+   * Find best match between this {@link ContentType} and the {@link ContentType} in the list ignoring all set
+   * parameters.
+   * If a match (this {@link ContentType} is equal to a {@link ContentType} in list) is found either this or the
+   * {@link ContentType} from the list is returned based on which {@link ContentType} has less "**" characters set
    * (checked with {@link #compareWildcardCounts(ContentType)}.
-   * If no match (none {@link ContentType} in list is equal to this {@link ContentType}) is found <code>NULL</code> is returned.
+   * If no match (none {@link ContentType} in list is equal to this {@link ContentType}) is found <code>NULL</code> is
+   * returned.
    * 
    * @param toMatchContentTypes list of {@link ContentType}s which are matches against this {@link ContentType}
-   * @return best matched content type in list or <code>NULL</code> if none content type match to this content type instance
+   * @return best matched content type in list or <code>NULL</code> if none content type match to this content type
+   * instance
    */
   public ContentType matchCompatible(final List<ContentType> toMatchContentTypes) {
     for (ContentType supportedContentType : toMatchContentTypes) {
@@ -811,8 +842,8 @@ public class ContentType {
    * For more detail what a valid match is see {@link #matchCompatible(List)}.
    * 
    * @param toMatchContentTypes list of {@link ContentType}s which are matches against this {@link ContentType}
-   * @return <code>true</code> if a compatible content type was found in given list 
-   *          or <code>false</code> if none compatible content type match was found
+   * @return <code>true</code> if a compatible content type was found in given list
+   * or <code>false</code> if none compatible content type match was found
    */
   public boolean hasCompatible(final List<ContentType> toMatchContentTypes) {
     return matchCompatible(toMatchContentTypes) != null;
@@ -823,8 +854,8 @@ public class ContentType {
    * For more detail what a valid match is see {@link #match(List)}.
    * 
    * @param toMatchContentTypes list of {@link ContentType}s which are matches against this {@link ContentType}
-   * @return <code>true</code> if a matching content type was found in given list 
-   *          or <code>false</code> if none matching content type match was found
+   * @return <code>true</code> if a matching content type was found in given list
+   * or <code>false</code> if none matching content type match was found
    */
   public boolean hasMatch(final List<ContentType> toMatchContentTypes) {
     return match(toMatchContentTypes) != null;
@@ -887,10 +918,12 @@ public class ContentType {
    * 
    * For more detail in general see {@link #hasMatch(List)} and for what a valid match is see {@link #match(List)}.
    * 
-   * @param toMatch content type formated string (<code>toMatch</code>) for which is checked if a match exists in given list
-   * @param matchExamples list of {@link ContentType}s which are matches against content type formated string (<code>toMatch</code>)
-   * @return <code>true</code> if a matching content type was found in given list 
-   *          or <code>false</code> if none matching content type match was found
+   * @param toMatch content type formated string (<code>toMatch</code>) for which is checked if a match exists in given
+   * list
+   * @param matchExamples list of {@link ContentType}s which are matches against content type formated string
+   * (<code>toMatch</code>)
+   * @return <code>true</code> if a matching content type was found in given list
+   * or <code>false</code> if none matching content type match was found
    */
   public static boolean match(final String toMatch, final ContentType... matchExamples) {
     ContentType toMatchContentType = ContentType.create(toMatch);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Decoder.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Decoder.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Decoder.java
index ddf3586..c725a2f 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Decoder.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Decoder.java
@@ -1,20 +1,20 @@
 /*******************************************************************************
  * 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
+ * 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
+ * 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.
+ * 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.odata2.core.commons;
 
@@ -23,7 +23,7 @@ import java.io.UnsupportedEncodingException;
 /**
  * Decodes a Java String containing a percent-encoded UTF-8 String value
  * into a Java String (in its internal UTF-16 encoding).
- *  
+ * 
  */
 public class Decoder {
 
@@ -33,9 +33,9 @@ public class Decoder {
    * @param value the encoded String
    * @return the Java String
    * @throws IllegalArgumentException if value contains characters not representing UTF-8 bytes
-   *                                  or ends with an unfinished percent-encoded character
-   * @throws NumberFormatException    if the two characters after a percent character
-   *                                  are not hexadecimal digits
+   * or ends with an unfinished percent-encoded character
+   * @throws NumberFormatException if the two characters after a percent character
+   * are not hexadecimal digits
    */
   public static String decode(final String value) throws IllegalArgumentException, NumberFormatException {
     if (value == null) {
@@ -44,8 +44,8 @@ public class Decoder {
 
     // Use a tiny finite-state machine to handle decoding on byte level.
     // There are only three states:
-    //   -2: normal bytes
-    //   -1: a byte representing the percent character has been read
+    // -2: normal bytes
+    // -1: a byte representing the percent character has been read
     // >= 0: a byte representing the first half-byte of a percent-encoded byte has been read
     // The variable holding the state is also used to store the value of the first half-byte.
     byte[] result = new byte[value.length()];