You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2013/07/31 10:12:58 UTC

[13/22] eliminate checkstyle warnings

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraintTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraintTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraintTest.java
index b5a341a..2bad041 100644
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraintTest.java
+++ b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraintTest.java
@@ -30,10 +30,6 @@ import javax.persistence.JoinColumn;
 import javax.persistence.metamodel.Attribute;
 import javax.persistence.metamodel.ManagedType;
 
-import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
-
 import org.apache.olingo.odata2.api.edm.FullQualifiedName;
 import org.apache.olingo.odata2.api.edm.provider.Association;
 import org.apache.olingo.odata2.api.edm.provider.AssociationEnd;
@@ -44,6 +40,9 @@ import org.apache.olingo.odata2.processor.core.jpa.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.processor.core.jpa.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.processor.core.jpa.mock.model.JPAJavaMemberMock;
 import org.apache.olingo.odata2.processor.core.jpa.mock.model.JPAManagedTypeMock;
+import org.easymock.EasyMock;
+import org.junit.Before;
+import org.junit.Test;
 
 public class JPAEdmReferentialConstraintTest extends JPAEdmTestModelView {
 
@@ -53,10 +52,7 @@ public class JPAEdmReferentialConstraintTest extends JPAEdmTestModelView {
   @Before
   public void setUp() {
     objJPAEdmReferentialConstraintTest = new JPAEdmReferentialConstraintTest();
-    objJPAEdmReferentialConstraint = new JPAEdmReferentialConstraint(
-        objJPAEdmReferentialConstraintTest,
-        objJPAEdmReferentialConstraintTest,
-        objJPAEdmReferentialConstraintTest);
+    objJPAEdmReferentialConstraint = new JPAEdmReferentialConstraint(objJPAEdmReferentialConstraintTest, objJPAEdmReferentialConstraintTest, objJPAEdmReferentialConstraintTest);
     try {
       objJPAEdmReferentialConstraint.getBuilder().build();
     } catch (ODataJPAModelException e) {
@@ -81,17 +77,13 @@ public class JPAEdmReferentialConstraintTest extends JPAEdmTestModelView {
 
   @Test
   public void testGetEdmReferentialConstraint() {
-    assertNotNull(objJPAEdmReferentialConstraint
-        .getEdmReferentialConstraint());
+    assertNotNull(objJPAEdmReferentialConstraint.getEdmReferentialConstraint());
   }
 
   @Test
   public void testIsExistsTrue() {
     objJPAEdmReferentialConstraintTest = new JPAEdmReferentialConstraintTest();
-    objJPAEdmReferentialConstraint = new JPAEdmReferentialConstraint(
-        objJPAEdmReferentialConstraintTest,
-        objJPAEdmReferentialConstraintTest,
-        objJPAEdmReferentialConstraintTest);
+    objJPAEdmReferentialConstraint = new JPAEdmReferentialConstraint(objJPAEdmReferentialConstraintTest, objJPAEdmReferentialConstraintTest, objJPAEdmReferentialConstraintTest);
     try {
       objJPAEdmReferentialConstraint.getBuilder().build();
       objJPAEdmReferentialConstraint.getBuilder().build();
@@ -105,21 +97,15 @@ public class JPAEdmReferentialConstraintTest extends JPAEdmTestModelView {
 
   @Test
   public void testGetRelationShipName() {
-    assertEquals("Assoc_SalesOrderHeader_SalesOrderItem",
-        objJPAEdmReferentialConstraint.getEdmRelationShipName());
+    assertEquals("Assoc_SalesOrderHeader_SalesOrderItem", objJPAEdmReferentialConstraint.getEdmRelationShipName());
   }
 
   @Override
   public Association getEdmAssociation() {
     Association association = new Association();
     association.setName("Assoc_SalesOrderHeader_SalesOrderItem");
-    association.setEnd1(new AssociationEnd().setType(
-        new FullQualifiedName("salesorderprocessing", "String"))
-        .setRole("SalesOrderHeader"));
-    association.setEnd2(new AssociationEnd()
-        .setType(
-            new FullQualifiedName("salesorderprocessing",
-                "SalesOrderItem")).setRole("SalesOrderItem"));
+    association.setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "String")).setRole("SalesOrderHeader"));
+    association.setEnd2(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem")).setRole("SalesOrderItem"));
     return association;
   }
 
@@ -134,8 +120,7 @@ public class JPAEdmReferentialConstraintTest extends JPAEdmTestModelView {
   }
 
   @SuppressWarnings("hiding")
-  private class AttributeMock<Object, String> extends
-      JPAAttributeMock<Object, String> {
+  private class AttributeMock<Object, String> extends JPAAttributeMock<Object, String> {
 
     @Override
     public Member getJavaMember() {
@@ -175,8 +160,7 @@ public class JPAEdmReferentialConstraintTest extends JPAEdmTestModelView {
     @Override
     public <T extends Annotation> T getAnnotation(final Class<T> annotationClass) {
       JoinColumn joinColumn = EasyMock.createMock(JoinColumn.class);
-      EasyMock.expect(joinColumn.referencedColumnName())
-          .andReturn("SOID");
+      EasyMock.expect(joinColumn.referencedColumnName()).andReturn("SOID");
       EasyMock.expect(joinColumn.name()).andReturn("SOID");
 
       EasyMock.replay(joinColumn);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmSchemaTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmSchemaTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmSchemaTest.java
index d3936b0..5fec2e7 100644
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmSchemaTest.java
+++ b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmSchemaTest.java
@@ -26,11 +26,10 @@ import static org.junit.Assert.assertTrue;
 
 import javax.persistence.metamodel.Metamodel;
 
-import org.junit.Before;
-import org.junit.Test;
-
 import org.apache.olingo.odata2.processor.api.jpa.access.JPAEdmBuilder;
 import org.apache.olingo.odata2.processor.core.jpa.mock.model.JPAMetaModelMock;
+import org.junit.Before;
+import org.junit.Test;
 
 public class JPAEdmSchemaTest extends JPAEdmTestModelView {
   private JPAEdmSchemaTest objJPAEdmSchemaTest;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmTestModelView.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmTestModelView.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmTestModelView.java
index 18f77b2..e5c8d39 100644
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmTestModelView.java
+++ b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmTestModelView.java
@@ -59,12 +59,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmPropertyView;
 import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmReferentialConstraintView;
 import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
 
-public class JPAEdmTestModelView implements JPAEdmAssociationEndView,
-    JPAEdmAssociationSetView, JPAEdmAssociationView, JPAEdmBaseView,
-    JPAEdmComplexPropertyView, JPAEdmComplexTypeView,
-    JPAEdmEntityContainerView, JPAEdmEntitySetView, JPAEdmEntityTypeView,
-    JPAEdmKeyView, JPAEdmModelView, JPAEdmNavigationPropertyView,
-    JPAEdmPropertyView, JPAEdmReferentialConstraintView, JPAEdmSchemaView {
+public class JPAEdmTestModelView implements JPAEdmAssociationEndView, JPAEdmAssociationSetView, JPAEdmAssociationView, JPAEdmBaseView, JPAEdmComplexPropertyView, JPAEdmComplexTypeView, JPAEdmEntityContainerView, JPAEdmEntitySetView, JPAEdmEntityTypeView, JPAEdmKeyView, JPAEdmModelView, JPAEdmNavigationPropertyView, JPAEdmPropertyView, JPAEdmReferentialConstraintView, JPAEdmSchemaView {
 
   protected JPAEdmMappingModelAccess mappingModelAccess;
 
@@ -304,8 +299,7 @@ public class JPAEdmTestModelView implements JPAEdmAssociationEndView,
   }
 
   @Override
-  public void addJPAEdmNavigationPropertyView(
-      final JPAEdmNavigationPropertyView view) {
+  public void addJPAEdmNavigationPropertyView(final JPAEdmNavigationPropertyView view) {
 
   }
 
@@ -320,8 +314,7 @@ public class JPAEdmTestModelView implements JPAEdmAssociationEndView,
   }
 
   @Override
-  public void expandEdmComplexType(final ComplexType complexType,
-      final List<Property> expandedPropertyList, final String embeddablePropertyName) {
+  public void expandEdmComplexType(final ComplexType complexType, final List<Property> expandedPropertyList, final String embeddablePropertyName) {
 
   }
 
@@ -354,15 +347,13 @@ public class JPAEdmTestModelView implements JPAEdmAssociationEndView,
   }
 
   @Override
-  public void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
-      final JPAEdmAssociationEndView associationEndView) {
+  public void addJPAEdmAssociationView(final JPAEdmAssociationView associationView, final JPAEdmAssociationEndView associationEndView) {
     // TODO Auto-generated method stub
 
   }
 
   @Override
-  public int getNumberOfAssociationsWithSimilarEndPoints(
-      final JPAEdmAssociationEndView view) {
+  public int getNumberOfAssociationsWithSimilarEndPoints(final JPAEdmAssociationEndView view) {
     // TODO Auto-generated method stub
     return 0;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java
index 63ced0f..56b0fab 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java
@@ -103,8 +103,7 @@ public class ODataRequestHandler {
       final UriType uriType = uriInfo.getUriType();
       validateMethodAndUri(method, uriInfo);
 
-      if (method == ODataHttpMethod.POST || method == ODataHttpMethod.PUT
-          || method == ODataHttpMethod.PATCH || method == ODataHttpMethod.MERGE) {
+      if (method == ODataHttpMethod.POST || method == ODataHttpMethod.PUT || method == ODataHttpMethod.PATCH || method == ODataHttpMethod.MERGE) {
         checkRequestContentType(uriInfo, request.getContentType());
       }
 
@@ -126,14 +125,12 @@ public class ODataRequestHandler {
 
     } catch (final Exception e) {
       exception = e;
-      odataResponse = new ODataExceptionWrapper(context, request.getQueryParameters(), request.getAcceptHeaders())
-          .wrapInExceptionResponse(e);
+      odataResponse = new ODataExceptionWrapper(context, request.getQueryParameters(), request.getAcceptHeaders()).wrapInExceptionResponse(e);
     }
     context.stopRuntimeMeasurement(timingHandle);
 
     final String debugValue = getDebugValue(context, request.getQueryParameters());
-    return debugValue == null ?
-        odataResponse : new ODataDebugResponseWrapper(context, odataResponse, uriInfo, exception, debugValue).wrapResponse();
+    return debugValue == null ? odataResponse : new ODataDebugResponseWrapper(context, odataResponse, uriInfo, exception, debugValue).wrapResponse();
   }
 
   private String getServerDataServiceVersion() throws ODataException {
@@ -187,28 +184,20 @@ public class ODataRequestHandler {
     case URI2:
     case URI6A:
     case URI7A:
-      if (method != ODataHttpMethod.GET
-          && method != ODataHttpMethod.PUT
-          && method != ODataHttpMethod.DELETE
-          && method != ODataHttpMethod.PATCH && method != ODataHttpMethod.MERGE) {
+      if (method != ODataHttpMethod.GET && method != ODataHttpMethod.PUT && method != ODataHttpMethod.DELETE && method != ODataHttpMethod.PATCH && method != ODataHttpMethod.MERGE) {
         throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
       }
       break;
 
     case URI3:
-      if (method != ODataHttpMethod.GET
-          && method != ODataHttpMethod.PUT
-          && method != ODataHttpMethod.PATCH && method != ODataHttpMethod.MERGE) {
+      if (method != ODataHttpMethod.GET && method != ODataHttpMethod.PUT && method != ODataHttpMethod.PATCH && method != ODataHttpMethod.MERGE) {
         throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
       }
       break;
 
     case URI4:
     case URI5:
-      if (method != ODataHttpMethod.GET
-          && method != ODataHttpMethod.PUT
-          && method != ODataHttpMethod.DELETE
-          && method != ODataHttpMethod.PATCH && method != ODataHttpMethod.MERGE) {
+      if (method != ODataHttpMethod.GET && method != ODataHttpMethod.PUT && method != ODataHttpMethod.DELETE && method != ODataHttpMethod.PATCH && method != ODataHttpMethod.MERGE) {
         throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
       } else if (method == ODataHttpMethod.DELETE && !uriInfo.isValue()) {
         throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
@@ -229,9 +218,7 @@ public class ODataRequestHandler {
       break;
 
     case URI17:
-      if (method != ODataHttpMethod.GET
-          && method != ODataHttpMethod.PUT
-          && method != ODataHttpMethod.DELETE) {
+      if (method != ODataHttpMethod.GET && method != ODataHttpMethod.PUT && method != ODataHttpMethod.DELETE) {
         throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
       }
       break;
@@ -242,9 +229,7 @@ public class ODataRequestHandler {
   }
 
   private static void checkFunctionImport(final ODataHttpMethod method, final UriInfoImpl uriInfo) throws ODataException {
-    if (uriInfo.getFunctionImport() != null
-        && uriInfo.getFunctionImport().getHttpMethod() != null
-        && !uriInfo.getFunctionImport().getHttpMethod().equals(method.toString())) {
+    if (uriInfo.getFunctionImport() != null && uriInfo.getFunctionImport().getHttpMethod() != null && !uriInfo.getFunctionImport().getHttpMethod().equals(method.toString())) {
       throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
     }
   }
@@ -253,23 +238,13 @@ public class ODataRequestHandler {
     switch (uriInfo.getUriType()) {
     case URI1:
     case URI6B:
-      if (uriInfo.getFormat() != null
-          || uriInfo.getFilter() != null
-          || uriInfo.getInlineCount() != null
-          || uriInfo.getOrderBy() != null
-          || uriInfo.getSkipToken() != null
-          || uriInfo.getSkip() != null
-          || uriInfo.getTop() != null
-          || !uriInfo.getExpand().isEmpty()
-          || !uriInfo.getSelect().isEmpty()) {
+      if (uriInfo.getFormat() != null || uriInfo.getFilter() != null || uriInfo.getInlineCount() != null || uriInfo.getOrderBy() != null || uriInfo.getSkipToken() != null || uriInfo.getSkip() != null || uriInfo.getTop() != null || !uriInfo.getExpand().isEmpty() || !uriInfo.getSelect().isEmpty()) {
         throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
       }
       break;
 
     case URI2:
-      if (uriInfo.getFormat() != null
-          || !uriInfo.getExpand().isEmpty()
-          || !uriInfo.getSelect().isEmpty()) {
+      if (uriInfo.getFormat() != null || !uriInfo.getExpand().isEmpty() || !uriInfo.getSelect().isEmpty()) {
         throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
       }
       if (method == ODataHttpMethod.DELETE) {
@@ -301,13 +276,7 @@ public class ODataRequestHandler {
       break;
 
     case URI7B:
-      if (uriInfo.getFormat() != null
-          || uriInfo.getFilter() != null
-          || uriInfo.getInlineCount() != null
-          || uriInfo.getOrderBy() != null
-          || uriInfo.getSkipToken() != null
-          || uriInfo.getSkip() != null
-          || uriInfo.getTop() != null) {
+      if (uriInfo.getFormat() != null || uriInfo.getFilter() != null || uriInfo.getInlineCount() != null || uriInfo.getOrderBy() != null || uriInfo.getSkipToken() != null || uriInfo.getSkip() != null || uriInfo.getTop() != null) {
         throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
       }
       break;
@@ -349,9 +318,7 @@ public class ODataRequestHandler {
   }
 
   private static void checkProperty(final ODataHttpMethod method, final UriInfoImpl uriInfo) throws ODataException {
-    if ((uriInfo.getUriType() == UriType.URI4 || uriInfo.getUriType() == UriType.URI5)
-        && (isPropertyKey(uriInfo)
-        || method == ODataHttpMethod.DELETE && !isPropertyNullable(getProperty(uriInfo)))) {
+    if ((uriInfo.getUriType() == UriType.URI4 || uriInfo.getUriType() == UriType.URI5) && (isPropertyKey(uriInfo) || method == ODataHttpMethod.DELETE && !isPropertyNullable(getProperty(uriInfo)))) {
       throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH);
     }
   }
@@ -384,18 +351,15 @@ public class ODataRequestHandler {
 
     // Don't check the request content type for function imports
     // because the request body is not used at all.
-    if (processorFeature == FunctionImportProcessor.class
-        || processorFeature == FunctionImportValueProcessor.class) {
+    if (processorFeature == FunctionImportProcessor.class || processorFeature == FunctionImportValueProcessor.class) {
       return;
     }
 
     // Adjust processor feature.
     if (processorFeature == EntitySetProcessor.class) {
-      processorFeature = uriInfo.getTargetEntitySet().getEntityType().hasStream() ?
-          EntityMediaProcessor.class : // A media resource can have any type.
+      processorFeature = uriInfo.getTargetEntitySet().getEntityType().hasStream() ? EntityMediaProcessor.class : // A media resource can have any type.
           EntityProcessor.class; // The request must contain a single entity!
-    } else if (processorFeature == EntityLinksProcessor.class)
-    {
+    } else if (processorFeature == EntityLinksProcessor.class) {
       processorFeature = EntityLinkProcessor.class; // The request must contain a single link!
     }
 
@@ -405,10 +369,7 @@ public class ODataRequestHandler {
     }
 
     // Get list of supported content types based on processor feature.
-    final List<ContentType> supportedContentTypes =
-        processorFeature == EntitySimplePropertyValueProcessor.class ?
-            getSupportedContentTypes(getProperty(uriInfo)) :
-            getSupportedContentTypes(processorFeature);
+    final List<ContentType> supportedContentTypes = processorFeature == EntitySimplePropertyValueProcessor.class ? getSupportedContentTypes(getProperty(uriInfo)) : getSupportedContentTypes(processorFeature);
 
     if (!hasMatchingContentType(parsedContentType, supportedContentTypes)) {
       throw new ODataUnsupportedMediaTypeException(ODataUnsupportedMediaTypeException.NOT_SUPPORTED.addContent(parsedContentType));
@@ -431,9 +392,7 @@ public class ODataRequestHandler {
   }
 
   private static List<ContentType> getSupportedContentTypes(final EdmProperty property) throws EdmException {
-    return property.getType() == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance() ?
-        Arrays.asList(property.getMimeType() == null ? ContentType.WILDCARD : ContentType.create(property.getMimeType())) :
-        Arrays.asList(ContentType.TEXT_PLAIN, ContentType.TEXT_PLAIN_CS_UTF_8);
+    return property.getType() == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance() ? Arrays.asList(property.getMimeType() == null ? ContentType.WILDCARD : ContentType.create(property.getMimeType())) : Arrays.asList(ContentType.TEXT_PLAIN, ContentType.TEXT_PLAIN_CS_UTF_8);
   }
 
   private List<String> getSupportedContentTypes(final UriInfoImpl uriInfo) throws ODataException {
@@ -450,7 +409,6 @@ public class ODataRequestHandler {
 
   private static String getQueryDebugValue(final Map<String, String> queryParameters) {
     final String debugValue = queryParameters.get(ODataDebugResponseWrapper.ODATA_DEBUG_QUERY_PARAMETER);
-    return ODataDebugResponseWrapper.ODATA_DEBUG_JSON.equals(debugValue) ?
-        debugValue : null;
+    return ODataDebugResponseWrapper.ODATA_DEBUG_JSON.equals(debugValue) ? debugValue : null;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/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 0b4e6bd..4c0ae32 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
@@ -209,71 +209,56 @@ public class BatchRequestParser {
 
   private ODataRequest parseRequest(final Scanner scanner, final boolean isChangeSet) throws BatchException {
     try {
-    ODataRequest request;
-    if (scanner.hasNext(REG_EX_REQUEST_LINE)) {
-      scanner.next(REG_EX_REQUEST_LINE);
-      currentLineNumber++;
-      String method = null;
-      String uri = null;
-      MatchResult result = scanner.match();
-      if (result.groupCount() == 2) {
-        method = result.group(1);
-        uri = result.group(2).trim();
-      } else {
+      ODataRequest request;
+      if (scanner.hasNext(REG_EX_REQUEST_LINE)) {
+        scanner.next(REG_EX_REQUEST_LINE);
         currentLineNumber++;
-        throw new BatchException(BatchException.INVALID_REQUEST_LINE.addContent(scanner.next()).addContent(currentLineNumber));
-      }
-      PathInfo pathInfo = parseRequestUri(uri);
-      Map<String, String> queryParameters = parseQueryParameters(uri);
-      if (isChangeSet) {
-        if (!HTTP_CHANGESET_METHODS.contains(method)) {
-          throw new BatchException(BatchException.INVALID_CHANGESET_METHOD.addContent(currentLineNumber));
+        String method = null;
+        String uri = null;
+        MatchResult result = scanner.match();
+        if (result.groupCount() == 2) {
+          method = result.group(1);
+          uri = result.group(2).trim();
+        } else {
+          currentLineNumber++;
+          throw new BatchException(BatchException.INVALID_REQUEST_LINE.addContent(scanner.next()).addContent(currentLineNumber));
+        }
+        PathInfo pathInfo = parseRequestUri(uri);
+        Map<String, String> queryParameters = parseQueryParameters(uri);
+        if (isChangeSet) {
+          if (!HTTP_CHANGESET_METHODS.contains(method)) {
+            throw new BatchException(BatchException.INVALID_CHANGESET_METHOD.addContent(currentLineNumber));
+          }
+        } else if (!HTTP_BATCH_METHODS.contains(method)) {
+          throw new BatchException(BatchException.INVALID_QUERY_OPERATION_METHOD.addContent(currentLineNumber));
+        }
+        ODataHttpMethod httpMethod = ODataHttpMethod.valueOf(method);
+        Map<String, List<String>> headers = parseRequestHeaders(scanner);
+        if (currentMimeHeaderContentId != null) {
+          List<String> headerList = new ArrayList<String>();
+          headerList.add(currentMimeHeaderContentId);
+          headers.put(BatchConstants.MIME_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH), headerList);
         }
-      } else if (!HTTP_BATCH_METHODS.contains(method)) {
-        throw new BatchException(BatchException.INVALID_QUERY_OPERATION_METHOD.addContent(currentLineNumber));
-      }
-      ODataHttpMethod httpMethod = ODataHttpMethod.valueOf(method);
-      Map<String, List<String>> headers = parseRequestHeaders(scanner);
-      if (currentMimeHeaderContentId != null) {
-        List<String> headerList = new ArrayList<String>();
-        headerList.add(currentMimeHeaderContentId);
-        headers.put(BatchConstants.MIME_HEADER_CONTENT_ID.toLowerCase(Locale.ENGLISH), headerList);
-      }
 
-      String contentType = getContentTypeHeader(headers);
-      List<String> acceptHeaders = getAcceptHeader(headers);
-      List<Locale> acceptLanguages = getAcceptLanguageHeader(headers);
-      parseNewLine(scanner);
-      InputStream body;
+        String contentType = getContentTypeHeader(headers);
+        List<String> acceptHeaders = getAcceptHeader(headers);
+        List<Locale> acceptLanguages = getAcceptLanguageHeader(headers);
+        parseNewLine(scanner);
+        InputStream body;
         body = new ByteArrayInputStream("".getBytes("UTF-8"));
-      if (isChangeSet) {
-        body = parseBody(scanner);
-      }
-      if (contentType != null) {
-        request = ODataRequest.method(httpMethod)
-            .queryParameters(queryParameters)
-            .requestHeaders(headers)
-            .pathInfo(pathInfo)
-            .acceptableLanguages(acceptLanguages)
-            .contentType(contentType)
-            .body(body)
-            .acceptHeaders(acceptHeaders)
-            .build();
+        if (isChangeSet) {
+          body = parseBody(scanner);
+        }
+        if (contentType != null) {
+          request = ODataRequest.method(httpMethod).queryParameters(queryParameters).requestHeaders(headers).pathInfo(pathInfo).acceptableLanguages(acceptLanguages).contentType(contentType).body(body).acceptHeaders(acceptHeaders).build();
+        } else {
+          request = ODataRequest.method(httpMethod).queryParameters(queryParameters).requestHeaders(headers).pathInfo(pathInfo).acceptableLanguages(acceptLanguages).body(body).acceptHeaders(acceptHeaders).build();
+        }
       } else {
-        request = ODataRequest.method(httpMethod)
-            .queryParameters(queryParameters)
-            .requestHeaders(headers)
-            .pathInfo(pathInfo)
-            .acceptableLanguages(acceptLanguages)
-            .body(body)
-            .acceptHeaders(acceptHeaders)
-            .build();
+        currentLineNumber++;
+        throw new BatchException(BatchException.INVALID_REQUEST_LINE.addContent(scanner.next()).addContent(currentLineNumber));
       }
-    } else {
-      currentLineNumber++;
-      throw new BatchException(BatchException.INVALID_REQUEST_LINE.addContent(scanner.next()).addContent(currentLineNumber));
-    }
-    return request;
+      return request;
     } catch (UnsupportedEncodingException e) {
       throw new ODataRuntimeException(e);
     }
@@ -295,8 +280,7 @@ public class BatchRequestParser {
           } else if (HttpHeaders.ACCEPT_LANGUAGE.equalsIgnoreCase(headerName)) {
             List<String> acceptLanguageHeaders = parseAcceptableLanguages(headerValue);
             headers.put(headerName, acceptLanguageHeaders);
-          }
-          else if (!BatchConstants.HTTP_CONTENT_ID.equalsIgnoreCase(headerName)) {
+          } else if (!BatchConstants.HTTP_CONTENT_ID.equalsIgnoreCase(headerName)) {
             if (headers.containsKey(headerName)) {
               headers.get(headerName).add(headerValue);
             } else {
@@ -405,26 +389,26 @@ public class BatchRequestParser {
 
   private InputStream parseBody(final Scanner scanner) {
     try {
-    String body = null;
-    InputStream requestBody;
-    while (scanner.hasNext() && !scanner.hasNext(REG_EX_ANY_BOUNDARY_STRING)) {
-      if (!scanner.hasNext(REG_EX_ZERO_OR_MORE_WHITESPACES)) {
-        if (body == null) {
-          body = scanner.next();
+      String body = null;
+      InputStream requestBody;
+      while (scanner.hasNext() && !scanner.hasNext(REG_EX_ANY_BOUNDARY_STRING)) {
+        if (!scanner.hasNext(REG_EX_ZERO_OR_MORE_WHITESPACES)) {
+          if (body == null) {
+            body = scanner.next();
+          } else {
+            body = body + LF + scanner.next();
+          }
         } else {
-          body = body + LF + scanner.next();
+          scanner.next();
         }
-      } else {
-        scanner.next();
+        currentLineNumber++;
       }
-      currentLineNumber++;
-    }
-    if (body != null) {
+      if (body != null) {
         requestBody = new ByteArrayInputStream(body.getBytes("UTF-8"));
-    } else {
-      requestBody = new ByteArrayInputStream("".getBytes("UTF-8"));
-    }
-    return requestBody;
+      } else {
+        requestBody = new ByteArrayInputStream("".getBytes("UTF-8"));
+      }
+      return requestBody;
     } catch (UnsupportedEncodingException e) {
       throw new ODataRuntimeException(e);
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Encoder.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Encoder.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Encoder.java
index 5cd6bf2..22f6cfd 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Encoder.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/commons/Encoder.java
@@ -53,40 +53,8 @@ public class Encoder {
   private final static String GEN_DELIMS = ":/?#[]@";
   // RFC 3986 says: "For consistency, URI producers and normalizers should
   // use uppercase hexadecimal digits for all percent-encodings."
-  private final static String[] hex = {
-      "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
-      "%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F",
-      "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
-      "%18", "%19", "%1A", "%1B", "%1C", "%1D", "%1E", "%1F",
-      "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27",
-      "%28", "%29", "%2A", "%2B", "%2C", "%2D", "%2E", "%2F",
-      "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37",
-      "%38", "%39", "%3A", "%3B", "%3C", "%3D", "%3E", "%3F",
-      "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47",
-      "%48", "%49", "%4A", "%4B", "%4C", "%4D", "%4E", "%4F",
-      "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57",
-      "%58", "%59", "%5A", "%5B", "%5C", "%5D", "%5E", "%5F",
-      "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67",
-      "%68", "%69", "%6A", "%6B", "%6C", "%6D", "%6E", "%6F",
-      "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77",
-      "%78", "%79", "%7A", "%7B", "%7C", "%7D", "%7E", "%7F",
-      "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87",
-      "%88", "%89", "%8A", "%8B", "%8C", "%8D", "%8E", "%8F",
-      "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97",
-      "%98", "%99", "%9A", "%9B", "%9C", "%9D", "%9E", "%9F",
-      "%A0", "%A1", "%A2", "%A3", "%A4", "%A5", "%A6", "%A7",
-      "%A8", "%A9", "%AA", "%AB", "%AC", "%AD", "%AE", "%AF",
-      "%B0", "%B1", "%B2", "%B3", "%B4", "%B5", "%B6", "%B7",
-      "%B8", "%B9", "%BA", "%BB", "%BC", "%BD", "%BE", "%BF",
-      "%C0", "%C1", "%C2", "%C3", "%C4", "%C5", "%C6", "%C7",
-      "%C8", "%C9", "%CA", "%CB", "%CC", "%CD", "%CE", "%CF",
-      "%D0", "%D1", "%D2", "%D3", "%D4", "%D5", "%D6", "%D7",
-      "%D8", "%D9", "%DA", "%DB", "%DC", "%DD", "%DE", "%DF",
-      "%E0", "%E1", "%E2", "%E3", "%E4", "%E5", "%E6", "%E7",
-      "%E8", "%E9", "%EA", "%EB", "%EC", "%ED", "%EE", "%EF",
-      "%F0", "%F1", "%F2", "%F3", "%F4", "%F5", "%F6", "%F7",
-      "%F8", "%F9", "%FA", "%FB", "%FC", "%FD", "%FE", "%FF"
-  };
+  private final static String[] hex = { "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", "%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F", "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17", "%18", "%19", "%1A", "%1B", "%1C", "%1D", "%1E", "%1F", "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27", "%28", "%29", "%2A", "%2B", "%2C", "%2D", "%2E", "%2F", "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37", "%38", "%39", "%3A", "%3B", "%3C", "%3D", "%3E", "%3F", "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47", "%48", "%49", "%4A", "%4B", "%4C", "%4D", "%4E", "%4F", "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57", "%58", "%59", "%5A", "%5B", "%5C", "%5D", "%5E", "%5F", "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67", "%68", "%69", "%6A", "%6B", "%6C", "%6D", "%6E", "%6F", "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77", "%78", "%79", "%7A", "%7B", "%7C", "%7D", "%7E", "%7F", "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87", "%88"
 ,
+      "%89", "%8A", "%8B", "%8C", "%8D", "%8E", "%8F", "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97", "%98", "%99", "%9A", "%9B", "%9C", "%9D", "%9E", "%9F", "%A0", "%A1", "%A2", "%A3", "%A4", "%A5", "%A6", "%A7", "%A8", "%A9", "%AA", "%AB", "%AC", "%AD", "%AE", "%AF", "%B0", "%B1", "%B2", "%B3", "%B4", "%B5", "%B6", "%B7", "%B8", "%B9", "%BA", "%BB", "%BC", "%BD", "%BE", "%BF", "%C0", "%C1", "%C2", "%C3", "%C4", "%C5", "%C6", "%C7", "%C8", "%C9", "%CA", "%CB", "%CC", "%CD", "%CE", "%CF", "%D0", "%D1", "%D2", "%D3", "%D4", "%D5", "%D6", "%D7", "%D8", "%D9", "%DA", "%DB", "%DC", "%DD", "%DE", "%DF", "%E0", "%E1", "%E2", "%E3", "%E4", "%E5", "%E6", "%E7", "%E8", "%E9", "%EA", "%EB", "%EC", "%ED", "%EE", "%EF", "%F0", "%F1", "%F2", "%F3", "%F4", "%F5", "%F6", "%F7", "%F8", "%F9", "%FA", "%FB", "%FC", "%FD", "%FE", "%FF" };
 
   private static final Encoder encoder = new Encoder(ODATA_UNENCODED);
 
@@ -124,8 +92,7 @@ public class Encoder {
           resultStr.append(character);
         } else if (utf8Byte >= 0) {
           resultStr.append(hex[utf8Byte]);
-        }
-        else {
+        } else {
           // case UTF-8 continuation byte
           resultStr.append(hex[256 + utf8Byte]); // index adjusted for the usage of signed bytes
         }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
index c622437..89bfe94 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
@@ -245,8 +245,7 @@ public class FilterParserImpl implements FilterParser {
       if ((expression == null) && (expectAnotherExpression == true)) {
         //Tested with TestParserExceptions.TestPMreadParameters CASE 4 e.g. "$filter=concat(,"
         throw FilterParserExceptionImpl.createEXPRESSION_EXPECTED_AFTER_POS(token, curExpression);
-      } else if (expression != null) //parameter list may be empty
-      {
+      } else if (expression != null) {//parameter list may be empty
         methodExpression.appendParameter(expression);
       }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java
index a19ccd2..4289bc5 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java
@@ -59,13 +59,7 @@ public class JsonVisitor implements ExpressionVisitor {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject()
-          .namedStringValueRaw("nodeType", binaryExpression.getKind().toString()).separator()
-          .namedStringValue("operator", operator.toUriLiteral()).separator()
-          .namedStringValueRaw("type", getType(binaryExpression)).separator()
-          .name("left").unquotedValue(leftSide.toString()).separator()
-          .name("right").unquotedValue(rightSide.toString())
-          .endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", binaryExpression.getKind().toString()).separator().namedStringValue("operator", operator.toUriLiteral()).separator().namedStringValueRaw("type", getType(binaryExpression)).separator().name("left").unquotedValue(leftSide.toString()).separator().name("right").unquotedValue(rightSide.toString()).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
@@ -78,10 +72,7 @@ public class JsonVisitor implements ExpressionVisitor {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject()
-          .namedStringValueRaw("nodeType", "order collection").separator()
-          .name("orders")
-          .beginArray();
+      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", "order collection").separator().name("orders").beginArray();
       boolean first = true;
       for (final Object order : orders) {
         if (first) {
@@ -91,8 +82,7 @@ public class JsonVisitor implements ExpressionVisitor {
         }
         jsonStreamWriter.unquotedValue(order.toString());
       }
-      jsonStreamWriter.endArray()
-          .endObject();
+      jsonStreamWriter.endArray().endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
@@ -105,11 +95,7 @@ public class JsonVisitor implements ExpressionVisitor {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject()
-          .namedStringValueRaw("nodeType", orderExpression.getKind().toString()).separator()
-          .namedStringValueRaw("sortorder", sortOrder.toString()).separator()
-          .name("expression").unquotedValue(filterResult.toString())
-          .endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", orderExpression.getKind().toString()).separator().namedStringValueRaw("sortorder", sortOrder.toString()).separator().name("expression").unquotedValue(filterResult.toString()).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
@@ -122,11 +108,7 @@ public class JsonVisitor implements ExpressionVisitor {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject()
-          .namedStringValueRaw("nodeType", literal.getKind().toString()).separator()
-          .namedStringValueRaw("type", getType(literal)).separator()
-          .namedStringValue("value", edmLiteral.getLiteral())
-          .endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", literal.getKind().toString()).separator().namedStringValueRaw("type", getType(literal)).separator().namedStringValue("value", edmLiteral.getLiteral()).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
@@ -139,12 +121,7 @@ public class JsonVisitor implements ExpressionVisitor {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject()
-          .namedStringValueRaw("nodeType", methodExpression.getKind().toString()).separator()
-          .namedStringValueRaw("operator", method.toUriLiteral()).separator()
-          .namedStringValueRaw("type", getType(methodExpression)).separator()
-          .name("parameters")
-          .beginArray();
+      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", methodExpression.getKind().toString()).separator().namedStringValueRaw("operator", method.toUriLiteral()).separator().namedStringValueRaw("type", getType(methodExpression)).separator().name("parameters").beginArray();
       boolean first = true;
       for (Object parameter : parameters) {
         if (first) {
@@ -154,8 +131,7 @@ public class JsonVisitor implements ExpressionVisitor {
         }
         jsonStreamWriter.unquotedValue(parameter.toString());
       }
-      jsonStreamWriter.endArray()
-          .endObject();
+      jsonStreamWriter.endArray().endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
@@ -168,12 +144,7 @@ public class JsonVisitor implements ExpressionVisitor {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject()
-          .namedStringValueRaw("nodeType", memberExpression.getKind().toString()).separator()
-          .namedStringValueRaw("type", getType(memberExpression)).separator()
-          .name("source").unquotedValue(path.toString()).separator()
-          .name("path").unquotedValue(property.toString())
-          .endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", memberExpression.getKind().toString()).separator().namedStringValueRaw("type", getType(memberExpression)).separator().name("source").unquotedValue(path.toString()).separator().name("path").unquotedValue(property.toString()).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
@@ -186,11 +157,7 @@ public class JsonVisitor implements ExpressionVisitor {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject()
-          .namedStringValueRaw("nodeType", propertyExpression.getKind().toString()).separator()
-          .namedStringValue("name", uriLiteral).separator()
-          .namedStringValueRaw("type", getType(propertyExpression))
-          .endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", propertyExpression.getKind().toString()).separator().namedStringValue("name", uriLiteral).separator().namedStringValueRaw("type", getType(propertyExpression)).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {
@@ -203,12 +170,7 @@ public class JsonVisitor implements ExpressionVisitor {
     try {
       StringWriter writer = new StringWriter();
       JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
-      jsonStreamWriter.beginObject()
-          .namedStringValueRaw("nodeType", unaryExpression.getKind().toString()).separator()
-          .namedStringValueRaw("operator", operator.toUriLiteral()).separator()
-          .namedStringValueRaw("type", getType(unaryExpression)).separator()
-          .name("operand").unquotedValue(operand.toString())
-          .endObject();
+      jsonStreamWriter.beginObject().namedStringValueRaw("nodeType", unaryExpression.getKind().toString()).separator().namedStringValueRaw("operator", operator.toUriLiteral()).separator().namedStringValueRaw("type", getType(unaryExpression)).separator().name("operand").unquotedValue(operand.toString()).endObject();
       writer.flush();
       return writer.toString();
     } catch (final IOException e) {