« Return to Thread: Layer worker Construct

Re: Layer worker Construct

by Jeff_K :: Rate this Message:

| View in Thread


Jeff_K wrote:
On Fri, Nov 7, 2008 at 10:56 AM, Jeff Kuntz <jeffrey.kuntz@gmail.com> wrote:
> Hey everyone,
>
> I have recently upgraded to the new version of openmap, version 4.6.3
> to 4.6.4.  In my application I have several shapefiles that I have
> been using with no problems at all.  After I upgraded to the new
> version I am now getting an error from the openmap code
> "layername|LayerWorker.construct(): null".  I am getting this error
> with two of my shapefiles but a third that is very similar is just
> fine.  I googled the problem and found an old post on the openmap
> forums to modify come code in the ESRIPolygonRecord.java file, but the
> openmap code already has this modification.
>
> I am assuming that this problem has to do with the new version since
> the application worked just fine before had and I was wondering if
> anyone else has ran into this problem using the new version of
> openmap?  If you have any tips, suggestions, hints or anything it
> would be awsome to hear about them.
>
> Thanks,
>
> Jeff
>

I just wanted to add to my previous post.  I debugged the problem a
bit more by adding some print statements to the openmap code to try to
figure out what was causing the problem.  Below is a stack trace from
the the construct() method in the LayerWorker class that is defined in
OMGraphicHandlerLayer.

java.lang.NullPointerException
        at com.bbn.openmap.dataAccess.shape.DbfHandler.evaluate(DbfHandler.java:249)
        at com.bbn.openmap.layer.shape.SpatialIndex.getOMGraphics(SpatialIndex.java:519)
        at com.bbn.openmap.layer.shape.ShapeLayer.prepare(ShapeLayer.java:522)
        at com.bbn.openmap.layer.policy.StandardRenderPolicy.prepare(StandardRenderPolicy.java:99)
        at com.bbn.openmap.layer.OMGraphicHandlerLayer$LayerWorker.construct(OMGraphicHandlerLayer.java:695)
        at com.bbn.openmap.util.SwingWorker$2.run(SwingWorker.java:127)
        at java.lang.Thread.run(Unknown Source)

In the DbfHandler.evaluate method it seems that this line of code is breaking:

Integer index = (Integer)
omg.getAttribute(ShapeConstants.SHAPE_INDEX_ATTRIBUTE);

Is this caused by a bad dbf file?  Have there been any changes to this
code from the last version?

Jeff

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Just wanted to post one more time because I think I know what the problem is now and I am trying to figure out a good solution.  The problem that I can see is that the openmap code is throwing an exception in the getOMGraphics method in the SpatialIndex.java file.  Inside this method there is a section of code that says:

                    if (dbf != null) {
                        omg = dbf.evaluate(omg, labels, mapProj);
                    }

If i comment this line out my program works like it used to without a problem.  I am getting a null pointer out of this line of code.  I specify these layers in the openmap properties file and only set the keys layerName.shapeFile and layerName.spatialIndex.  What I don't understand is how the dbf object is getting set to a non null value.  I would imagin that a quick solution would be to set a dbf file in the properties file but I am not certain whether there is a key for this.  Is there a "layerName.dbfFile" key?

Or can I leave these three lines commented out and just compile openmap like this?  will there be any adverse effects by doing this?

Thanks,

Jeff

 « Return to Thread: Layer worker Construct