This page is here to give some direction for people stuck on programming problems that I've hit. Yay a few people have emailed that this page actually helped.


*** NSTimer ignoring exception 'NSInvalidArgumentException' (reason '*** -addObject: only defined for abstract class. Define -[WWDataSource10 addObject:]!') that raised during posting of timer with target 1740bb0 and selector 'setup2:

and

*** NSTimer ignoring exception 'NSInvalidArgumentException' (reason '*** initialization method -initWithCapacity: cannot be sent to an abstract object of class WWDataSource10: Create a concrete instance!') that raised during posting of timer with target 1c01c0 and selector 'setup2:'

These two exceptions were raised because I tried to subclass NSMutableArray directly. NSArray, NSMutableArray, and bunch of other Foundation classes are part of a class cluster. There's some more info at this link. What it basically says is that subclassing one of these classes is probably not what you want to do--you probably want to just create another class as a container and embed the NSArray or whatever in it. But don't take it from me...read the document yourself.


Not really a bug, but say you are trying to build or decipher AppleEvents and you get 'seld:abso(Ç616C6C20È)':

Very simple: read as hex characters, 616C6C20 spells 'all ', and it means "get every instance".


In the Mac OS implementation of the JRE (I'm using 1.4.2 under OS X 10.3.9), there may be some spacing problems in a JTable created after opening a JFileChooser.

By default, a table uses a javax.swing.table.JTableHeader.UIResourceTableCellRenderer (which extends DefaultTableCellRenderer). That class gets its border by calling javax.swing.UIManager.getBorder("TableHeader.cellBorder"). In my JRE, that border is an apple.laf.AquaListHeaderBorder, which has a method setHorizontalShift(int). JFileChooser has a bug where it calls setHorizontalShift on that border, which will be reused by future JTables, affecting the spacing of their header labels. I work around the problem by calling the following method after showing (and hiding) a JFileChooser:

    private static void workAroundJFileChooserBug() {
        try {
            Object o = javax.swing.UIManager.getBorder( "TableHeader.cellBorder" );
            Method m = o.getClass().getMethod( "setHorizontalShift",
                                               new Class[] { int.class } );
            m.invoke( o, new Object[] { new Integer(0) } );
        } catch ( Exception e ) { }
    }
This code uses reflection so it can compile if apple.laf.AquaListHeaderBorder is not available in the classpath.


How to access a static inner class (nested class) from OGNL:

I don't think it appears anywhere in the OGNL documentation, but you would use a dollar sign to refer to a static inner class. For example, "@com.asdf.Asdf$MyInner@VAL" would give a value of 5:

    package com.asdf;
    public class Asdf {
        public static class MyInner {
            public static final int VAL = 5;
        }
    }


up