So yeah, weird error. ^^

So, I was just messing about with my mouse controller, just spam clicking on my window… and all of a sudden, BAM! A flying monkey! … Or rather, a flying error… :stuck_out_tongue:

java[14452:707] Lookup: Unhandled exception 'JavaNativeException' caught in __56+[LULookupDefinitionModule focusTermUsingQueue:handler:]_block_invoke_0

I have no idea what that error means. It didn’t look like anything stopped working either as it kept printing my mouse coords whenever I clicked the mouse.

Here’s my super simple input class:

public class MouseController extends MouseInputAdapter {
	
	private static boolean clicked = false;
	private static Point mousePosition = new Point();

	public static boolean clicked() {
		boolean val = MouseController.clicked;
		MouseController.clicked = false;
		return val; 
	}
	
	public static Point getPosition() {
		return MouseController.mousePosition;
	}
	
	@Override
	public void mouseClicked(MouseEvent e) {
		MouseController.clicked = true;
	}
	
	@Override
	public void mouseMoved(MouseEvent e) {
		MouseController.mousePosition.x = e.getX();
		MouseController.mousePosition.y = e.getY();

		MouseController.clicked = false;
	}
}

Anyone has any idea of what caused that error? ^^

Cheers! :smiley:

And eclipse showed nothing when you typing the codes? must be a line that cause all of this, and why it doesnt appear on exception log?!

what SO are you using?

please try to comment all the access to static memeber in your class and test it and let us to know if it works,
i mean if it not crash


 @Override
   public void mouseClicked(MouseEvent e) {
      //MouseController.clicked = true;
   }
   
   @Override
   public void mouseMoved(MouseEvent e) {
      //MouseController.mousePosition.x = e.getX();
      //MouseController.mousePosition.y = e.getY();

      //MouseController.clicked = false;
   }

try also to substitute mouseClicked(MouseEvent e) with mousePressed(MouseEvent e)

When I typed in the codes? There’s no syntax error etc. in my code. :stuck_out_tongue: It just happened randomly while I was just clicking the mouse for a while.

Trouble is, I couldn’t reproduce the error. I kept clicking around for a few minutes without anything bugging out. Besides, it didn’t kill my app, it just spewed that error to the console.

Oh, and I’m using osx. :slight_smile:

Means your code works (constructor and init phase passed) and error happened on your mouseClicked().

Well, like I said, the program didn’t crash or anything, I could continue clicking and getting a response after it gave me that error. And I haven’t been able to generate it again.

My mouseClicked() only sets a variable to true, so there isn’t a whole lot that can go wrong there ^^

And this is the code that is run when the mouse is clicked.

if(MouseController.clicked()) {
	this.entities.add(new Block(MouseController.getPosition().x, MouseController.getPosition().y));
}

But I was just curious about the error, it didn’t seem like it broke anything. :slight_smile:

An extremely rare VM bug? Unstable overclock?

Probably just wonky data from the device that didn’t get filtered by the driver. Happens all the time with pointing devices.

“BEWARE OF THE WONKY DATA!!!”
:persecutioncomplex:

It’s probably not a driver issue. Mouse clicks should be the simplest thing the driver has to handle. You’ve got several layers working to ensure correctness, the software inside the mouse, the driver for the mouse, which is probably a generic one tested on many kinds of mice, (possibly) the operating system, and (possibly) the JVM. The first three layers should all filter bad data. When the input data finally reaches the application, it should look like the mouse is behaving correctly even if some other glitch affected that data. The user should not be able to break a program with a bunch of random mouse clicks.

I am guessing it’s a JVM implementation bug. The Mac implementation has been problematic for as long as I can remember for longer than I’ve been using Java, usually in some odd, face-palm worthy way. Don’t worry about changing your code to prevent it, since there isn’t anything you can do to fix that. Your mouse events should normally be reliable and don’t need to be filtered/corrected on an application level.

Yeah, I figured it was something strange like that and since it didn’t seem to break my app, then meh, I don’t care. I was just curious about it. :slight_smile:

Thanks for all the replies folks! :smiley: