Without exception handling.

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 }

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.