I'm about ready to give up on this pluggable rendering system for OpenJUMP. :]

I created JUnit tests for the two main classes involved, namely
RendererFactory and RegularRendererFactoryTool. All the JUnit tests
for the public methods in both the classes pass with no problems now
that I have made some corrections to my code.

I built OpenJUMP today so that I could test the modified code.
OpenJUMP opens but gives me an error message after displaying the
layer view. The error message is again a NullPointerException but this
time it is coming from the render() method of the RenderingManager
class which seems odd.

The line that is generating the error mesage is this:

if (getRenderer(contentID).equals(null))

This really confuses me, since it seems that we are calling the
getRendererMethod which is defined in the same class,
RenderingManager, that also defines the render() method that is
throwing an exception.

How can I be generating a NullPointerException from this method? If
the NullPointerException was coming from inside the getRenderer()
method itself, wouldn't that be indicated in the stack trace of the
exception?

I should also mention that OpenJUMP correctly renders a layer when I
am adding a new layer to the project, but that any attempts to pan or
zoom the Layer View result in the same NullPointerException that is
produced when OpenJUMP first opens.

I'm really lost with this one. Any help or suggestions of where to
look for the source of this NullPointerException would be greatly
appreciated.

Thanks in advance for the help.

The Sunburned Surveyor

P.S. - I have attached the text will all of the statements of the
RenderingManager.render() method if you want to take a look.
        public void render(Object contentID, boolean clearImageCache) {

                if (getRenderer(contentID).equals(null)) 
                {
                        /* 
                         * Modified this method to wrap the call to 
createRenderer() in a try/catch block.
                         * [The Sunburned Surveyor 2007-05-02]
                         * 
                         */
                        try
                        {
                                setRenderer(contentID, 
createRenderer(contentID));
                        }
                        
                        catch(ExcPluggableRendererNotFound thisException)
                        {
                                System.err.println(thisException.getMessage());
                        }
                }

                if (getRenderer(contentID).isRendering()) {
                        getRenderer(contentID).cancel();

                        //It might not cancel immediately, so create a new 
Renderer [Jon
                        // Aquino]
                        
                        /* 
                         * Modified this method to wrap the call to 
createRenderer() in a try/catch block.
                         * [The Sunburned Surveyor 2007-05-02]
                         * 
                         */
                        try
                        {
                                setRenderer(contentID, 
createRenderer(contentID));
                        }
                        
                        catch(ExcPluggableRendererNotFound thisException)
                        {
                                System.err.println(thisException.getMessage());
                        }
                }

                if (clearImageCache) {
                        getRenderer(contentID).clearImageCache();
                }
                Runnable runnable = getRenderer(contentID).createRunnable();
                if (runnable != null) {
                        // Before I would create threads that did nothing. Now 
I never do
                        // that -- I just return null. A dozen threads that do 
nothing make
                        // the system sluggish. [Jon Aquino]
                        ((contentID instanceof Layerable && ((Layerable) 
contentID)
                                        
.getBlackboard().get(USE_MULTI_RENDERING_THREAD_QUEUE_KEY,
                                                        false)) ? 
multiRendererThreadQueue
                                        : 
defaultRendererThreadQueue).add(runnable);
                }

                if (!repaintTimer.isRunning()) {
                        repaintPanel();
                        repaintTimer.start();
                }
        }
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to