You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ra...@apache.org on 2019/09/04 03:48:26 UTC

[olingo-odata4] branch olingojava8 created (now 9f8cbc6)

This is an automated email from the ASF dual-hosted git repository.

ramyav pushed a change to branch olingojava8
in repository https://gitbox.apache.org/repos/asf/olingo-odata4.git.


      at 9f8cbc6  [OLINGO-1391]OData V4: Move the olingo library to java 8

This branch includes the following new commits:

     new 9f8cbc6  [OLINGO-1391]OData V4: Move the olingo library to java 8

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[olingo-odata4] 01/01: [OLINGO-1391]OData V4: Move the olingo library to java 8

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ramyav pushed a commit to branch olingojava8
in repository https://gitbox.apache.org/repos/asf/olingo-odata4.git

commit 9f8cbc6fcc38b3031c2765ce1952e1e4b5767451
Author: ramya vasanth <ra...@sap.com>
AuthorDate: Wed Sep 4 09:17:51 2019 +0530

    [OLINGO-1391]OData V4: Move the olingo library to java 8
---
 .../apache/olingo/server/core/ODataDispatcher.java |  9 +++++--
 .../deserializer/FixedFormatDeserializerImpl.java  | 19 ++++++++++-----
 .../server/core/uri/parser/ParserHelper.java       | 15 +++++++-----
 .../olingo/server/tecsvc/data/DataProvider.java    | 28 +++++++++++++++-------
 pom.xml                                            | 12 ++++++----
 src/checkstyle/config.xml                          |  3 +--
 6 files changed, 57 insertions(+), 29 deletions(-)

diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
index 35a716d..442ca6d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
@@ -601,8 +601,13 @@ public class ODataDispatcher {
         validateIsSingleton(method);
         validatePreconditions(request, false);
         validatePreferHeader(request);
-        handler.selectProcessor(isMedia ? MediaEntityProcessor.class : EntityProcessor.class)
-            .deleteEntity(request, response, uriInfo);
+        if (isMedia) {
+          ((MediaEntityProcessor) handler.selectProcessor(MediaEntityProcessor.class))
+          .deleteEntity(request, response, uriInfo);
+          } else {
+          ((EntityProcessor) handler.selectProcessor(EntityProcessor.class))
+          .deleteEntity(request, response, uriInfo);
+        }
       } else {
         throwMethodNotAllowed(method);
       }
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java
index 5f561e5..7196570 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java
@@ -100,12 +100,19 @@ public class FixedFormatDeserializerImpl implements FixedFormatDeserializer {
       result.setType(type.getFullQualifiedName().getFullQualifiedNameAsString());
       final EdmPrimitiveType primitiveType = (EdmPrimitiveType) type;
       try {
-        result.setValue(type.getKind() == EdmTypeKind.ENUM ? ValueType.ENUM : ValueType.PRIMITIVE,
-            primitiveType.valueOfString(primitiveType.fromUriLiteral(content),
-                parameter.isNullable(), parameter.getMaxLength(), parameter.getPrecision(), parameter.getScale(), true,
-                parameter.getMapping() == null ?
-                    primitiveType.getDefaultType() :
-                      parameter.getMapping().getMappedJavaClass()));
+        if (parameter.getMapping() == null) {
+          result.setValue(type.getKind() == EdmTypeKind.ENUM ? ValueType.ENUM : ValueType.PRIMITIVE,
+              primitiveType.valueOfString(primitiveType.fromUriLiteral(content),
+                  parameter.isNullable(), parameter.getMaxLength(), 
+                  parameter.getPrecision(), parameter.getScale(), true,
+                   primitiveType.getDefaultType()));
+        } else {
+          result.setValue(type.getKind() == EdmTypeKind.ENUM ? ValueType.ENUM : ValueType.PRIMITIVE,
+              primitiveType.valueOfString(primitiveType.fromUriLiteral(content),
+                  parameter.isNullable(), parameter.getMaxLength(), 
+                  parameter.getPrecision(), parameter.getScale(), true,
+                        parameter.getMapping().getMappedJavaClass()));
+        }
       } catch (final EdmPrimitiveTypeException e) {
         throw new DeserializerException(
             "Invalid value '" + content + "' for parameter " + parameter.getName(), e,
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ParserHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ParserHelper.java
index 04ba04b..26e4577 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ParserHelper.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ParserHelper.java
@@ -619,12 +619,15 @@ public class ParserHelper {
                     parseAliasValue(parameter.getAlias(),
                         edmParameter.getType(), edmParameter.isNullable(), edmParameter.isCollection(),
                         edm, type, aliases).getText() : null;
-          primitiveType.valueOfString(primitiveType.fromUriLiteral(text),
-              edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(), 
-              edmParameter.getScale(), true,
-              edmParameter.getMapping() == null ?
-                  primitiveType.getDefaultType() :
-                    edmParameter.getMapping().getMappedJavaClass());
+                        if (edmParameter.getMapping() == null) {
+                          primitiveType.valueOfString(primitiveType.fromUriLiteral(text),
+                              edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(), 
+                              edmParameter.getScale(), true, primitiveType.getDefaultType());
+                        } else {
+                          primitiveType.valueOfString(primitiveType.fromUriLiteral(text),
+                              edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(), 
+                              edmParameter.getScale(), true, edmParameter.getMapping().getMappedJavaClass());
+                        }
         } catch (final EdmPrimitiveTypeException e) {
           throw new UriValidationException(
               "Invalid value '" + text + "' for parameter " + parameter.getName(), e,
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
index 0682c15..837b5fa 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
@@ -143,11 +143,17 @@ public class DataProvider {
             throw new DataProviderException("Expression in key value is not supported yet!",
                 HttpStatusCode.NOT_IMPLEMENTED);
           }
+          Object keyValue = null;
           final String text = key.getAlias() == null ? key.getText() : ((Literal) key.getExpression()).getText();
-          final Object keyValue = type.valueOfString(type.fromUriLiteral(text),
-              property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
-              property.isUnicode(),
-              Calendar.class.isAssignableFrom(value.getClass()) ? Calendar.class : value.getClass());
+          if (Calendar.class.isAssignableFrom(value.getClass())) {
+            keyValue = type.valueOfString(type.fromUriLiteral(text),
+                property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
+                property.isUnicode(), Calendar.class);
+          } else {
+            keyValue = type.valueOfString(type.fromUriLiteral(text),
+                property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
+                property.isUnicode(), value.getClass());
+          }
           if (!value.equals(keyValue)) {
             found = false;
             break;
@@ -958,10 +964,16 @@ public class DataProvider {
                 HttpStatusCode.NOT_IMPLEMENTED);
           }
           final String text = key.getAlias() == null ? key.getText() : ((Literal) key.getExpression()).getText();
-          final Object keyValue = type.valueOfString(type.fromUriLiteral(text),
-              property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
-              property.isUnicode(),
-              Calendar.class.isAssignableFrom(value.getClass()) ? Calendar.class : value.getClass());
+          Object keyValue = null;
+          if (Calendar.class.isAssignableFrom(value.getClass())) {
+            keyValue = type.valueOfString(type.fromUriLiteral(text),
+                property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
+                property.isUnicode(), Calendar.class);
+          } else {
+            keyValue = type.valueOfString(type.fromUriLiteral(text),
+                property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
+                property.isUnicode(), value.getClass());
+          }
           if (!value.equals(keyValue)) {
             found = false;
             break;
diff --git a/pom.xml b/pom.xml
index 3f08577..5d5a52f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,7 +104,7 @@
 
     <!-- Project build settings -->
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <project.build.source>1.6</project.build.source>
+    <project.build.source>1.8</project.build.source>
     <olingo.deploy.skip>true</olingo.deploy.skip>
 
     <!-- Setting needed for Java 8 release builds -->
@@ -330,12 +330,12 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>2.12.1</version>
+          <version>3.1.0</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
-          <version>2.3.2</version>
+          <version>3.8.1</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
@@ -514,13 +514,15 @@
             </goals>
           </execution>
         </executions>
-        <configuration>
+        <configuration combine.self="override">
           <outputFileFormat>xml</outputFileFormat>
           <consoleOutput>true</consoleOutput>
           <enableRSS>false</enableRSS>
           <linkXRef>false</linkXRef>
           <configLocation>src/checkstyle/config.xml</configLocation>
-          <sourceDirectory>${basedir}/src</sourceDirectory>
+          <sourceDirectories>
+			<sourceDirectory>${basedir}/src</sourceDirectory>
+		  </sourceDirectories>
           <encoding>${project.build.sourceEncoding}</encoding>
           <failOnViolation>true</failOnViolation>
           <violationSeverity>warning</violationSeverity>
diff --git a/src/checkstyle/config.xml b/src/checkstyle/config.xml
index 2d4e169..3cb3d98 100644
--- a/src/checkstyle/config.xml
+++ b/src/checkstyle/config.xml
@@ -29,7 +29,6 @@
 <module name="Checker">
   <property name="severity" value="warning"/>
   <module name="TreeWalker">
-    <module name="FileContentsHolder"/>
     <module name="IllegalImport">
       <property name="severity" value="info"/>
       <property name="illegalPkgs" value="java.awt, javax.swing"/>
@@ -69,6 +68,6 @@
     <module name="LineLength">
       <property name="max" value="120"/>
     </module>
+	<module name="SuppressionCommentFilter"/>
   </module>
-  <module name="SuppressionCommentFilter"/>
 </module>