Without looking at the Src / stack trace, I'm going to assume that you
are looking for a non-renderable layer ... so you may want to check that
contentId is also not null incase the internal code is missing some
defensive programming.

if(contentID == null || getRenderer(contented) == null){
        ...
}

David

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Sunburned Surveyor
Sent: May 21, 2007 2:08 PM
To: List for discussion of JPP development and use.
Subject: Re: [JPP-Devel] I could really use some help with this question
onthe RenderingManager...

Larry,

Thanks for clarifying that. I'm going to compare the render() methods
in JUMP, OpenJUMP, and in my modified code.

When I changed the statement

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

back to the statement

if (getRenderer(contentID == null)

the NullPointerException is generated in a later statement in the
render() method. This tells me that at some point the render() method
in OpenJUMP is passed a null value.

If this wasn't the case the statement

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

would never generate a NullPointerException.

I'll get back to the list if I ever figure out what is going on.

The Sunburned Surveyor

On 5/21/07, Larry Becker <[EMAIL PROTECTED]> wrote:
> Wishful thinking.  There are no layers in an empty project, so there
are no
> renders.
>
>
> Larry
>
> On 5/21/07, Sunburned Surveyor < [EMAIL PROTECTED]> wrote:
> > I just realized OpenJUMP isn't passing the LayerViewPanel or any
other
> > "phantom" object to the render() method.
> >
> > The only way the
> >
> > if (getRenderer(contentID).equals(null))
> >
> > statement could be causing a NullPointerException is if OpenJUMP was
> > passing the render() method a null value.
> >
> > I think it does this when opening an "empty" project or right before
a
> > pan and zoom.
> >
> > I'll see if I can modify the render() method to handle this. Maybe
Jon
> > would remember how this code works...
> >
> > SS
> >
> > On 5/21/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote:
> > > Larry,
> > >
> > > This makes sense. I didn't think about the fact that I was calling
the
> > > Object.equals method in this line.
> > >
> > > I find your comments interesting because a Layer object is not
passed
> > > to OpenJUMP when a project is first opened. Maybe this is why I
can
> > > rendering works with no error when I load a Shapefile. In this
case I
> > > know OpenJUMP is being passed a valid Layer object.
> > >
> > > I think something besides a layer is being passed to the render()
> > > fmethod when OpenJUMP first opens up an empty project. I think
this
> > > same "phantom" object is being passed before any Layerables the
Layer
> > > View is panned or zoomed.
> > >
> > > Perhaps the render() method is passed a reference to the
> > > LayerViewPanel itself? I'll have to take a look at the code in
JUMP to
> > > see if I can figure this out.
> > >
> > > Very interesting. At least I am beginning to think the problem
isn't
> > > in any of the classes that I introduced.
> > >
> > > The Sunburned Surveyor
> > > > Hi SS,
> > > >
> > > > You said:
> > > > The line that is generating the error mesage is this:
> > > >
> > > > if (getRenderer(contentID).equals(null))
> > > > The only way that could be true is if contentID is null.  If I
> remember
> > > > correctly, contentID is basically the layer object.
> > > >
> > > > Larry
> > > >
> > > >
> > > >
> > > > On 5/21/07, Sunburned Surveyor < [EMAIL PROTECTED]>
wrote:
> > > > >
> > > > > Sascha,
> > > > >
> > > > > This is how the method was coded first, and I still got the
error
> > > > > message. I changed it today thinking that might fix the
problem.
> > > > >
> > > > > Do you have any other ideas?
> > > > >
> > > > > The Sunburned Surveyor
> > > > >
> > > > > On 5/21/07, Sascha L. Teichmann < [EMAIL PROTECTED]>
wrote:
> > > > > > -----BEGIN PGP SIGNED MESSAGE-----
> > > > > > Hash: SHA1
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > What about rewriting
> > > > > >
> > > > > > getRenderer(contentID).equals(null)
> > > > > >
> > > > > > as
> > > > > >
> > > > > > getRenderer(contentID) == null
> > > > > >
> > > > > > ?
> > > > > >
> > > > > > - - Sascha
> > > > > >
> > > > > > Sunburned Surveyor schrieb:
> > > > > > > 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
> > > > > > -----BEGIN PGP SIGNATURE-----
> > > > > > Version: GnuPG v1.4.2.2 (GNU/Linux)
> > > > > > Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
> > > > > >
> > > > > >
> > > >
> iD8DBQFGUe9zsrvOlFf8EzcRAp76AJ9c67RdzncWmgt8O6U+Xy/tmti3KQCg0VOj
> > > > > > SWcwqwDJ9htfc9SJe1t+Ozo=
> > > > > > =qsZ3
> > > > > > -----END PGP SIGNATURE-----
> > > > > >
> > > > > >
> > > >
>
------------------------------------------------------------------------
-
> > > > > > 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
> > > > > >
> > > > >
> > > > >
> > > >
>
------------------------------------------------------------------------
-
> > > > > 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
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > http://amusingprogrammer.blogspot.com/
> > > >
>
------------------------------------------------------------------------
-
> > > > 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
> > > >
> > > >
> > >
> >
> >
>
------------------------------------------------------------------------
-
> > 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
> >
>
>
>
> --
> http://amusingprogrammer.blogspot.com/
>
------------------------------------------------------------------------
-
> 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
>
>

------------------------------------------------------------------------
-
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


-------------------------------------------------------------------------
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