if (shape instanceof OMPoly) {
if (!(shape instanceof EsriPolygon) && shape instanceof OMPoly) {
    public void add(OMGraphic shape) {        try {            if (shape instanceof OMPoly) {                shape = EsriPolygon.convert((OMPoly) shape);                // test for null in next if statement.            }            if (shape instanceof OMGraphicList) {                OMGraphicList list = (OMGraphicList) shape;                EsriGraphic graphic = (EsriGraphic) list.getOMGraphicAt(0);                if (graphic instanceof EsriPolygon                        || graphic instanceof EsriPolygonList) {                    graphics.add(shape);                    addExtents(((EsriGraphicList) shape).getExtents());                } else if (graphic instanceof OMGraphic) {                    // Try recursively...                    add((OMGraphic) graphic);                } else {                    Debug.message("esri",                            "EsriPolygonList.add()- graphic list isn't a EsriPolygonList, can't add.");                }            } else if (shape instanceof EsriPolygon) {                graphics.add(shape);                addExtents(((EsriPolygon) shape).getExtents());            } else {                Debug.message("esri",                        "EsriPolygonList.add()- graphic isn't a EsriPoly or OMPoly, can't add.");            }        } catch (ClassCastException cce) {        }    }