Bonjour,
Je ne comprends pas pourquoi je ne peux pas "catcher" depuis la classe spécialisée IOException mais depuis la générique Exception
erreur Exception : is never thrown in body of corresponding ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String mApplicationRootDirectory = sc.getRealPath("/"); String s = new File(mApplicationRootDirectory).getAbsolutePath(); } catch (IOException ioe) { System.out.println("Erreur Fichier") }
Exception qui fonctionne
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String mApplicationRootDirectory = sc.getRealPath("/"); String s = new File(mApplicationRootDirectory).getAbsolutePath(); } catch (Exception e) { throw new IOException("Erreur fichier"); }
Partager