Ciao a tutti,
sto cercando di leggere due file di testo e inserirli in due stringhe.
Ho qualche problema nella catturare e gestire delle exceptions.
Vorrei che in qualsiasi caso che il bufferedReader sia chiuso. Ma così come è adesso ho un errore nella compilazione:
la porzione di codice:codice:unreported exception java.io.IOException; must be caught or declared to be thrown in.close(); ^
Consigli, critiche sono ben accette.codice:BufferedReader in = null; try{ in = new BufferedReader(new FileReader( getServletConfig().getInitParameter("mailHeadPart"))); while (in.readLine()!= null) { headPart = headPart + in.readLine(); } in = new BufferedReader(new FileReader( getServletConfig().getInitParameter("mailBottomPart"))); while (in.readLine() != null) { bottomPart = bottomPart + in.readLine(); } }catch(java.io.IOException ex){ in.close(); }finally{ // }
Grazie![]()

Rispondi quotando