September 2005 NetBeans Platform JNB Errata

A couple of people have reported problems running the example from my September article on the NetBeans platform. I have included some information about how to fix these.

Ant "Duplicate Target" Error

The first problem may occur when running the ant tryme target using a recent version of Ant (version 1.6.5 is known to react this way). If you get a "duplicate target" error referencing the javahelp-impl target, then see my post to the NetBeans mailing list that explains how to fix it. Basically, you can either replace your projectized.xml file with the one I included in the post, or you can use a version of Ant (such as 1.6.2) that ignores the duplicate target problem. Note that I have fixed this in the cluster build harness that comes with the October Java News Brief follow-up article I wrote.

DiskExplorer IllegalArgumentException (DataObject.find on null)

The second problem that has been reported, which I can't seem to reproduce, is that the disk explorer causes an IllegalArgumentException with a message similar to this:

  Called DataObject.find on null at org.openide.loaders.DataObject.find

Edit the file and find the initCollection() method. Add the three lines shown just below my comment here (I included some code above and below what you are supposed to add so it will be easier for you to find your place):

   for (int i=0; i < driveRoots.length; i++) {    
      File f = FileUtil.normalizeFile(driveRoots[i]);    
      FileObject fo = FileUtil.toFileObject(f);

      // add the next three lines to your file
      if (fo == null) {
   // original code continues here

Save the file and try "ant tryme" again.

Thanks to Jesse Glick of Sun for coming up with the Disk Explorer fix and committing it to CVS.