Java Enterprise in a Nutshell By David Flanagan, Jim Farley, William Crawford & Kris Magnusson This errata page lists errors outstanding in the most recent printing. If you have any error reports or technical questions, you can send them to booktech@oreilly.com. (Please specify the printing date of your copy.) This page was updated August 16, 2000. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: {129} code near middle of page: now reads: // Try loading from disk try { File r = new File("./data/counter.dat"); DataInputStream ds = new DataInputStream(new FileInputStream(r)); timesAccessed = ds.readInt(); } catch (FileNotFoundException e){ // Handle error } catch (IOException e){ // This should be logged } finally{ ds.close(); } should read: // Try loading from the disk try { File r = new File("./data/counter.dat"); DataInputStream ds = new DataInputStream(new FileInputStream(r)); timesAccessed = ds.readInt(); ds.close(); } catch (FileNotFoundException e) { // Handle error } catch (IOException e) { // This should be logged } In other words, strike the last three lines and insert "ds.close();" as the fourth line under "try". {130} code: now reads: public void destroy() { // Write the integer to a file File r = new File("./data/counter.dat"); try { DataOutputStream dout = new DataOutputStream(new FileOutputStream(r)); dout.writeInt(timesAccessed); } catch (IOException e){ // this should be logged } finally { dout.close(); } } should read: public void destroy() { // Write the Integer to a file File r = new File("./data/counter.dat"); try { DataOutputStream dout = new DataOutputStream(new FileOutputStream(r)); dout.writeInt(timesAccessed); dout.close(); } catch(IOException e) { // This should be logged } } That is, strike these three lines: finally ( dout.close(); }