We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Error message doesn't make any sense
Page Index Toggle Pages: 1
Error message doesn't make any sense (Read 1302 times)
Error message doesn't make any sense
Sep 3rd, 2009, 3:57pm
 
I get an error message

"Cannot find a class or type named 'Manager'"

but this doesn't make any sense, I have that class.

...

here is the Project if you want to try it yourself:
tetris.zip (9 KB)
Re: Error message doesn't make any sense
Reply #1 - Sep 3rd, 2009, 4:47pm
 
It does make sense - you've got some problems with braces in your Highscore tab.  The Highscore class is closed too soon and an extra brace added after your Entry class.  I guess the interpreter doesn't see your Manager class because the misplaced brace has somehow 'obscured' it...

Once you sort that it should work - it does for me, though I don't much like your choice of keyboard controls; but maybe I'm just being clumsy as it's rather late here.  Time to sleep Shocked
Re: Error message doesn't make any sense
Reply #2 - Sep 3rd, 2009, 6:27pm
 
thanx.  I think this time it was me who is the blind fish.
The controlls are intended to be used with one hand, so I can play while sitting on the other hand. The arrow keys are too fubar on my laptop.
The next thing I'll implement will be a feature that I can enter a name for the highscore.

Quote:
Time to sleep

very good idea.
Re: Error message doesn't make any sense
Reply #3 - Sep 6th, 2009, 3:02pm
 
I continue my quest in getting error messages without any sense
...

how can arc2 be null here?

circles.zip (3 KB)

at first it runs smoothly, but after you move around a little bit you get the exception.

Re: Error message doesn't make any sense
Reply #4 - Sep 10th, 2009, 10:40am
 
Re: arc1 being null:
your conditional actually guarantees that it will be null every time.  In short, you have:

if (arc1 != null){ // do this stuff if arc1 exists
 // arc1stuff
}
else if (arc2 != null){ // that is, if arc1 is null AND arc2 is not null
 arc2.draw();
 arc1.draw(); // <-- whoops!
}

--Ben
Re: Error message doesn't make any sense
Reply #5 - Sep 10th, 2009, 11:48am
 
ben_hem wrote on Sep 10th, 2009, 10:40am:
Re: arc1 being null:
your conditional actually guarantees that it will be null every time.  In short, you have:

if (arc1 != null){ // do this stuff if arc1 exists
 // arc1stuff
}
else if (arc2 != null){ // that is, if arc1 is null AND arc2 is not null
 arc2.draw();
 arc1.draw(); // <-- whoops!
}

--Ben

that is not true
I have if (arc1 == null).

By the way the error doesn't come always. It comes in irregular timesteps.

I solved this problem with a try-catch-block and then I ignored the null Pointer exception. It runs smoothly, but it is not very clean. Any help is welcome.
Re: Error message doesn't make any sense
Reply #6 - Sep 10th, 2009, 12:06pm
 
OK, I had time to test it. I can reproduce the problem.
My interpretation is that mouseMoved() is called asynchronously with regard to draw().
So my guess is that we have a myshape.append(mycircle) call between arc1.draw() and arc2.draw()... resulting in the NPE even though you correctly protected the accesses!

The fact I can reproduce that quite easily when mouse is going fast tends to corroborate the hypothesis.

I did the following change:
Code:
    synchronized (center)
{
if (verts == null){
arc1 = null;
// [...]
arc2 = new Arc(center,a,b);
}
}
// [...]
void draw(){
synchronized (center)
{
if (arc1 == null){
// [...]
arc2.draw();
}
}
}

ie. I added two synchronized blocks around the arcx accesses, and I could no longer reproduce the crash.
Re: Error message doesn't make any sense
Reply #7 - Sep 10th, 2009, 4:35pm
 
Quote:
that is not true
I have if (arc1 == null).


My bad!  glad you got it.
Re: Error message doesn't make any sense
Reply #8 - Sep 12th, 2009, 10:35am
 
thanks to all
I will try it as soon as I can.
Page Index Toggle Pages: 1