From dc9c53f7d3dcd87908f9e91fbc8b7a42f81c313c Mon Sep 17 00:00:00 2001
From: gabriel mille <gabriel.mille.etu@univ-lille.fr>
Date: Thu, 5 Sep 2024 10:22:12 +0200
Subject: [PATCH] correction new input

---
 src/main/java/bitFight/Input.java | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/main/java/bitFight/Input.java b/src/main/java/bitFight/Input.java
index e1f8616..ffef1bb 100644
--- a/src/main/java/bitFight/Input.java
+++ b/src/main/java/bitFight/Input.java
@@ -27,7 +27,7 @@ public class Input {
 
     }
 
-    public void newInput() {
+    public void newInput() throws IOException {
         BufferedReader in= new BufferedReader( new InputStreamReader(System.in));
 
         do {
@@ -36,14 +36,17 @@ public class Input {
                     setInput(in.readLine());
                 } catch (IOException e) {
                     // TODO Auto-generated catch block
-                    e.printStackTrace();
-                }     
+                    System.err.println(e.getMessage() + ": Contact support");
+                } 
             } catch (InvalidInputException e) {
-                Display.newPrintln(e.getMessage());
+                    Display.newPrintln(e.getMessage());
+            } catch (Exception e) {
+                System.err.println(e.getMessage()+": Contact support");
+            } finally {
+                in.close();
             }
         }
         while (!validInput());
-            
     }
 
     public Input() {
-- 
GitLab