wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes source code question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "source code question" Watch "source code question" New topic
Author

source code question

Joe Stewart
Greenhorn

Joined: Dec 09, 2004
Posts: 6
Andrew, the examples for your book don't compile with the files Server.java and RmiSocketExample.java.

Server.java gives a duplicate class error, and RmiSocketExample.java has numerous problems. Are these files just work product that you forgot to remove, or do you have a new RmiSocketExample.java?
[ December 31, 2005: Message edited by: Joe Stewart ]
Joe Stewart
Greenhorn

Joined: Dec 09, 2004
Posts: 6
Andrew, I also notice that the DennysDVDs2.0 test harness code is missing from the source code archive. The book states that is should be in the directory src/sampleproject/test, but the directory does not exist.
[ December 31, 2005: Message edited by: Joe Stewart ]
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11479
    
  94

Hi Joe,

Sorry - RmiSocketExample.java is not meant to be in that directory (I will have to check with my co-author, but I think that class is not meant to exist at all). Likewise Server.java should not exist either.

I will have to add a comment in the eratta that RmiProblem.java has a Server class, so you cannot have it compiled at the same time as compiling Server.java (however as previously mentioned, Server.java should not exist).

As for the test code - we had made a concious decision not to include test code in the book itself (long story), and I thought we had removed any statements suggesting that we would provide test code. I will have to check into this.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Joe Stewart
Greenhorn

Joined: Dec 09, 2004
Posts: 6
Andrew,

The file NotifyVersusNotifyAll.java included in the source archive differs from the code in the book, and does not behave as shown in the book. I changed line 25 to mutex.wait(2000); and then it works as shown.

It's not clear to me from your earlier reply why the test code wasn't included in the source archive. Is the code as shown in the book, chapter 9, for DBTester.java and DBTestRunner.java complete and correct? If I take the time to type it up myself, will it compile and run properly?
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11479
    
  94

Hi Joe,

Sorry for the delay in responding to this.

A new version of the codebase should be uploaded in the next day or two. It will have the test package and corrections to the "src - examples" code.

Unfortunately changing line 25 to mutex.wait(2000) does not show the difference between notify() and notifyAll(). The code should read as:

Thanks for all your comments. Please let me know if you find more issues.

Regards, Andrew
[ January 12, 2006: Message edited by: Andrew Monkhouse ]
Joe Stewart
Greenhorn

Joined: Dec 09, 2004
Posts: 6
Andrew,

Thanks. I get the following error when compiling the test package:

joe@notebook:~/scjd/src> javac sampleproject/test/*.java
sampleproject/test/DBTester.java:50: getRemote(java.lang.String,java.lang.String) in sampleproject.remote.DvdConnector cannot be applied to ()
db = DvdConnector.getRemote();
^
1 error

Also, what is the link to the current errata list? The only link I could find on the book's page is to a submission form.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: source code question