Salut à tous,

Voilà je cherche à utiliser la méthode copyInto de la manière suivante :

Je récupère un ResultSet que je mets dans un Vector. Ensuite, j'utilise la méthode copyInto pour pouvoir créer mon JTable (Object[][] dataRow, Object[] champs).
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
String[] champs = {"Numero","Titre","Auteur"};
        Vector donnees = new Vector();
        try {
            ResultSet rs = bdd.requete("Select * FROM MDFNUC.Livres");
            while (rs.next() == true) {
                String colonne1 = rs.getString(1);
                String colonne2 = rs.getString(2);
                String colonne3 = rs.getString(3);
                System.out.println(colonne1 + " " + colonne2 + " " +  colonne3);
                Object[] ligne = {colonne1, colonne2, colonne3};
                donnees.add(ligne);
            }
        } catch (SQLException SQLE) {
        System.out.println(SQLE.getMessage());
        }
    Object[][] monArray = new Object[3][donnees.size()];
        donnees.copyInto(monArray); //<======================Ligne 58 : OutOfBounds
        JTable table = new JTable(monArray, champs);
La console dit :

Que mon resulset a bien été récupéré mais que la méthode copyInto n'a pas suivi le mouvement. Mon resultSet serait plus grand que monArray, que je pense pourtant avoir bien défini...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
1 La programation sous Unix                                    J.-M. Rifflet                                     
2 La communication sous Unix                                   J.-M. Rifflet                                     
3 Programmation Java                                           J.-F. Macary/C. Nicolas                           
6 Firewalls                                                    D. Chapman                                        
7 Unix administration systeme et reseau                        C. Pelissier                                      
8 Unix in a nutshell                                           D. Gilly                                          
9 Managing project with make                                   A. Oram/S. Talbott                                
10 Handbook of algorithms and data structures                   G. Gonnet                                         
12 The C++ programming language                                 B. Stroustrup                                   
13 Programming Perl                                             L. Wall                                           
14 Programmation d'application graphiques portable en C++       F. Pecheux                                        
4 Exploring Java                                               P. Niemeyer/J. Peck                              
5 Java in a nutshell                                           D. Flanagan                                       
11 Fondements mathematiques de l' informatique                  J. Stern                                          
15 XWindow system programming                                   N. Barkakati                                      
16 XWindow Programmation avec les XtInstrinsics                 D. Young                                          
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at java.util.Vector.copyInto(Vector.java:168)
    at packJTableTest.Main.main(Main.java:58)
Je crois que le fait que mon Vector contienne des array pose un problème.
Qu'en dites vous?
Merci d'avance.