From fca60e5016d23f76919d47b55a748331742cb40f Mon Sep 17 00:00:00 2001
From: gmantele <gmantele@ari.uni-heidelberg.de>
Date: Tue, 4 Jul 2017 17:05:34 +0200
Subject: [PATCH] [TAP] Convert ResultSet's BigInteger values in Long.

---
 src/tap/data/ResultSetTableIterator.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/tap/data/ResultSetTableIterator.java b/src/tap/data/ResultSetTableIterator.java
index 60dfedc..5d23c20 100644
--- a/src/tap/data/ResultSetTableIterator.java
+++ b/src/tap/data/ResultSetTableIterator.java
@@ -20,7 +20,7 @@ package tap.data;
  */
 
 import java.math.BigDecimal;
-
+import java.math.BigInteger;
 import java.sql.Date;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
@@ -730,6 +730,9 @@ public class ResultSetTableIterator implements TableIterator {
 			// but this type can not be supported in FITS and VOTable): 
 			else if (colValue instanceof BigDecimal)
 				colValue = ((BigDecimal)colValue).doubleValue();
+			// if the type is a BigInteger object (as BigDecimal, this type can not be supported in FITS and VOTable): 
+			else if (colValue instanceof BigInteger)
+				colValue = ((BigInteger)colValue).longValue();
 			// if the type is Integer but it is declared as a SMALLINT cast the value (absolutely required for the FITS format):
 			else if (colValue instanceof Integer && colType != null && colValue != null && colType.type == DBDatatype.SMALLINT)
 				colValue = new Short(((Integer)colValue).shortValue());
-- 
GitLab