Bonjour,

Voici le bloc de code que j'utilise pour parcourir une HashMap et afficher ses éléments.
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
21
22
23
24
25
 
if(command2==null && options.contains("e"))
                     {
                        sortie.println("Exceptions triggered the last minute: ");
                        //Lire la HashMap ligne par ligne et obtenir la valeur pour la clé de chaque HashMap
                        Set cles = ans.exceptions.keySet();
                        Iterator it = cles.iterator();
                        //on parcours cet array
                        //System.out.println("Size of Exceptions: "+ans.exceptions.size());
                        sortie.println("Size of Exceptions: "+ans.exceptions.size()+"keyset: "+cles.size());
                        while (it.hasNext())
                        {
                            System.out.println(it);
                            Object cle = it.next(); 
                            Object valeur = ans.exceptions.get(cle);
 
                            System.out.println("DB: "+cle);
                            sortie.println("DB: "+cle);
                            System.out.println(" Exception: "+valeur);
                            sortie.println(" Exception: "+valeur);
                        }
                        sortie.println("Hop !");
                        System.out.println("Hop !");
                        sortie.println("\n");
                     }
L'objet "exceptions" contient en clé, le nom d'une base de donnée, et en valeur l'exception levée pour cette DB, lors de la connexion à la base.

Donc là mon but est d'afficher tout ce qu'il y a dans "exceptions"

Voici ce qui est affiché par les System.out.println (côté serveur):
DB: DB1
Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
DB: DB2
Exception: java.sql.SQLException: ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
SVR4 Error: 2: No such file or directory

DB: DB3
Exception: java.sql.SQLException: Io exception: Connection refused
DB: DB4
Exception: java.sql.SQLException: Io exception: Connection refused
DB: DB5
Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
DB: DB6
Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
DB: DB7
Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
DB: DB8
Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
DB: DB9
Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
DB: DB10
Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
DB: DB11
Exception: java.sql.SQLException: ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
SVR4 Error: 2: No such file or directory

...
Et voici ce qui est displayé côté client avec les sortie.println:
Exceptions triggered the last minute:
DB: DB1
Exception: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
DB: DB2
Exception: java.sql.SQLException: ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
SVR4 Error: 2: No such file or directory
Connexion closed...
En gros, le serveur envoie sur le flux les deux premières erreurs/exceptions, puis, plus rien, perte du flux...

Voici côté client comment je lis le flux:
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
 
else if(options!=null && options.contains("e"))
                    {
                        String message = args[0];
                        sortie.println(message);
                        do 
                        {
                            reponseDuServeur = entreeDepuisServeur.readLine();
                            if(reponseDuServeur.isEmpty()==false)
                            {    
                                System.out.println(reponseDuServeur);
                            }
                        }
                        while(reponseDuServeur.isEmpty()==false);
 
                    }
(je pense que le code n'est pas difficile à décrypter...)

Vous avez une idée du pourquoi qu'j'ai pas un affichage complet côté client ?

J'ai essayé en faisant un affichage sur le flux de sortie (côté serveur) de le String "plop", juste à la fin de ma boucle while, et juste au début... et rien ne s'affiche lorsque le flux est perdu ('fin, perdu, je suppose quoi...)

Oukélé mon erreur ?

D'avance merci.
Bien à vous.