camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: Optimise - Small optimisation in type converter
Date Fri, 23 Jun 2017 18:38:39 GMT
Repository: camel
Updated Branches:
  refs/heads/master 5d4bb0d70 -> 66697f6dd


Optimise - Small optimisation in type converter


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/66697f6d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/66697f6d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/66697f6d

Branch: refs/heads/master
Commit: 66697f6dd1574513ddcbfabd535e140088251982
Parents: 5d4bb0d
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Jun 23 20:35:14 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jun 23 20:35:14 2017 +0200

----------------------------------------------------------------------
 .../camel/impl/converter/BaseTypeConverterRegistry.java     | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/66697f6d/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
b/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
index d4cab43..5e0ccf0 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
@@ -268,11 +268,11 @@ public abstract class BaseTypeConverterRegistry extends ServiceSupport
implement
             if (statistics.isStatisticsEnabled()) {
                 noopCounter.increment();
             }
-            return type.cast(value);
+            return value;
         }
 
         // special for NaN numbers, which we can only convert for floating numbers
-        if (ObjectHelper.isNaN(value)) {
+        if (value.equals(Float.NaN) || value.equals(Double.NaN) ) {
             // no type conversion was needed
             if (statistics.isStatisticsEnabled()) {
                 noopCounter.increment();
@@ -757,7 +757,7 @@ public abstract class BaseTypeConverterRegistry extends ServiceSupport
implement
     /**
      * Represents a mapping from one type (which can be null) to another
      */
-    protected static class TypeMapping {
+    protected static final class TypeMapping {
         private final Class<?> toType;
         private final Class<?> fromType;
 
@@ -778,8 +778,7 @@ public abstract class BaseTypeConverterRegistry extends ServiceSupport
implement
         public boolean equals(Object object) {
             if (object instanceof TypeMapping) {
                 TypeMapping that = (TypeMapping) object;
-                return ObjectHelper.equal(this.fromType, that.fromType)
-                        && ObjectHelper.equal(this.toType, that.toType);
+                return this.fromType == that.fromType && this.toType == that.toType;
             }
             return false;
         }


Mime
View raw message