Skip to content
Snippets Groups Projects
Commit 0096f076 authored by pdowler.cadc's avatar pdowler.cadc
Browse files

fixed int[] formatter

fixed double[] formatter and added it to factory

git-svn-id: https://opencadc.googlecode.com/svn/trunk@353 728ff76a-78ac-11de-a72b-d90af8dea425
parent 6351f820
No related branches found
No related tags found
No related merge requests found
...@@ -89,12 +89,13 @@ public class IntArrayFormatter implements Formatter ...@@ -89,12 +89,13 @@ public class IntArrayFormatter implements Formatter
{ {
if (object == null) if (object == null)
return ""; return "";
if (object instanceof java.sql.Array) if (object instanceof java.sql.Array)
{ {
try try
{ {
java.sql.Array array = (java.sql.Array) object; java.sql.Array array = (java.sql.Array) object;
object = (int[]) array.getArray(); object = array.getArray();
} }
catch (SQLException e) catch (SQLException e)
{ {
...@@ -104,7 +105,17 @@ public class IntArrayFormatter implements Formatter ...@@ -104,7 +105,17 @@ public class IntArrayFormatter implements Formatter
if (!(object instanceof int[])) if (!(object instanceof int[]))
throw new IllegalArgumentException("Expecting int[], " + object.getClass().getCanonicalName() + " not supported."); throw new IllegalArgumentException("Expecting int[], " + object.getClass().getCanonicalName() + " not supported.");
return object.toString(); return toString((int[]) object);
} }
private String toString(int[] iarray)
{
StringBuffer sb = new StringBuffer();
for (int i : iarray)
{
sb.append(Integer.toString(i));
sb.append(",");
}
return sb.substring(0, sb.length() - 1); // trim trailing comma
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment