Repository: incubator-atlas
Updated Branches:
  refs/heads/master 44df46cf1 -> 48b05f364


ATLAS-1613: fix for bigdecimal value handling to avoid casting to long; fixed 
incorrect HTTP status code for an error


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/48b05f36
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/48b05f36
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/48b05f36

Branch: refs/heads/master
Commit: 48b05f364201b01cf04fd6492a375cc154bd2536
Parents: 44df46c
Author: Madhan Neethiraj <[email protected]>
Authored: Wed Mar 1 19:30:57 2017 -0800
Committer: Madhan Neethiraj <[email protected]>
Committed: Wed Mar 1 19:34:06 2017 -0800

----------------------------------------------------------------------
 intg/src/main/java/org/apache/atlas/AtlasErrorCode.java      | 2 +-
 .../main/java/org/apache/atlas/type/AtlasBuiltInTypes.java   | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/48b05f36/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java 
b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
index 5ad362c..8dac620 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
@@ -74,7 +74,7 @@ public enum AtlasErrorCode {
     EMPTY_RESULTS(404, "ATLAS4044E", "No result found for {0}"),
     INSTANCE_GUID_NOT_FOUND(404, "ATLAS4045E", "Given instance guid {0} is 
invalid/not found"),
     INSTANCE_LINEAGE_QUERY_FAILED(404, "ATLAS4047E", "Instance lineage query 
failed {0}"),
-    INSTANCE_CRUD_INVALID_PARAMS(404, "ATLAS4049E", "Invalid instance 
creation/updation parameters passed : {0}"),
+    INSTANCE_CRUD_INVALID_PARAMS(400, "ATLAS4049E", "Invalid instance 
creation/updation parameters passed : {0}"),
     CLASSIFICATION_NOT_FOUND(404, "ATLAS4048E", "Given classification {0} was 
invalid"),
 
     INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND(404, "ATLAS40410E", "Instance {0} 
with unique attribute {1} does not exist"),

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/48b05f36/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java 
b/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
index 600ef8c..8658e8b 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
@@ -365,11 +365,13 @@ public class AtlasBuiltInTypes {
             if (obj != null) {
                 if (obj instanceof BigInteger) {
                     return (BigInteger) obj;
+                } else if (obj instanceof BigDecimal) {
+                    return ((BigDecimal) obj).toBigInteger();
                 } else if (obj instanceof Number) {
                     return BigInteger.valueOf(((Number) obj).longValue());
                 } else {
                     try {
-                        return new BigInteger(obj.toString());
+                        return new BigDecimal(obj.toString()).toBigInteger();
                     } catch (NumberFormatException excp) {
                         // ignore
                     }
@@ -409,8 +411,10 @@ public class AtlasBuiltInTypes {
             if (obj != null) {
                 if (obj instanceof BigDecimal) {
                     return (BigDecimal) obj;
+                } else if (obj instanceof BigInteger) {
+                    return new BigDecimal((BigInteger) obj);
                 } else if (obj instanceof Number) {
-                    return BigDecimal.valueOf(((Number) obj).longValue());
+                    return BigDecimal.valueOf(((Number) obj).doubleValue());
                 } else {
                     try {
                         return new BigDecimal(obj.toString());

Reply via email to