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 2014/04/16 16:36:11 UTC

[1/2] git commit: [OLINGO-235] reader option to switch off validation of facets

Repository: olingo-odata2
Updated Branches:
  refs/heads/master e1b6ead92 -> 74dff0f3a


[OLINGO-235] reader option to switch off validation of facets

Change-Id: Ie35a7b5ce4e72f0d21a546e35768a36718635f06

Signed-off-by: Stephan Klevenz <sk...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/2211ce41
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/2211ce41
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/2211ce41

Branch: refs/heads/master
Commit: 2211ce410c4bd2c45181037b931244ad6504efd9
Parents: e1b6ead
Author: Klaus Straubinger <kl...@sap.com>
Authored: Fri Apr 11 14:03:03 2014 +0200
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Wed Apr 16 16:28:30 2014 +0200

----------------------------------------------------------------------
 .../api/ep/EntityProviderReadProperties.java    |  19 +++-
 .../core/ep/consumer/JsonEntryConsumer.java     |  14 ++-
 .../core/ep/consumer/JsonPropertyConsumer.java  |  33 +++---
 .../core/ep/consumer/XmlEntityConsumer.java     |   5 +-
 .../core/ep/consumer/XmlEntryConsumer.java      |  22 ++--
 .../core/ep/consumer/XmlPropertyConsumer.java   |  32 +++---
 .../ep/consumer/JsonPropertyConsumerTest.java   |  53 ++++++++--
 .../ep/consumer/XmlPropertyConsumerTest.java    | 103 ++++++++++++++-----
 .../odata2/fit/basic/ServiceResolutionTest.java |  18 ++++
 9 files changed, 220 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/2211ce41/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
index a012487..3df4758 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
@@ -31,10 +31,10 @@ import org.apache.olingo.odata2.api.ep.callback.OnReadInlineContent;
  * <ul>
  * <li>the <code>mergeSemantic</code></li>
  * <li>the <code>callback for inlined navigation properties</code></li>
- * <li>and the <code>type mappings</code></li>
+ * <li>the <code>type mappings</code></li>
+ * <li>and <code>validatingFacets</code></li>
  * </ul>
  * </p>
- * 
  */
 public class EntityProviderReadProperties {
   /** Callback which is necessary if entity contains inlined navigation properties. */
@@ -51,6 +51,9 @@ public class EntityProviderReadProperties {
    * Supported mappings are documented in {@link org.apache.olingo.odata2.api.edm.EdmSimpleType}.
    */
   final private Map<String, Object> typeMappings;
+  /** whether the constraints expressed in properties' facets are validated */
+  private boolean validatingFacets = true;
+
   final private Map<String, String> validatedPrefix2NamespaceUri;
 
   private EntityProviderReadProperties() {
@@ -90,8 +93,12 @@ public class EntityProviderReadProperties {
     return merge;
   }
 
+  public boolean isValidatingFacets() {
+    return validatingFacets;
+  }
+
   /**
-   *  
+   * Builder for {@link EntityProviderReadProperties}.  
    */
   public static class EntityProviderReadPropertiesBuilder {
     private final EntityProviderReadProperties properties = new EntityProviderReadProperties();
@@ -103,6 +110,7 @@ public class EntityProviderReadProperties {
       properties.callback = propertiesFrom.callback;
       addValidatedPrefixes(propertiesFrom.validatedPrefix2NamespaceUri);
       addTypeMappings(propertiesFrom.typeMappings);
+      properties.validatingFacets = propertiesFrom.validatingFacets;
     }
 
     /**
@@ -134,6 +142,11 @@ public class EntityProviderReadProperties {
       return this;
     }
 
+    public EntityProviderReadPropertiesBuilder isValidatingFacets(final boolean validatingFacets) {
+      properties.validatingFacets = validatingFacets;
+      return this;
+    }
+
     public EntityProviderReadProperties build() {
       return properties;
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/2211ce41/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
index 11350b1..5bae8e7 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
@@ -168,8 +168,8 @@ public class JsonEntryConsumer {
       ensureODataEntryExists();
       EntityPropertyInfo propertyInfo = eia.getPropertyInfo(name);
       if (propertyInfo != null) {
-        JsonPropertyConsumer jpc = new JsonPropertyConsumer();
-        Object propertyValue = jpc.readPropertyValue(reader, propertyInfo, typeMappings.get(name));
+        Object propertyValue = new JsonPropertyConsumer()
+            .readPropertyValue(reader, propertyInfo, typeMappings.get(name), readProperties);
         if (properties.containsKey(name)) {
           throw new EntityProviderException(EntityProviderException.DOUBLE_PROPERTY.addContent(name));
         }
@@ -303,7 +303,10 @@ public class JsonEntryConsumer {
         try {
           if (callback == null) {
             inlineReadProperties =
-                EntityProviderReadProperties.init().mergeSemantic(readProperties.getMergeSemantic()).build();
+                EntityProviderReadProperties.init()
+                    .mergeSemantic(readProperties.getMergeSemantic())
+                    .isValidatingFacets(readProperties.isValidatingFacets())
+                    .build();
 
           } else {
             inlineReadProperties = callback.receiveReadProperties(readProperties, navigationProperty);
@@ -348,7 +351,10 @@ public class JsonEntryConsumer {
       EntityProviderReadProperties inlineReadProperties;
       if (callback == null) {
         inlineReadProperties =
-            EntityProviderReadProperties.init().mergeSemantic(readProperties.getMergeSemantic()).build();
+            EntityProviderReadProperties.init()
+                .mergeSemantic(readProperties.getMergeSemantic())
+                .isValidatingFacets(readProperties.isValidatingFacets())
+                .build();
       } else {
         try {
           inlineReadProperties = callback.receiveReadProperties(readProperties, navigationProperty);

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/2211ce41/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java
index af1262d..1c3ef59 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import org.apache.olingo.odata2.api.edm.Edm;
 import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFacets;
 import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
 import org.apache.olingo.odata2.api.edm.EdmProperty;
 import org.apache.olingo.odata2.api.edm.EdmSimpleType;
@@ -39,7 +40,7 @@ import com.google.gson.stream.JsonReader;
 import com.google.gson.stream.JsonToken;
 
 /**
- *  
+ * JSON property consumer.
  */
 public class JsonPropertyConsumer {
 
@@ -55,10 +56,10 @@ public class JsonPropertyConsumer {
       if (FormatJson.D.equals(nextName)) {
         reader.beginObject();
         nextName = reader.nextName();
-        handleName(reader, typeMappings, entityPropertyInfo, result, nextName);
+        handleName(reader, typeMappings, entityPropertyInfo, readProperties, result, nextName);
         reader.endObject();
       } else {
-        handleName(reader, typeMappings, entityPropertyInfo, result, nextName);
+        handleName(reader, typeMappings, entityPropertyInfo, readProperties, result, nextName);
       }
       reader.endObject();
 
@@ -78,8 +79,8 @@ public class JsonPropertyConsumer {
   }
 
   private void handleName(final JsonReader reader, final Map<String, Object> typeMappings,
-      final EntityPropertyInfo entityPropertyInfo, final Map<String, Object> result, final String nextName)
-      throws EntityProviderException {
+      final EntityPropertyInfo entityPropertyInfo, final EntityProviderReadProperties readProperties,
+      final Map<String, Object> result, final String nextName) throws EntityProviderException {
     if (!entityPropertyInfo.getName().equals(nextName)) {
       throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT.addContent(nextName));
     }
@@ -87,16 +88,16 @@ public class JsonPropertyConsumer {
     if (typeMappings != null) {
       mapping = typeMappings.get(nextName);
     }
-    Object propertyValue = readPropertyValue(reader, entityPropertyInfo, mapping);
+    Object propertyValue = readPropertyValue(reader, entityPropertyInfo, mapping, readProperties);
     result.put(nextName, propertyValue);
   }
 
   protected Object readPropertyValue(final JsonReader reader, final EntityPropertyInfo entityPropertyInfo,
-      final Object typeMapping) throws EntityProviderException {
+      final Object typeMapping, final EntityProviderReadProperties readProperties) throws EntityProviderException {
     try {
       return entityPropertyInfo.isComplex() ?
-          readComplexProperty(reader, (EntityComplexPropertyInfo) entityPropertyInfo, typeMapping) :
-          readSimpleProperty(reader, entityPropertyInfo, typeMapping);
+          readComplexProperty(reader, (EntityComplexPropertyInfo) entityPropertyInfo, typeMapping, readProperties) :
+          readSimpleProperty(reader, entityPropertyInfo, typeMapping, readProperties);
     } catch (final EdmException e) {
       throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
           .getSimpleName()), e);
@@ -107,7 +108,8 @@ public class JsonPropertyConsumer {
   }
 
   private Object readSimpleProperty(final JsonReader reader, final EntityPropertyInfo entityPropertyInfo,
-      final Object typeMapping) throws EdmException, EntityProviderException, IOException {
+      final Object typeMapping, final EntityProviderReadProperties readProperties)
+      throws EdmException, EntityProviderException, IOException {
     final EdmSimpleType type = (EdmSimpleType) entityPropertyInfo.getType();
     Object value = null;
     final JsonToken tokenType = reader.peek();
@@ -148,15 +150,18 @@ public class JsonPropertyConsumer {
     }
 
     final Class<?> typeMappingClass = typeMapping == null ? type.getDefaultType() : (Class<?>) typeMapping;
-    return type.valueOfString((String) value, EdmLiteralKind.JSON, entityPropertyInfo.getFacets(), typeMappingClass);
+    final EdmFacets facets = readProperties == null || readProperties.isValidatingFacets() ?
+        entityPropertyInfo.getFacets() : null;
+    return type.valueOfString((String) value, EdmLiteralKind.JSON, facets, typeMappingClass);
   }
 
   @SuppressWarnings("unchecked")
   private Object readComplexProperty(final JsonReader reader, final EntityComplexPropertyInfo complexPropertyInfo,
-      final Object typeMapping) throws EdmException, EntityProviderException, IOException {
+      final Object typeMapping, final EntityProviderReadProperties readProperties)
+      throws EdmException, EntityProviderException, IOException {
     if (reader.peek().equals(JsonToken.NULL)) {
       reader.nextNull();
-      if (complexPropertyInfo.isMandatory()) {
+      if ((readProperties == null || readProperties.isValidatingFacets()) && complexPropertyInfo.isMandatory()) {
         throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE.addContent(complexPropertyInfo
             .getName()));
       }
@@ -200,7 +205,7 @@ public class JsonPropertyConsumer {
         if (childPropertyInfo == null) {
           throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY.addContent(childName));
         }
-        Object childData = readPropertyValue(reader, childPropertyInfo, mapping.get(childName));
+        Object childData = readPropertyValue(reader, childPropertyInfo, mapping.get(childName), readProperties);
         if (data.containsKey(childName)) {
           throw new EntityProviderException(EntityProviderException.DOUBLE_PROPERTY.addContent(childName));
         }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/2211ce41/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java
index c7fca98..5d73862 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java
@@ -115,9 +115,8 @@ public class XmlEntityConsumer {
 
     try {
       reader = XmlHelper.createStreamReader(content);
-      Map<String, Object> result =
-          xec.readProperty(reader, edmProperty, properties.getMergeSemantic(), properties.getTypeMappings());
-      return result;
+      return xec.readProperty(reader, edmProperty, properties.getMergeSemantic(), properties.getTypeMappings(),
+          properties);
     } catch (EntityProviderException e) {
       cachedException = e;
       throw cachedException;

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/2211ce41/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
index 6b9cd5f..a6111d1 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
@@ -130,17 +130,18 @@ public class XmlEntryConsumer {
     } else if (FormatXml.ATOM_LINK.equals(currentHandledStartTagName)) {
       readLink(reader, eia, readProperties);
     } else if (FormatXml.ATOM_CONTENT.equals(currentHandledStartTagName)) {
-      readContent(reader, eia);
+      readContent(reader, eia, readProperties);
     } else if (FormatXml.M_PROPERTIES.equals(currentHandledStartTagName)) {
-      readProperties(reader, eia);
+      readProperties(reader, eia, readProperties);
     } else if (!readProperties.getMergeSemantic()) {
-      readCustomElement(reader, currentHandledStartTagName, eia);
+      readCustomElement(reader, currentHandledStartTagName, eia, readProperties);
     } else {
       skipStartedTag(reader);
     }
   }
 
-  private void readCustomElement(final XMLStreamReader reader, final String tagName, final EntityInfoAggregator eia)
+  private void readCustomElement(final XMLStreamReader reader, final String tagName, final EntityInfoAggregator eia,
+      final EntityProviderReadProperties readProperties)
       throws EdmException, EntityProviderException, XMLStreamException {
     EntityPropertyInfo targetPathInfo = eia.getTargetPathInfo(tagName);
     NamespaceContext nsctx = reader.getNamespaceContext();
@@ -165,7 +166,8 @@ public class XmlEntryConsumer {
             final EntityPropertyInfo propertyInfo = getValidatedPropertyInfo(eia, tagName);
             final Class<?> typeMapping = typeMappings.getMappingClass(propertyInfo.getName());
             final EdmSimpleType type = (EdmSimpleType) propertyInfo.getType();
-            final Object value = type.valueOfString(text, EdmLiteralKind.DEFAULT, propertyInfo.getFacets(),
+            final Object value = type.valueOfString(text, EdmLiteralKind.DEFAULT,
+                readProperties == null || readProperties.isValidatingFacets() ? propertyInfo.getFacets() : null,
                 typeMapping == null ? type.getDefaultType() : typeMapping);
             properties.put(tagName, value);
           }
@@ -524,7 +526,8 @@ public class XmlEntryConsumer {
     }
   }
 
-  private void readContent(final XMLStreamReader reader, final EntityInfoAggregator eia)
+  private void readContent(final XMLStreamReader reader, final EntityInfoAggregator eia,
+      final EntityProviderReadProperties readProperties)
       throws EntityProviderException, XMLStreamException, EdmException {
     reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_CONTENT);
 
@@ -534,7 +537,7 @@ public class XmlEntryConsumer {
     reader.nextTag();
 
     if (reader.isStartElement() && reader.getLocalName().equals(FormatXml.M_PROPERTIES)) {
-      readProperties(reader, eia);
+      readProperties(reader, eia, readProperties);
     } else if (reader.isEndElement()) {
       reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_CONTENT);
     } else {
@@ -553,7 +556,8 @@ public class XmlEntryConsumer {
     reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_ID);
   }
 
-  private void readProperties(final XMLStreamReader reader, final EntityInfoAggregator entitySet)
+  private void readProperties(final XMLStreamReader reader, final EntityInfoAggregator entitySet,
+      final EntityProviderReadProperties readProperties)
       throws XMLStreamException, EdmException, EntityProviderException {
     // validate namespace
     reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_M_2007_08, FormatXml.M_PROPERTIES);
@@ -580,7 +584,7 @@ public class XmlEntryConsumer {
             throw new EntityProviderException(EntityProviderException.DOUBLE_PROPERTY.addContent(closeTag));
           }
           property = getValidatedPropertyInfo(entitySet, closeTag);
-          final Object value = xpc.readStartedElement(reader, property, typeMappings);
+          final Object value = xpc.readStartedElement(reader, property, typeMappings, readProperties);
           properties.put(closeTag, value);
           closeTag = null;
         }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/2211ce41/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumer.java
index 28cacef..3887333 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumer.java
@@ -33,6 +33,7 @@ import org.apache.olingo.odata2.api.edm.EdmProperty;
 import org.apache.olingo.odata2.api.edm.EdmSimpleType;
 import org.apache.olingo.odata2.api.edm.EdmSimpleTypeException;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityComplexPropertyInfo;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo;
@@ -40,27 +41,27 @@ import org.apache.olingo.odata2.core.ep.aggregator.EntityTypeMapping;
 import org.apache.olingo.odata2.core.ep.util.FormatXml;
 
 /**
- *  
+ * XML property consumer.
  */
 public class XmlPropertyConsumer {
 
   protected static final String TRUE = "true";
   protected static final String FALSE = "false";
 
-  public Map<String, Object>
-      readProperty(final XMLStreamReader reader, final EdmProperty property, final boolean merge)
-          throws EntityProviderException {
-    return readProperty(reader, property, merge, null);
+  public Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property,
+      final boolean merge, final EntityProviderReadProperties readProperties) throws EntityProviderException {
+    return readProperty(reader, property, merge, null, readProperties);
   }
 
   public Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property,
-      final boolean merge, final Map<String, Object> typeMappings) throws EntityProviderException {
+      final boolean merge, final Map<String, Object> typeMappings, final EntityProviderReadProperties readProperties)
+      throws EntityProviderException {
     EntityPropertyInfo eia = EntityInfoAggregator.create(property);
 
     try {
       reader.next();
 
-      Object value = readStartedElement(reader, eia, EntityTypeMapping.create(typeMappings));
+      Object value = readStartedElement(reader, eia, EntityTypeMapping.create(typeMappings), readProperties);
 
       if (eia.isComplex() && merge) {
         mergeWithDefaultValues(value, eia);
@@ -110,7 +111,8 @@ public class XmlPropertyConsumer {
   }
 
   protected Object readStartedElement(final XMLStreamReader reader, final EntityPropertyInfo propertyInfo,
-      final EntityTypeMapping typeMappings) throws EntityProviderException, EdmException {
+      final EntityTypeMapping typeMappings, final EntityProviderReadProperties readProperties)
+      throws EntityProviderException, EdmException {
     final String name = propertyInfo.getName();
     Object result = null;
 
@@ -123,7 +125,7 @@ public class XmlPropertyConsumer {
       }
 
       if (TRUE.equals(nullAttribute)) {
-        if (propertyInfo.isMandatory()) {
+        if ((readProperties == null || readProperties.isValidatingFacets()) && propertyInfo.isMandatory()) {
           throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE.addContent(name));
         }
         reader.nextTag();
@@ -147,13 +149,14 @@ public class XmlPropertyConsumer {
           if (childProperty == null) {
             throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY.addContent(childName));
           }
-          final Object value = readStartedElement(reader, childProperty, typeMappings.getEntityTypeMapping(name));
+          final Object value = readStartedElement(reader, childProperty, typeMappings.getEntityTypeMapping(name),
+              readProperties);
           name2Value.put(childName, value);
           reader.nextTag();
         }
         result = name2Value;
       } else {
-        result = convert(propertyInfo, reader.getElementText(), typeMappings.getMappingClass(name));
+        result = convert(propertyInfo, reader.getElementText(), typeMappings.getMappingClass(name), readProperties);
       }
       reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, name);
 
@@ -164,10 +167,11 @@ public class XmlPropertyConsumer {
     }
   }
 
-  private Object convert(final EntityPropertyInfo property, final String value, final Class<?> typeMapping)
-      throws EdmSimpleTypeException {
+  private Object convert(final EntityPropertyInfo property, final String value, final Class<?> typeMapping,
+      final EntityProviderReadProperties readProperties) throws EdmSimpleTypeException {
     final EdmSimpleType type = (EdmSimpleType) property.getType();
-    return type.valueOfString(value, EdmLiteralKind.DEFAULT, property.getFacets(),
+    return type.valueOfString(value, EdmLiteralKind.DEFAULT,
+        readProperties == null || readProperties.isValidatingFacets() ? property.getFacets() : null,
         typeMapping == null ? type.getDefaultType() : typeMapping);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/2211ce41/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java
index b52df8b..7d51314 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java
@@ -186,7 +186,7 @@ public class JsonPropertyConsumerTest extends BaseTest {
     reader.nextName();
 
     JsonPropertyConsumer jpc = new JsonPropertyConsumer();
-    Object value = jpc.readPropertyValue(reader, entityPropertyInfo, null);
+    Object value = jpc.readPropertyValue(reader, entityPropertyInfo, null, null);
     assertEquals("Team 1", value);
   }
 
@@ -208,6 +208,30 @@ public class JsonPropertyConsumerTest extends BaseTest {
     assertEquals(propertyValue, resultMap.get("Name"));
   }
 
+  @Test(expected = EntityProviderException.class)
+  public void simplePropertyViolatingValidation() throws Exception {
+    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Room")
+        .getProperty("Name");
+    EdmFacets facets = mock(EdmFacets.class);
+    when(facets.getMaxLength()).thenReturn(10);
+    when(property.getFacets()).thenReturn(facets);
+    new JsonPropertyConsumer().readPropertyStandalone(prepareReader("{\"Name\":\"TooLongName\"}"), property, null);
+  }
+
+  @Test
+  public void simplePropertyIgnoringValidation() throws Exception {
+    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Room")
+        .getProperty("Name");
+    EdmFacets facets = mock(EdmFacets.class);
+    when(facets.getMaxLength()).thenReturn(10);
+    when(property.getFacets()).thenReturn(facets);
+    final EntityProviderReadProperties readProperties = mock(EntityProviderReadProperties.class);
+    final Map<String, Object> resultMap = new JsonPropertyConsumer()
+        .readPropertyStandalone(prepareReader("{\"Name\":\"TooLongName\"}"), property, readProperties);
+    assertTrue(resultMap.containsKey("Name"));
+    assertEquals("TooLongName", resultMap.get("Name"));
+  }
+
   @Test
   public void simplePropertyNull() throws Exception {
     JsonReader reader = prepareReader("{\"Name\":null}");
@@ -405,7 +429,7 @@ public class JsonPropertyConsumerTest extends BaseTest {
 
     JsonPropertyConsumer jpc = new JsonPropertyConsumer();
     @SuppressWarnings("unchecked")
-    Map<String, Object> result = (Map<String, Object>) jpc.readPropertyValue(reader, entityPropertyInfo, null);
+    Map<String, Object> result = (Map<String, Object>) jpc.readPropertyValue(reader, entityPropertyInfo, null, null);
 
     assertEquals(2, result.size());
     assertEquals("Heidelberg", result.get("CityName"));
@@ -422,7 +446,7 @@ public class JsonPropertyConsumerTest extends BaseTest {
 
     JsonPropertyConsumer jpc = new JsonPropertyConsumer();
     @SuppressWarnings("unchecked")
-    Map<String, Object> result = (Map<String, Object>) jpc.readPropertyValue(reader, entityPropertyInfo, null);
+    Map<String, Object> result = (Map<String, Object>) jpc.readPropertyValue(reader, entityPropertyInfo, null, null);
 
     assertEquals(2, result.size());
     assertEquals("Heidelberg", result.get("CityName"));
@@ -443,7 +467,7 @@ public class JsonPropertyConsumerTest extends BaseTest {
 
     JsonPropertyConsumer jpc = new JsonPropertyConsumer();
     @SuppressWarnings("unchecked")
-    Map<String, Object> result = (Map<String, Object>) jpc.readPropertyValue(reader, entityPropertyInfo, null);
+    Map<String, Object> result = (Map<String, Object>) jpc.readPropertyValue(reader, entityPropertyInfo, null, null);
 
     assertEquals(2, result.size());
     assertEquals("Germany", result.get("Country"));
@@ -560,6 +584,23 @@ public class JsonPropertyConsumerTest extends BaseTest {
   }
 
   @Test
+  public void complexPropertyNullValueNotAllowedButNotValidated() throws Exception {
+    final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getDefaultEntityContainer()
+        .getEntitySet("Employees").getEntityType().getProperty("Location");
+    EdmFacets facets = mock(EdmFacets.class);
+    when(facets.isNullable()).thenReturn(false);
+    when(property.getFacets()).thenReturn(facets);
+    final EntityProviderReadProperties readProperties = mock(EntityProviderReadProperties.class);
+
+    final Map<String, Object> propertyData = new JsonPropertyConsumer()
+        .readPropertyStandalone(prepareReader("{\"Location\":null}"), property, readProperties);
+    assertNotNull(propertyData);
+    assertEquals(1, propertyData.size());
+    assertTrue(propertyData.containsKey("Location"));
+    assertNull(propertyData.get("Location"));
+  }
+
+  @Test
   public void complexPropertyEmpty() throws Exception {
     final String cityProperty = "{\"d\":{\"City\":{}}}";
     JsonReader reader = prepareReader(cityProperty);
@@ -584,7 +625,7 @@ public class JsonPropertyConsumerTest extends BaseTest {
         (EdmProperty) MockFacade.getMockEdm().getComplexType("RefScenario", "c_Location").getProperty("City");
     EntityComplexPropertyInfo entityPropertyInfo = (EntityComplexPropertyInfo) EntityInfoAggregator.create(property);
 
-    new JsonPropertyConsumer().readPropertyValue(reader, entityPropertyInfo, null);
+    new JsonPropertyConsumer().readPropertyValue(reader, entityPropertyInfo, null, null);
   }
 
   @Test(expected = EntityProviderException.class)
@@ -596,7 +637,7 @@ public class JsonPropertyConsumerTest extends BaseTest {
         (EdmProperty) MockFacade.getMockEdm().getComplexType("RefScenario", "c_Location").getProperty("City");
     EntityComplexPropertyInfo entityPropertyInfo = (EntityComplexPropertyInfo) EntityInfoAggregator.create(property);
 
-    new JsonPropertyConsumer().readPropertyValue(reader, entityPropertyInfo, null);
+    new JsonPropertyConsumer().readPropertyValue(reader, entityPropertyInfo, null, null);
   }
 
   private JsonReader prepareReader(final String json) throws UnsupportedEncodingException {

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/2211ce41/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java
index e1e1f9d..c33b4ea 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlPropertyConsumerTest.java
@@ -19,6 +19,7 @@
 package org.apache.olingo.odata2.core.ep.consumer;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -38,11 +39,12 @@ import org.apache.olingo.odata2.api.edm.EdmProperty;
 import org.apache.olingo.odata2.api.edm.EdmSimpleTypeException;
 import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.testutil.mock.MockFacade;
 import org.junit.Test;
 
 /**
- *  
+ * Tests consuming XML properties.
  */
 public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
 
@@ -57,7 +59,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
 
-    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     assertEquals(Integer.valueOf(67), resultMap.get("Age"));
   }
@@ -70,7 +72,8 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
 
     Map<String, Object> typeMappings = createTypeMappings("Age", Long.class);
-    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, typeMappings);
+    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, typeMappings,
+        null);
 
     assertEquals(Long.valueOf(67), resultMap.get("Age"));
   }
@@ -83,7 +86,8 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
 
     Map<String, Object> typeMappings = null;
-    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, typeMappings);
+    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, typeMappings,
+        null);
 
     assertEquals(Integer.valueOf(67), resultMap.get("Age"));
   }
@@ -96,7 +100,8 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
 
     Map<String, Object> typeMappings = new HashMap<String, Object>();
-    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, typeMappings);
+    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, typeMappings,
+        null);
 
     assertEquals(Integer.valueOf(67), resultMap.get("Age"));
   }
@@ -108,7 +113,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");
 
-    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     assertEquals("Max Mustermann", resultMap.get("EmployeeName"));
   }
@@ -120,7 +125,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");
 
-    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     assertTrue(resultMap.containsKey("EmployeeName"));
     assertEquals("", resultMap.get("EmployeeName"));
@@ -134,7 +139,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate");
 
-    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     assertTrue(resultMap.containsKey("EntryDate"));
     assertNull(resultMap.get("EntryDate"));
@@ -148,7 +153,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate");
 
-    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     assertEquals(86400000L, ((Calendar) resultMap.get("EntryDate")).getTimeInMillis());
   }
@@ -160,7 +165,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
 
-    new XmlPropertyConsumer().readProperty(reader, property, false);
+    new XmlPropertyConsumer().readProperty(reader, property, false, null);
   }
 
   @Test(expected = EntityProviderException.class)
@@ -171,7 +176,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
 
-    new XmlPropertyConsumer().readProperty(reader, property, false);
+    new XmlPropertyConsumer().readProperty(reader, property, false, null);
   }
 
   @Test(expected = EntityProviderException.class)
@@ -185,7 +190,35 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     when(facets.isNullable()).thenReturn(false);
     when(property.getFacets()).thenReturn(facets);
 
-    new XmlPropertyConsumer().readProperty(reader, property, false);
+    new XmlPropertyConsumer().readProperty(reader, property, false, null);
+  }
+
+  @Test(expected = EntityProviderException.class)
+  public void violatedValidation() throws Exception {
+    final String xml = "<Name xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">TooLongName</Name>";
+    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Team")
+        .getProperty("Name");
+    EdmFacets facets = mock(EdmFacets.class);
+    when(facets.getMaxLength()).thenReturn(10);
+    when(property.getFacets()).thenReturn(facets);
+
+    new XmlPropertyConsumer().readProperty(createReaderForTest(xml, true), property, false, null);
+  }
+
+  @Test
+  public void ignoringValidation() throws Exception {
+    final String xml = "<Name xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">TooLongName</Name>";
+    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Team")
+        .getProperty("Name");
+    EdmFacets facets = mock(EdmFacets.class);
+    when(facets.getMaxLength()).thenReturn(10);
+    when(property.getFacets()).thenReturn(facets);
+    final EntityProviderReadProperties readProperties = mock(EntityProviderReadProperties.class);
+
+    final Map<String, Object> resultMap = new XmlPropertyConsumer()
+        .readProperty(createReaderForTest(xml, true), property, false, readProperties);
+    assertTrue(resultMap.containsKey("Name"));
+    assertEquals("TooLongName", resultMap.get("Name"));
   }
 
   @Test
@@ -204,7 +237,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     Map<String, Object> locationMap = (Map<String, Object>) resultMap.get("Location");
     assertEquals("Germany", locationMap.get("Country"));
@@ -232,7 +265,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     Map<String, Object> locationMap = (Map<String, Object>) resultMap.get("Location");
     assertEquals("Germany", locationMap.get("Country"));
@@ -258,7 +291,8 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
 
     try {
       Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false,
-          createTypeMappings("Location", createTypeMappings("City", createTypeMappings("PostalCode", Integer.class))));
+          createTypeMappings("Location", createTypeMappings("City", createTypeMappings("PostalCode", Integer.class))),
+          null);
       assertNotNull(resultMap);
     } catch (EntityProviderException e) {
       assertTrue(e.getCause() instanceof EdmSimpleTypeException);
@@ -293,7 +327,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
             createTypeMappings("City",
                 createTypeMappings("CityName", String.class, "PostalCode", Long.class)));
     Map<String, Object> resultMap =
-        new XmlPropertyConsumer().readProperty(reader, locationComplexProperty, false, typeMappings);
+        new XmlPropertyConsumer().readProperty(reader, locationComplexProperty, false, typeMappings, null);
 
     // verify
     Map<String, Object> locationMap = (Map<String, Object>) resultMap.get("Location");
@@ -320,7 +354,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    Object prop = new XmlPropertyConsumer().readProperty(reader, property, false);
+    Object prop = new XmlPropertyConsumer().readProperty(reader, property, false, null);
     Map<String, Object> resultMap = (Map<String, Object>) prop;
 
     Map<String, Object> locationMap = (Map<String, Object>) resultMap.get("Location");
@@ -345,7 +379,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    new XmlPropertyConsumer().readProperty(reader, property, false);
+    new XmlPropertyConsumer().readProperty(reader, property, false, null);
   }
 
   @Test(expected = EntityProviderException.class)
@@ -363,7 +397,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    new XmlPropertyConsumer().readProperty(reader, property, false);
+    new XmlPropertyConsumer().readProperty(reader, property, false, null);
   }
 
   @Test(expected = EntityProviderException.class)
