fixed array out of bounds exception in copy constructor
authorjprocter <Jim Procter>
Sun, 15 Oct 2006 12:44:45 +0000 (12:44 +0000)
committerjprocter <Jim Procter>
Sun, 15 Oct 2006 12:44:45 +0000 (12:44 +0000)
src/jalview/datamodel/ColumnSelection.java

index c35ff46..60d7aea 100644 (file)
@@ -644,18 +644,18 @@ public class ColumnSelection
       if (copy.selected!=null) {\r
         selected = new Vector();\r
         for (int i=0,j=copy.selected.size(); i<j; i++) {\r
-          selected.setElementAt( ((Integer) copy.selected.elementAt(i)), i);\r
+          selected.addElement(copy.selected.elementAt(i));\r
         }\r
       }\r
       if (copy.hiddenColumns!=null) {\r
-        hiddenColumns=new Vector();\r
+        hiddenColumns=new Vector(copy.hiddenColumns.size());\r
         for (int i=0,j=copy.hiddenColumns.size(); i<j; i++) {\r
           int[] rh,cp;\r
           rh = (int[])copy.hiddenColumns.elementAt(i);\r
           if (rh!=null) {\r
             cp = new int[rh.length];\r
             System.arraycopy(rh, 0, cp, 0, rh.length);\r
-            hiddenColumns.setElementAt(cp, i);\r
+            hiddenColumns.addElement(cp);\r
           }\r
         }\r
       }\r