From eaa8fbfe24eb161159fa2216da52eae86d9b39c7 Mon Sep 17 00:00:00 2001
From: Sonia Zorba <sonia.zorba@inaf.it>
Date: Tue, 30 Mar 2021 14:41:56 +0200
Subject: [PATCH] Bugfix arraysize '*' not correctly parsed

---
 src/tap/db/JDBCConnection.java | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/tap/db/JDBCConnection.java b/src/tap/db/JDBCConnection.java
index ff7ce7c..b8224a5 100644
--- a/src/tap/db/JDBCConnection.java
+++ b/src/tap/db/JDBCConnection.java
@@ -1341,8 +1341,21 @@ public class JDBCConnection implements DBConnection {
 						ucd = rs.getString(5), utype = rs.getString(6),
 						datatype = rs.getString(7),
 						dbName = (hasDBName ? (hasColumnIndex ? rs.getString(13) : rs.getString(12)) : null);
-				int size = rs.getInt(8),
-						colIndex = (hasColumnIndex ? (rs.getObject(12) == null ? -1 : rs.getInt(12)) : -1);
+				int size = 0;
+                                if(hasArraysize) {
+                                    String arraySize = rs.getString(8);
+                                    if(!rs.wasNull()) {
+                                        arraySize = arraySize.replace("*", "");
+                                        if(arraySize.isEmpty()) {
+                                            size = Integer.MAX_VALUE;
+                                        } else {
+                                            size = Integer.parseInt(arraySize);
+                                        }
+                                    }
+                                } else {
+                                    size = rs.getInt(8);
+                                }
+				int colIndex = (hasColumnIndex ? (rs.getObject(12) == null ? -1 : rs.getInt(12)) : -1);
 				boolean principal = toBoolean(rs.getObject(9)),
 						indexed = toBoolean(rs.getObject(10)),
 						std = toBoolean(rs.getObject(11));
-- 
GitLab