@@ -381,7 +415,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    new XmlPropertyConsumer().readProperty(reader, property, false);
+    new XmlPropertyConsumer().readProperty(reader, property, false, null);
   }
 
   @Test(expected = EntityProviderException.class)
@@ -399,7 +433,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    new XmlPropertyConsumer().readProperty(reader, property, false);
+    new XmlPropertyConsumer().readProperty(reader, property, false, null);
   }
 
   @Test
@@ -418,7 +452,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     Map<String, Object> locationMap = (Map<String, Object>) resultMap.get("Location");
     assertEquals("Germany", locationMap.get("Country"));
@@ -435,7 +469,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     assertTrue(resultMap.containsKey("Location"));
     assertNull(resultMap.get("Location"));
@@ -452,7 +486,24 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     when(facets.isNullable()).thenReturn(false);
     when(property.getFacets()).thenReturn(facets);
 
-    new XmlPropertyConsumer().readProperty(reader, property, false);
+    new XmlPropertyConsumer().readProperty(reader, property, false, null);
+  }
+
+  @Test
+  public void complexPropertyNullValueNotAllowedButNotValidated() throws Exception {
+    final String xml = "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08
+        + "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
+    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee")
+        .getProperty("Location");
+    EdmFacets facets = mock(EdmFacets.class);
+    when(facets.isNullable()).thenReturn(false);
+    when(property.getFacets()).thenReturn(facets);
+    final EntityProviderReadProperties readProperties = mock(EntityProviderReadProperties.class);
+
+    final Map<String, Object> resultMap = new XmlPropertyConsumer()
+        .readProperty(createReaderForTest(xml, true), property, false, readProperties);
+    assertFalse(resultMap.isEmpty());
+    assertNull(resultMap.get("Location"));
   }
 
   @Test(expected = EntityProviderException.class)
@@ -465,7 +516,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    new XmlPropertyConsumer().readProperty(reader, property, false);
+    new XmlPropertyConsumer().readProperty(reader, property, false, null);
   }
 
   @Test
@@ -475,7 +526,7 @@ public class XmlPropertyConsumerTest extends AbstractXmlConsumerTest {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
 
-    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false);
+    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);
 
     assertNotNull(resultMap.get("Location"));
     @SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/2211ce41/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
index 621701e..8ee0883 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
@@ -255,6 +255,24 @@ public class ServiceResolutionTest extends BaseTest {
   }
 
   @Test
+  public void testMetadataUriWithMatrixParameter() throws ClientProtocolException, IOException, ODataException,
+      URISyntaxException {
+    server.setPathSplit(3);
+    startServer();
+
+    final String endpoint = server.getEndpoint().toString();
+    final HttpGet get = new HttpGet(URI.create(endpoint + "aaa/bbb;n=2,3;m=1/ccc/$metadata"));
+    final HttpResponse response = httpClient.execute(get);
+
+    assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());
+
+    final ODataContext ctx = service.getProcessor().getContext();
+    assertNotNull(ctx);
+    assertEquals(endpoint + "aaa/bbb;n=2,3;m=1/ccc/", ctx.getPathInfo().getServiceRoot().toASCIIString());
+    assertEquals("$metadata", ctx.getPathInfo().getODataSegments().get(0).getPath());
+  }
+
+  @Test
   public void testBaseUriWithEncoding() throws ClientProtocolException, IOException, ODataException,
       URISyntaxException {
     server.setPathSplit(3);


[2/2] git commit: [OLINGO-235] code cleanup

Posted by sk...@apache.org.
[OLINGO-235] code cleanup


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/74dff0f3
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/74dff0f3
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/74dff0f3

Branch: refs/heads/master
Commit: 74dff0f3acbe7c693fa026995f9efe70e7cc4c81
Parents: 2211ce4
Author: Stephan Klevenz <sk...@apache.org>
Authored: Wed Apr 16 16:35:57 2014 +0200
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Wed Apr 16 16:35:57 2014 +0200

----------------------------------------------------------------------
 .../annotation/processor/core/util/ClassHelper.java   | 11 ++++++-----
 .../processor/core/util/ClassHelperTest.java          |  1 -
 .../api/exception/ODataJPARuntimeException.java       |  1 -
 .../jpa/processor/core/access/data/JPAEntity.java     |  2 +-
 .../processor/core/access/data/JPAEntityParser.java   |  4 ++--
 .../processor/core/access/model/JPATypeConvertor.java |  4 ++--
 .../data/JPAEntityParserTestForStaticMethods.java     |  2 +-
 .../core/mock/ODataJPAServiceFactoryMock.java         |  6 +++---
 .../processor/core/mock/OnJPAWriteContentMock.java    |  4 ++--
 .../jpa/processor/core/mock/data/JPATypeMock.java     | 12 ++++++------
 .../processor/ref/converter/BlobToByteConverter.java  |  4 ++--
 .../odata2/jpa/processor/ref/model/Material.java      |  2 +-
 .../odata2/jpa/processor/ref/model/NoteKey.java       | 14 +++++++-------
 .../jpa/processor/ref/extension/OnDBWriteContent.java |  4 ++--
 .../odata2/api/ep/EntityProviderReadProperties.java   |  2 +-
 15 files changed, 36 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
index d81d9cf..24082ff 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
@@ -101,7 +101,7 @@ public class ClassHelper {
     return annotatedClasses;
   }
 
-  private static URI getResourceUri(String packageToScan, ClassLoader classLoader) {
+  private static URI getResourceUri(final String packageToScan, final ClassLoader classLoader) {
     String folderToScan = packageToScan.replace(PACKAGE_SEPARATOR, RESOURCE_SEPARATOR);
     URL url = classLoader.getResource(folderToScan);
     if (url == null) {
@@ -115,15 +115,16 @@ public class ClassHelper {
       return uri;
     } catch (URISyntaxException e) {
       throw new IllegalArgumentException("Invalid folder path for path URL '" + url +
-              "' from thread context class loader.");
+          "' from thread context class loader.");
     }
   }
 
-  private static boolean isJarFile(URI uri) {
+  private static boolean isJarFile(final URI uri) {
     return JAR_FILE_ENDING.equals(uri.getScheme());
   }
 
-  private static Collection<String> getClassFqnFromDir(final FilenameFilter ff, File folder, String packageToScan) {
+  private static Collection<String> getClassFqnFromDir(final FilenameFilter ff, final File folder,
+      final String packageToScan) {
     List<String> classFiles = new ArrayList<String>();
     String[] classFilesForFolder = folder.list(ff);
     for (String name : classFilesForFolder) {
@@ -139,7 +140,7 @@ public class ClassHelper {
     return classFiles;
   }
 
-  private static Collection<String> getClassFqnFromJar(URI uri, String packageToScan) {
+  private static Collection<String> getClassFqnFromJar(final URI uri, final String packageToScan) {
     final String jarFilePath;
     String filepath = uri.getSchemeSpecificPart().substring(5);
     String[] split = filepath.split(JAR_RESOURCE_SEPARATOR);

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
index 42dd259..3a1aba0 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
@@ -78,7 +78,6 @@ public class ClassHelperTest {
     Assert.assertEquals(SimpleEntity.class.getName(), loadedClasses.get(0).getName());
   }
 
-
   @Test
   public void loadSingleEntityFromJar() throws ODataException {
     String packageToScan = AnnotatedEntity.class.getPackage().getName();

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPARuntimeException.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPARuntimeException.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPARuntimeException.java
index bac5ca3..9863544 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPARuntimeException.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPARuntimeException.java
@@ -98,5 +98,4 @@ public class ODataJPARuntimeException extends ODataJPAException {
 
   private static final long serialVersionUID = -5230976355642443012L;
 
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
index b263644..ec05d6b 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
@@ -315,7 +315,7 @@ public class JPAEntity {
   }
 
   protected void setProperty(final Method method, final Object entity, final Object entityPropertyValue,
-      EdmSimpleType type) throws
+      final EdmSimpleType type) throws
       IllegalAccessException, IllegalArgumentException, InvocationTargetException, ODataJPARuntimeException {
     if (entityPropertyValue != null) {
       Class<?> parameterType = method.getParameterTypes()[0];

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
index 7fc9744..1314ed2 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
@@ -258,7 +258,7 @@ public final class JPAEntityParser {
     return propertyValue;
   }
 
-  public static String getString(Clob clob) throws ODataJPARuntimeException {
+  public static String getString(final Clob clob) throws ODataJPARuntimeException {
     try {
       Reader stringReader = clob.getCharacterStream();
       StringWriter buffer = null;
@@ -305,7 +305,7 @@ public final class JPAEntityParser {
 
   }
 
-  public static byte[] getBytes(Blob blob) throws ODataJPARuntimeException {
+  public static byte[] getBytes(final Blob blob) throws ODataJPARuntimeException {
     try {
       InputStream is = null;
       ByteArrayOutputStream buffer = null;

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertor.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertor.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertor.java
index c5c2722..685ee83 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertor.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertor.java
@@ -106,7 +106,7 @@ public class JPATypeConvertor {
         .addContent(jpaType.toString()), null);
   }
 
-  private static boolean isBlob(Attribute<?, ?> currentAttribute) {
+  private static boolean isBlob(final Attribute<?, ?> currentAttribute) {
     if (currentAttribute != null) {
       AnnotatedElement annotatedElement = (AnnotatedElement) currentAttribute.getJavaMember();
       if (annotatedElement != null && annotatedElement.getAnnotation(Lob.class) != null) {
@@ -116,7 +116,7 @@ public class JPATypeConvertor {
     return false;
   }
 
-  private static TemporalType determineTemporalType(Attribute<?, ?> currentAttribute)
+  private static TemporalType determineTemporalType(final Attribute<?, ?> currentAttribute)
       throws ODataJPAModelException {
     if (currentAttribute != null) {
       AnnotatedElement annotatedElement = (AnnotatedElement) currentAttribute.getJavaMember();

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
index 44f1f4b..efb388d 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
@@ -281,7 +281,7 @@ public class JPAEntityParserTestForStaticMethods {
     }
   }
 
-  private FileInputStream getFileStream(String name) throws SerialException, FileNotFoundException {
+  private FileInputStream getFileStream(final String name) throws SerialException, FileNotFoundException {
     final String fileName = "SalesOrderProcessingMappingModels.xml";
     FileInputStream fis;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
index 8535fe4..5fdeece 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
@@ -26,21 +26,21 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 public class ODataJPAServiceFactoryMock extends ODataJPAServiceFactory {
   private ODataContext context = null;
 
-  public ODataJPAServiceFactoryMock(ODataContext context) {
+  public ODataJPAServiceFactoryMock(final ODataContext context) {
     this.context = context;
   }
 
   @Override
   public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
     ODataJPAContext oDataJPAContext = null;
-    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(this.context);
+    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
     setOnWriteJPAContent(new OnJPAWriteContentMock());
     return oDataJPAContext;
   }
 
   public ODataJPAContext initializeODataJPAContextX() throws ODataJPARuntimeException {
     ODataJPAContext oDataJPAContext = null;
-    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(this.context);
+    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
     setOnWriteJPAContent(null);
     return oDataJPAContext;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java
index 6a59361..e0069ce 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java
@@ -32,7 +32,7 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 public class OnJPAWriteContentMock implements OnJPAWriteContent {
 
   @Override
-  public Blob getJPABlob(byte[] binaryData) throws ODataJPARuntimeException {
+  public Blob getJPABlob(final byte[] binaryData) throws ODataJPARuntimeException {
     try {
       return new SerialBlob(binaryData);
     } catch (SerialException e) {
@@ -44,7 +44,7 @@ public class OnJPAWriteContentMock implements OnJPAWriteContent {
   }
 
   @Override
-  public Clob getJPAClob(char[] characterData) throws ODataJPARuntimeException {
+  public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException {
     try {
       return new SerialClob(characterData);
     } catch (SerialException e) {

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
index be1475c..dd8207b 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
@@ -60,7 +60,7 @@ public class JPATypeMock {
     return mClob;
   }
 
-  public void setMClob(Clob mClob) {
+  public void setMClob(final Clob mClob) {
     this.mClob = mClob;
   }
 
@@ -68,7 +68,7 @@ public class JPATypeMock {
     return mC;
   }
 
-  public void setMC(char mC) {
+  public void setMC(final char mC) {
     this.mC = mC;
   }
 
@@ -76,7 +76,7 @@ public class JPATypeMock {
     return mCArray;
   }
 
-  public void setMCArray(char[] mCArray) {
+  public void setMCArray(final char[] mCArray) {
     this.mCArray = mCArray;
   }
 
@@ -84,7 +84,7 @@ public class JPATypeMock {
     return mChar;
   }
 
-  public void setMChar(Character mChar) {
+  public void setMChar(final Character mChar) {
     this.mChar = mChar;
   }
 
@@ -92,7 +92,7 @@ public class JPATypeMock {
     return mCharArray;
   }
 
-  public void setMCharArray(Character[] mCharArray) {
+  public void setMCharArray(final Character[] mCharArray) {
     this.mCharArray = mCharArray;
   }
 
@@ -159,7 +159,7 @@ public class JPATypeMock {
     return mBlob;
   }
 
-  public void setMBlob(Blob mBlob) {
+  public void setMBlob(final Blob mBlob) {
     this.mBlob = mBlob;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java
index 8e9c6c2..b6b01cf 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java
@@ -33,7 +33,7 @@ import org.hsqldb.jdbc.JDBCBlob;
 public class BlobToByteConverter implements AttributeConverter<Blob, byte[]> {
 
   @Override
-  public byte[] convertToDatabaseColumn(Blob arg0) {
+  public byte[] convertToDatabaseColumn(final Blob arg0) {
     ByteArrayOutputStream buffer = new ByteArrayOutputStream();
     InputStream is;
     try {
@@ -53,7 +53,7 @@ public class BlobToByteConverter implements AttributeConverter<Blob, byte[]> {
   }
 
   @Override
-  public Blob convertToEntityAttribute(byte[] arg0) {
+  public Blob convertToEntityAttribute(final byte[] arg0) {
     try {
       return new JDBCBlob(arg0);
     } catch (SQLException e) {

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
index 83483de..356909f 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
@@ -74,7 +74,7 @@ public class Material {
     return materialImage;
   }
 
-  public void setMaterialImage(Blob materialImage) {
+  public void setMaterialImage(final Blob materialImage) {
     this.materialImage = materialImage;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java
index 6ca1067..2585f97 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java
@@ -32,7 +32,7 @@ public class NoteKey implements Serializable {
     return creationTime;
   }
 
-  public void setCreationTime(Calendar creationTime) {
+  public void setCreationTime(final Calendar creationTime) {
     this.creationTime = creationTime;
   }
 
@@ -40,7 +40,7 @@ public class NoteKey implements Serializable {
     return creationDate;
   }
 
-  public void setCreationDate(Calendar creationDate) {
+  public void setCreationDate(final Calendar creationDate) {
     this.creationDate = creationDate;
   }
 
@@ -48,7 +48,7 @@ public class NoteKey implements Serializable {
     return createdBy;
   }
 
-  public void setCreatedBy(String createdBy) {
+  public void setCreatedBy(final String createdBy) {
     this.createdBy = createdBy;
   }
 
@@ -58,17 +58,17 @@ public class NoteKey implements Serializable {
   }
 
   @Override
-  public boolean equals(Object obj) {
+  public boolean equals(final Object obj) {
     if (obj instanceof Note) {
       Note note = (Note) obj;
 
-      if (!note.getCreatedBy().equals(this.getCreatedBy())) {
+      if (!note.getCreatedBy().equals(getCreatedBy())) {
         return false;
       }
-      if (!note.getCreationDate().equals(this.getCreationDate())) {
+      if (!note.getCreationDate().equals(getCreationDate())) {
         return false;
       }
-      if (!note.getCreationTime().equals(this.getCreationTime())) {
+      if (!note.getCreationTime().equals(getCreationTime())) {
         return false;
       }
       return true;

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java
index 220b904..678b62a 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java
@@ -32,7 +32,7 @@ import org.hsqldb.jdbc.JDBCClob;
 public class OnDBWriteContent implements OnJPAWriteContent {
 
   @Override
-  public Blob getJPABlob(byte[] binaryData) throws ODataJPARuntimeException {
+  public Blob getJPABlob(final byte[] binaryData) throws ODataJPARuntimeException {
     try {
       return new JDBCBlob(binaryData);
     } catch (SerialException e) {
@@ -44,7 +44,7 @@ public class OnDBWriteContent implements OnJPAWriteContent {
   }
 
   @Override
-  public Clob getJPAClob(char[] characterData) throws ODataJPARuntimeException {
+  public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException {
     try {
       return new JDBCClob(new String(characterData));
     } catch (SQLException e) {

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/74dff0f3/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
index 3df4758..6012d96 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderReadProperties.java
@@ -98,7 +98,7 @@ public class EntityProviderReadProperties {
   }
 
   /**
-   * Builder for {@link EntityProviderReadProperties}.  
+   * Builder for {@link EntityProviderReadProperties}.
    */
   public static class EntityProviderReadPropertiesBuilder {
     private final EntityProviderReadProperties properties = new EntityProviderReadProperties();