Note: if you downloaded the Sample files on or after January 13, 1998, the fixes are incorporated into the code already and you do not need to reapply them. --- Some general comments about the use of the sample code for Developing Java Beans: There are, in fact, a number of mistakes in the code. I apologize to anyone that has been inconvenienced or frustrated by these errors. The section below (Code Fixes) addresses these mistakes. I have attempted to address these changes based upon jdk 1.2 beta 2. In doing so, I have discovered that the new security management architecture breaks the serialization code in chapter 5 (and elsewhere). This is due to the fact that I open FileInputStream and FileOutputStream objects, which now cause a security violation. I have not attempted to direct the reader to the proper way to deal with this as I am not familiar with the new security architecture, so this should be noted. Here are a few pointers for compiling the code: - make sure your CLASSPATH variable points to your current directory, as well as the root of your package path. - the code examples that are not part of a package should be compiled and executed from a common directory. - the code examples that are part of package BeansBook.util should be compiled and run from the appropriate BeansBook\util package directory. - the code examples that are part of package BeansBook.Simulator should be compiled and run from the appropriate BeansBook\Simulator package directory. - the code should be compiled in the order that it appears in the book! - code is placed into chapter directories in the ZIP file so that the reader knows where to look for it on a chapter by chapter basis. before compiling, the code should be placed into the appropriate directory, either the common directory, the BeansBook\util directory, or the BeansBook\Simulator directory, as appropriate. - code that evolves within a chapter is annotated with a .1, .2, etc, indicating the sequenced evolution of the code within the chapter. - I haven't provided any sample HTML files for running the sample applets, as that should be a no brainer for the reader. Code Fixes For: Developing Java Beans Page 36: [the wrong interface name is used] change implements TemperatureChangeListener to implements TempChangeListener Page 38: [the invocation of super() references a class variable too early] change TemperatureAdapter1() { super(theTemperature1); } to TemperatureAdapter1(Temperature t) { super(t); } [the invocation of super() references a class variable too early] change TemperatureAdapter2() { super(theTemperature2); } to TemperatureAdapter2(Temperature t) { super(t); } Page 39: [the trailing semicolon(;) does not belong] change (double newTemp); to (double newTemp) Page 45: [these method calls must account for the NoSuchMethodException] change tempAdapter.registerEventHandler(theTemperature1, "temperature1Changed"); tempAdapter.registerEventHandler(theTemperature2, "temperature2Changed"); to try { tempAdapter.registerEventHandler(theTemperature1, "temperature1Changed"); tempAdapter.registerEventHandler(theTemperature2, "temperature2Changed"); } catch (NoSuchMethodException e) { System.out.println(e); } Page 46: [this method should be public] change protected void temperature1Changed to public void temperature1Changed [this method should be public] change protected void temperature2Changed to public void temperature2Changed Page 47: [this constructor may throw a ClassNotFoundException] change public GenericButtonAdapter(Object target) to public GenericButtonAdapter(Object target) throws ClassNotFoundException Page 49: [cast is required] change (in all three places) Button b = e.getSource(); to Button b = (Button)e.getSource(); [wrong parameter type] change public void handleB3(MouseEvent e) to public void handleB#(ActionEvent e) Page 56: [this method should be synchronized] change public void pollSent(PollEvent e) to public synchronized void pollSent(PollEvent e) [the resume() method has been deprecated] change this.resume(); to this.notify(); Page 57: [the suspend() method has been deprecated] change this.suspend(); to try { this.wait(); } catch (Exception e) { } Page 68: [typo] change PropertyChangedEvent evt = to PropertyChangeEvent evt = [typo] change new PropertyChangedEvent to new PropertyChangeEvent Page 75: [missing class member] add a member to the Thermometer class as follows protected Temperature theTemperature; [typo] change constrainedhandler to constrainedHandler Page 76: [typo] change constrainedhandler to constrainedHandler Page 113: [variable s should be stream] change (2 places) s.writeObject to stream.writeObject [variable s should be stream] change s.readObject to stream.readObject Page 160: [code should not be commented out] change // boolean bWriteNull to boolean bWriteNull Page 168: [missing import declaration] add to the import list import java.io.*; Page 175: [wrong type used] change new Integer(d.longValue to new Long(d.longValue Page 182: [variable s should be stream] change (2 places) s.writeObject to stream.writeObject [missing space] change if (heatingListeners!= null) to if (heatingListeners != null) Page 183: [variable s should be stream] change (2 places) s.writeObject to stream.writeObject [variable s should be stream] change s.readObject to stream.readObject Page 217: [missing catch block] add another catch block catch (IntrospectionException e) { return null; }