Code cleanups.
[TD_SR.git] / TD2 / server / BroadcastoThreadService.java
index 5ade5f328d87c830acc03a741e6eac18c880b3ef..df56d31ed4c87c18a7041241be3d870f258fde23 100644 (file)
@@ -25,7 +25,7 @@ public class BroadcastoThreadService implements Runnable {
                        e.printStackTrace();
                }
                catch (ClassNotFoundException e) {
-               System.err.println("ClassNotFoundException: " + e);
+                       System.err.println("ClassNotFoundException: " + e);
                        e.printStackTrace();
                }
                finally {
@@ -48,8 +48,8 @@ public class BroadcastoThreadService implements Runnable {
         * @throws ClassNotFoundException [description]
         */
        public void doService(Socket clientSocket, ArrayList<ObjectOutputStream> sharedList) throws IOException, ClassNotFoundException {
-               ObjectInputStream OReader = new ObjectInputStream(clientSocket.getInputStream());
                ObjectOutputStream OWriter = new ObjectOutputStream(clientSocket.getOutputStream());
+               ObjectInputStream OReader = new ObjectInputStream(clientSocket.getInputStream());
                sharedList.add(OWriter);
                boolean end = false;
                while (!end) {
@@ -61,10 +61,10 @@ public class BroadcastoThreadService implements Runnable {
                        broadcastoMsg(roMsg);
                }
                sharedList.remove(OWriter);
-               if (OReader != null)
-                       OReader.close();
                if (OWriter != null)
                        OWriter.close();
+               if (OReader != null)
+                       OReader.close();
                System.out.println("Fin du thread repondant au client, port "
                                                        + clientSocket.getPort());
        }