From 5ded00bdb37a0ee5d35ca47475f5c5afe42bc0db Mon Sep 17 00:00:00 2001
From: "jburke.cadc" <jburke.cadc@728ff76a-78ac-11de-a72b-d90af8dea425>
Date: Tue, 3 Nov 2009 21:41:25 +0000
Subject: [PATCH] If the table value representing the Column size is null, set
 Column size to null, not 0. Use the correct Formatter interface in
 ResultSetIterator. Handle java.sql.Array return types in IntArrayFormatter.

git-svn-id: https://opencadc.googlecode.com/svn/trunk@199 728ff76a-78ac-11de-a72b-d90af8dea425
---
 .../tap/writer/formatter/IntArrayFormatter.java    | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/projects/cadcTAP/src/ca/nrc/cadc/tap/writer/formatter/IntArrayFormatter.java b/projects/cadcTAP/src/ca/nrc/cadc/tap/writer/formatter/IntArrayFormatter.java
index 54e63bf2..5d6cd5b7 100644
--- a/projects/cadcTAP/src/ca/nrc/cadc/tap/writer/formatter/IntArrayFormatter.java
+++ b/projects/cadcTAP/src/ca/nrc/cadc/tap/writer/formatter/IntArrayFormatter.java
@@ -69,12 +69,26 @@
 
 package ca.nrc.cadc.tap.writer.formatter;
 
+import java.sql.SQLException;
+
 public class IntArrayFormatter implements Formatter
 {
     public String format(Object object)
     {
         if (object == null)
             return "";
+        if (object instanceof java.sql.Array)
+        {
+            try
+            {
+                java.sql.Array array = (java.sql.Array) object;
+                object = (int[]) array.getArray();
+            }
+            catch (SQLException e)
+            {
+                throw new IllegalArgumentException("Error accessing array data for " + object.getClass().getCanonicalName(), e);
+            }
+        }
         if (!(object instanceof int[]))
             throw new IllegalArgumentException("Expecting int[], " + object.getClass().getCanonicalName() + " not supported.");
 
-- 
GitLab