Ben initially coded the openOutputFile() from Listing 2.3 as follows. What do you think of this implementation?
```
33 public void openOutputFile( String outfileName ) {
34 try{
35 outfile = new Formatter( outfileName );
36 } catch ( FileNotFoundException e ) {
37 System.err.printf( "Error opening output file: %s\n%s",
38 outfileName, "Exiting application." );
39 } catch ( SecurityException e ) {
40 System.err.printf( "Error insufficient write access to " +
41 "create file: %s\n", outfileName );
42 }
43 finally {
44 infile.close();
45 System.exit( 1 );
46 }
47 }
```
There is nothing incorrect with the implementation, but it could be argued that exiting (line 45) is a bit drastic. An alternative is to dispose of the finally clause (lines 43 – 46) so that when an exception is thrown, the method is exited right away and the caller gets to decide what to do. For example, the caller may be able to ask the user for a different file name and retry the openOutputFile() operation.
You might also like to view...
Here is a function prototype and a few lines of code. What is the correct call statement?
```void Function(int *p, int &r, string s);
int a, b;
string s;
DNS ____________________ consists of inserting incorrect translation information within the DNS server (or within the communication between the resolver and server) in order to take a legitimate domain name and point the resolver to a malicious server, thereby secretly subverting the session.
Fill in the blank(s) with the appropriate word(s).
Table Styles gallery does NOT contain the ________ category
A) Best Match for Document B) Customize for Slide C) Light D) Medium
If you want to expand or compress text horizontally, you should use the ________ character spacing setting
A) scale B) default C) kerning D) position