Without exception handling.
- By Matt Brenner
- September 24, 2001
Lab Notes
Clarifying exception handling
by Matt Brenner
Listing 3. Without exception handling.
1 private void
2 addlist (String listname, boolean uppercase)
3 {
4 BufferedReader input = null;
5
6 String text;
7
8
9 input = new BufferedReader (new FileReader (new File (Setup.getinstalldir(), listname)));
10 while ((text = input.readLine()) != null) {
11 if (text.length() > 0) {
12 add (text, uppercase);
13 }
14 }
15
16 if (input != null) {
17 input.close();
18 }
19 }